Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread Yury Tarasievich

On 08/25/2015 10:12 PM, Josip Deanovic wrote:

On Tuesday 2015-08-25 20:19:38 Yury Tarasievich wrote:

Call me dim, but this functionality is useful
for what use scenario?


This feature could prove useful in case when you have an application
that requires several repetitive keyboard events and instead of
typing something in, you could just select the sequence of keyboard
events from the configured usermenu.

...

Hmm, so you describe a sort of 
complex-input-assisting component.


That, in itself, is surely handy, but seems to 
me it wasn't the intended use for usermenu. 
Like, I click the app and may get this input 
assistant from WM? I just don't see it, the 
purpose of usermenu must be something more general.


Thanks for explanation, anyway.

-Yury


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[PATCH (whome)] Update wmifs, wmppp.app, and wmsun on dockapps webpage.

2015-08-25 Thread Doug Torrance
---
 dockapps/dockapps.db | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dockapps/dockapps.db b/dockapps/dockapps.db
index 90bf49a..35c2f7c 100644
--- a/dockapps/dockapps.db
+++ b/dockapps/dockapps.db
@@ -330,7 +330,7 @@ dockapps = 72
 category = Network
 
 [wmifs]
-version-1.5+20150816 = 6850ba9d4fc861a921b76b129f09a5dd20aa6574
+version-1.6 = a15dc597a0f8cea2c735b48f88a9903ee347a568
 version-1.5 = 4128ba27446478e714619062930ace930cc46e8b
 version-1.4 = 667077ad937a814152f5c1d5b72115654ede9f44
 version-1.3b1 = 4241b86c9b50654e9a47c8271e471e122ece328a
@@ -527,7 +527,7 @@ dockapps = 164
 category = System Monitoring
 
 [wmppp.app]
-version-1.3.1+20150816 = 73b68c9c943237e7f822f1ee7090fb71a60bf8bc
+version-1.3.2 = 7ec90029bfc66a38bd32cefc1010796114927501
 version-1.3.1 = 8461cce2c346b913e92d2d8d72ca239c5f0e279e
 version-1.3.0 = ce6a2505fafc92acfb2d2f6b17cd7f7e52b5d241
 image = wmppp.jpg
@@ -569,7 +569,7 @@ dockapps = 63
 category = Audio
 
 [wmsun]
-version-1.04+20150816 = 7b8875cae64a24ff7d1ba1ed4461d9ac30f649be
+version-1.05 = a1e67bd6524cf9185ccf9264f3ae54ece0fd5f66
 version-1.04 = d2da72b85da82ef14af8aaf51ae6779b949b9cc0
 version-1.03 = 7ef62d15e754d9095c5340465b7dc84ed8d90be5
 image = wmSun.gif
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread Josip Deanovic
On Tuesday 2015-08-25 20:19:38 Yury Tarasievich wrote:
> Thank you so very much. I understand now how it 
> functions.
> 
> Not all clear yet, though:
> 
> Call me dim, but this functionality is useful 
> for what use scenario?

This feature could prove useful in case when you have an application
that requires several repetitive keyboard events and instead of
typing something in, you could just select the sequence of keyboard
events from the configured usermenu.

The possibilities and use cases are endless.
For example, with a calculator application such as xcalc or kcalc
one could come up with the usermenu containing every possible
constant you can imagine.
This could be handy for people who are using a lot of constants
in their calculations.

And this is just one simple example that came to my mind.

Another example, if you are using e-mail client which doesn't
support templates you could create a usermenu options with the keyboard
event sequences used to create a new e-mail and enter the the text
you want to use as a template.

-- 
Josip Deanovic


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread Yury Tarasievich
Thank you so very much. I understand now how it 
functions.


Not all clear yet, though:

Call me dim, but this functionality is useful 
for what use scenario?


Like, *when* might I want a menu popping up on 
every focus change? (I assume this is explicit 
switch of focus, not 
auto-grabbing-focus-from-passing-mouse).


If somebody could offer some advice on this, please?

-Yury

On 08/25/2015 06:39 PM, Josip Deanovic wrote:
...

3. Run kcalc and every time it is focused with the pointer a menu should
appear. Selecting a option from the menu will send the specified
keyboard event to the kcalc window (kcalc.Kcalc window to be exact).



--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


[repo.or.cz] wmaker-crm.git branch next updated: wmaker-0.95.7-11-g97189ce

2015-08-25 Thread crmafra
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
   via  97189ce2cccbffa6af9aa824e52a375dcfa415a0 (commit)
   via  2fec5f9f2817bf331c7fbc43de30d9a83ab32a22 (commit)
  from  7a2eb68aa47a35eede44457db5d300719be4dcdd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
http://repo.or.cz/w/wmaker-crm.git/commit/97189ce2cccbffa6af9aa824e52a375dcfa415a0

commit 97189ce2cccbffa6af9aa824e52a375dcfa415a0
Author: Rodolfo García Peñas (kix) 
Date:   Tue Aug 25 09:41:53 2015 +0200

Enable usermenu

This patch enables the usermenu when the application is launched
and the usermenu file exists.

Signed-off-by: Rodolfo García Peñas (kix) 

diff --git a/src/actions.c b/src/actions.c
index 5adfab4..b210888 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -225,6 +225,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
wUserMenuRefreshInstances(napp->menu, wwin);
 #endif /* USER_MENU */
 
+   /* kix: Only menu map with mouse, not alt+tab! */
if (wwin->flags.mapped)
wAppMenuMap(napp->menu, wwin);
}
diff --git a/src/application.c b/src/application.c
index c43df04..6ff3d3f 100644
--- a/src/application.c
+++ b/src/application.c
@@ -129,6 +129,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
 #ifdef USER_MENU
if (!wapp->menu)
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
+
+   wAppMenuMap(wapp->menu, wwin);
 #endif
 
/* Set application wide attributes from the leader */

http://repo.or.cz/w/wmaker-crm.git/commit/2fec5f9f2817bf331c7fbc43de30d9a83ab32a22

commit 2fec5f9f2817bf331c7fbc43de30d9a83ab32a22
Author: Rodolfo García Peñas (kix) 
Date:   Tue Aug 25 09:41:52 2015 +0200

usermenu.c Avoid compiler warnings

This patch includes some changes to avoid compiler warnings and
some code style.

Compiler warnings are:

- notifyClient, do not uses the menu argument. Including (void) menu.
- WUserMenuData, keyover: label is not used.
- configureUserMenu, params is not initialized.
- configureUserMenu, mentry is not initialized.

Signed-off-by: Rodolfo García Peñas (kix) 

diff --git a/src/usermenu.c b/src/usermenu.c
index c349810..b5c0cfe 100644
--- a/src/usermenu.c
+++ b/src/usermenu.c
@@ -87,7 +87,7 @@ typedef struct {
int key_no;
 } WUserMenuData;
 
-static void notifyClient(WMenu * menu, WMenuEntry * entry)
+static void notifyClient(WMenu *menu, WMenuEntry *entry)
 {
XEvent event;
WUserMenuData *data = entry->clientdata;
@@ -95,6 +95,8 @@ static void notifyClient(WMenu * menu, WMenuEntry * entry)
Window window;
int i;
 
+   (void) menu;
+
window = scr->focused_window->client_win;
 
for (i = 0; i < data->key_no; i++) {
@@ -128,20 +130,19 @@ static void removeUserMenudata(void *menudata)
wfree(data);
 }
 
-static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
+static WUserMenuData *convertShortcuts(WScreen *scr, WMPropList *shortcut)
 {
WUserMenuData *data;
KeySym ksym;
char *k, buf[MAX_SHORTCUT_LENGTH], *b;
int keycount, i, j, mod;
 
-   if (WMIsPLString(shortcut)) {
+   if (WMIsPLString(shortcut))
keycount = 1;
-   } else if (WMIsPLArray(shortcut)) {
+   else if (WMIsPLArray(shortcut))
keycount = WMGetPropListItemCount(shortcut);
-   } else {
+   else
return NULL;
-   }
 
data = wmalloc(sizeof(WUserMenuData));
if (!data)
@@ -160,7 +161,7 @@ static WUserMenuData *convertShortcuts(WScreen * scr, 
WMPropList * shortcut)
else
wstrlcpy(buf, WMGetFromPLString(shortcut), 
MAX_SHORTCUT_LENGTH);
 
-   b = (char *)buf;
+   b = (char *) buf;
 
while ((k = strchr(b, '+')) != NULL) {
*k = 0;
@@ -181,8 +182,6 @@ static WUserMenuData *convertShortcuts(WScreen * scr, 
WMPropList * shortcut)
j++;
}
 
- keyover:
-
/* get key */
if (!j) {
puts("fatal j");
@@ -190,17 +189,18 @@ static WUserMenuData *convertShortcuts(WScreen * scr, 
WMPropList * shortcut)
wfree(data);
return NULL;
}
+
data->key_no = j;
data->screen = scr;
 
return data;
 }
 
-static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
+static WMenu *configureUserMenu(WScreen *scr, WMPropList *plum)
 {
char *mtitle;
WMenu *menu = NULL;
-   WMPropList *elem, *title, *command, *

Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread kix


El 25 de agosto de 2015 19:15:52 CEST, "Amadeusz Sławiński"  
escribió:
>On Tue, 25 Aug 2015 07:45:03 +
>"Rodolfo García Peñas (kix)"  wrote:
>
>> This patch is mostly for testing.
>
>So I tested it ;)
>
>and I seem to have found a problem: it hardcodes path where it looks
>for
>menus.
>
>I personally don't like GNUstep folder in my $HOME, so I have this in
>my .xinitrc:
>export GNUSTEP_USER_ROOT="${HOME}/.config/WindowMaker"
>however when I put menu file into directory:
>.config/WindowMaker/Library/WindowMaker/UserMenus 
>Window Maker doesn't see it, but when I put it in 
>~/GNUstep/Library/WindowMaker/UserMenus
>menu appears.

Yes, the path is hardcoded. I will release a patch to solve it.

>
>As a side question, how exactly is it supposed to work? Does it send
>input to active window of the app it is for? I've tried the example
>one for xcalc, but used it with xterm and nothing happens when I click
>menu items, I would assume it would type some numbers in, even if it
>was not meant for xterm.
>
>Amadeusz

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread Yury Tarasievich
Guys, terribly sorry for the ignorance, but I 
somehow can't figure out this new (old?) menu thing?


It is named .menu and has to 
reside in a specific location, that much I've got.


Now, tell me, please, when/how is this new menu 
activated; is it superceding the global menu? 
So, e.g., 'maximize' from global menu item must 
be added by hand into every such app menu?


Can't play with patching/compiling right now.

-Yury

On 08/25/2015 08:15 PM, Amadeusz Sławiński wrote:
...


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread Amadeusz Sławiński
On Tue, 25 Aug 2015 07:45:03 +
"Rodolfo García Peñas (kix)"  wrote:

> This patch is mostly for testing.

So I tested it ;)

and I seem to have found a problem: it hardcodes path where it looks for
menus.

I personally don't like GNUstep folder in my $HOME, so I have this in
my .xinitrc:
export GNUSTEP_USER_ROOT="${HOME}/.config/WindowMaker"
however when I put menu file into directory:
.config/WindowMaker/Library/WindowMaker/UserMenus 
Window Maker doesn't see it, but when I put it in 
~/GNUstep/Library/WindowMaker/UserMenus
menu appears.


As a side question, how exactly is it supposed to work? Does it send
input to active window of the app it is for? I've tried the example
one for xcalc, but used it with xterm and nothing happens when I click
menu items, I would assume it would type some numbers in, even if it
was not meant for xterm.

Amadeusz


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Help with appmenu [was: Re: Question about menus (usermenu, appmenu)]

2015-08-25 Thread Josip Deanovic
On Tuesday 2015-08-25 14:54:59 Rodolfo García  Peñas wrote:
> > I have found this excerpt in NEWS file, it is related to Shared
> > application icons but there is some info about appmenu:
> > 
> > -BEGIN-
> > As a side note: wterm can use the shared appicon feature as long as it
> > doesn't use the appmenu (will do this by default). If you start it
> > using the appmenu (wterm -wm) it will disable the shared appicon
> > feature because apps with appmenus are incompatible with this feature.
> > 
> > If an application is a GNUstep application or if it has an appmenu,
> > it's detected automatically and the shared appicon is disabled
> > automatically without any user intervention or need to configure
> > anything.
> > -END-
> 
> Yes!!
> 
> I downloaded wterm (http://sourceforge.net/p/wterm/code/) and I can  
> see the menu.
> Thanks a lot. Amazing! Image attached.

I didn't know about _WINDOWMAKER_MENU property.
It might even be used with a docked apps which need some kind of menu.

Maybe it would be a good idea to add some note in the NEWS file so
that people get some idea about what appmenu actually is.

-- 
Josip Deanovic


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Help with appmenu [was: Re: Question about menus (usermenu, appmenu)]

2015-08-25 Thread Josip Deanovic
Josip DeanovicOn Tuesday 2015-08-25 14:20:12  wrote:
> On Tuesday 2015-08-25 07:54:03 Rodolfo García  Peñas wrote:
> > Hello,
> > 
> > ok, the usermenu is now clear. IMO, we can improve this menu, for
> > example to send text to xterms or similar (menu with "ssh -l user
> > example.com" could be nice).
> > 
> > But my problem now is related to appmenu. I don't know how this menu
> > is used by the user, and how is configured. It includes X11 calls to
> > create a menu and store it in wapp->menu (usermenu uses the same
> > pointer).
> > 
> > Help about it is very appreciated.
> 
> I have found this excerpt in NEWS file, it is related to Shared
> application icons but there is some info about appmenu:
> 
> -BEGIN-
> As a side note: wterm can use the shared appicon feature as long as it
> doesn't use the appmenu (will do this by default). If you start it
> using the appmenu (wterm -wm) it will disable the shared appicon
> feature because apps with appmenus are incompatible with this feature.
> 
> If an application is a GNUstep application or if it has an appmenu, it's
> detected automatically and the shared appicon is disabled automatically
> without any user intervention or need to configure anything.
> -END-
> 
> 
> I have installed some GNUstep applications just to check their window
> properties. I would say that what makes a GNUstep application
> recognizable is the WM_CLASS set to GNUstep.
> 
> From the excerpt above I would speculate that appmenu is not a
> configurable option which could be used for any application but the
> feature of an application.
> I am speculating here but it might be that an application need to
> create a window of a docked type and with some appropriate hints (skip
> taskbar, skip pager, sticky and so on) which would then act as an
> appmenu.
> 
> Is there something in a code that would support this?

I have just compiled wterm to check what "wterm -wm" does and it's
a bit different comparing to what GNUstep applications usually do.

While GNUstep applications create menu (a window of course) that uses
NEXT colors (mainly gray), wterm is actually creating menu that looks
the same as other internal windowmaker menus.

Looking into wterm window properties shows that in this case there
is a property called _WINDOWMAKER_MENU which contains the definition
of the wterm menu options.

Hope that this helps a bit.

-- 
Josip Deanovic


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Help with appmenu [was: Re: Question about menus (usermenu, appmenu)]

2015-08-25 Thread Josip Deanovic
On Tuesday 2015-08-25 07:54:03 Rodolfo García  Peñas wrote:
> Hello,
> 
> ok, the usermenu is now clear. IMO, we can improve this menu, for  
> example to send text to xterms or similar (menu with "ssh -l user  
> example.com" could be nice).
> 
> But my problem now is related to appmenu. I don't know how this menu  
> is used by the user, and how is configured. It includes X11 calls to  
> create a menu and store it in wapp->menu (usermenu uses the same  
> pointer).
> 
> Help about it is very appreciated.

I have found this excerpt in NEWS file, it is related to Shared
application icons but there is some info about appmenu:

-BEGIN-
As a side note: wterm can use the shared appicon feature as long as it
doesn't use the appmenu (will do this by default). If you start it
using the appmenu (wterm -wm) it will disable the shared appicon
feature because apps with appmenus are incompatible with this feature.

If an application is a GNUstep application or if it has an appmenu, it's
detected automatically and the shared appicon is disabled automatically
without any user intervention or need to configure anything.
-END-


I have installed some GNUstep applications just to check their window
properties. I would say that what makes a GNUstep application recognizable
is the WM_CLASS set to GNUstep.

>From the excerpt above I would speculate that appmenu is not a
configurable option which could be used for any application but the
feature of an application.
I am speculating here but it might be that an application need to
create a window of a docked type and with some appropriate hints (skip 
taskbar, skip pager, sticky and so on) which would then act as an appmenu.

Is there something in a code that would support this?

-- 
Josip Deanovic


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Help with appmenu [was: Re: Question about menus (usermenu, appmenu)]

2015-08-25 Thread Rodolfo García Peñas (kix)


Josip Deanovic  escribió:


On Monday 2015-08-24 05:48:08 Rodolfo García  Peñas wrote:

IMO we could remove these menus because:

1. Are not documented. The user don't know how to create/use the menu.
2. Are not examples, only in the source code we can find how to
configure the menu.
3. The line to show the menu (in the source) is difficult to reach by
the user.


Hello,

ok, the usermenu is now clear. IMO, we can improve this menu, for  
example to send text to xterms or similar (menu with "ssh -l user  
example.com" could be nice).


But my problem now is related to appmenu. I don't know how this menu  
is used by the user, and how is configured. It includes X11 calls to  
create a menu and store it in wapp->menu (usermenu uses the same  
pointer).


Help about it is very appreciated.

Cheers,
kix

Rodolfo García Peñas (kix)
http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: Question about menus (usermenu, appmenu)

2015-08-25 Thread Rodolfo García Peñas (kix)


Josip Deanovic  escribió:


Josip DeanovicOn Monday 2015-08-24 21:53:25  wrote:

> BTW, Wouldn't it be a better to use the path
> ~/GNUstep/Library/WindowMaker/UserMenus than
> ~/GNUstep/Defaults/UserMenus

I have googled for UserMenus and gnustep and found that number of
people found that this feature works if they use the path
~/GNUstep/Library/WindowMaker/UserMenus

So, unless there is a good reason to put that directory under
the ~/GNUstep/Defaults maybe it would be a good idea to just
fix the documentation and leave the path as it was.

That also gives the answer to the original question in the thread:
yes, we can expect that there are people who learned to use that
feature. :-)


Looking trough the NEWS file...

The feature first appeared in 0.53.0

And later, in version 0.60.0 it says:

-BEGIN-
User Menu
-

The user menu is now a compile time option disabled by default.
Supply --enable-usermenu to configure to enable it.
-END-


and...


-BEGIN-
Application User Menu Path Changes
--

Default configuration for user specific menus installed in
/usr/local/share/WindowMaker/UserMenus or $(datadir)/WindowMaker/UserMenus
and ~/GNUstep/Library/WindowMaker/UserMenus.
-END-


So actually regarding the path everything was fine in the code, we just
didn't find it in the documentation right away.

I would suggest an addition of a line under the initial announcement
with the note that path has changed to
~/GNUstep/Library/WindowMaker/UserMenus in a later versions so that
people don't get confused.


I updated the patch.

Thanks for your comments.

kix.


Rodolfo García Peñas (kix)
http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 2/2] Enable usermenu

2015-08-25 Thread Rodolfo García Peñas (kix)

This patch is mostly for testing.

"Rodolfo García Peñas (kix)"  escribió:


This patch enables the usermenu when the application is launched
and the usermenu file exists.

Signed-off-by: Rodolfo García Peñas (kix) 
---
 src/actions.c | 1 +
 src/application.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/actions.c b/src/actions.c
index 5adfab4..b210888 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -225,6 +225,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
wUserMenuRefreshInstances(napp->menu, wwin);
 #endif /* USER_MENU */

+   /* kix: Only menu map with mouse, not alt+tab! */
if (wwin->flags.mapped)
wAppMenuMap(napp->menu, wwin);
}
diff --git a/src/application.c b/src/application.c
index c43df04..6ff3d3f 100644
--- a/src/application.c
+++ b/src/application.c
@@ -129,6 +129,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
 #ifdef USER_MENU
if (!wapp->menu)
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
+
+   wAppMenuMap(wapp->menu, wwin);
 #endif

/* Set application wide attributes from the leader */
--
2.5.0


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.



Rodolfo García Peñas (kix)
http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.


Re: [PATCH 1/2] usermenu.c Avoid compiler warnings

2015-08-25 Thread Rodolfo García Peñas (kix)

Hi Carlos,

you can apply this patch to the git without problems.

Cheers,
kix

"Rodolfo García Peñas (kix)"  escribió:


This patch includes some changes to avoid compiler warnings and
some code style.

Compiler warnings are:

- notifyClient, do not uses the menu argument. Including (void) menu.
- WUserMenuData, keyover: label is not used.
- configureUserMenu, params is not initialized.
- configureUserMenu, mentry is not initialized.

Signed-off-by: Rodolfo García Peñas (kix) 
---
 src/usermenu.c | 38 +-
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/usermenu.c b/src/usermenu.c
index c349810..b5c0cfe 100644
--- a/src/usermenu.c
+++ b/src/usermenu.c
@@ -87,7 +87,7 @@ typedef struct {
int key_no;
 } WUserMenuData;

-static void notifyClient(WMenu * menu, WMenuEntry * entry)
+static void notifyClient(WMenu *menu, WMenuEntry *entry)
 {
XEvent event;
WUserMenuData *data = entry->clientdata;
@@ -95,6 +95,8 @@ static void notifyClient(WMenu * menu, WMenuEntry * entry)
Window window;
int i;

+   (void) menu;
+
window = scr->focused_window->client_win;

for (i = 0; i < data->key_no; i++) {
@@ -128,20 +130,19 @@ static void removeUserMenudata(void *menudata)
wfree(data);
 }

-static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
+static WUserMenuData *convertShortcuts(WScreen *scr, WMPropList *shortcut)
 {
WUserMenuData *data;
KeySym ksym;
char *k, buf[MAX_SHORTCUT_LENGTH], *b;
int keycount, i, j, mod;

-   if (WMIsPLString(shortcut)) {
+   if (WMIsPLString(shortcut))
keycount = 1;
-   } else if (WMIsPLArray(shortcut)) {
+   else if (WMIsPLArray(shortcut))
keycount = WMGetPropListItemCount(shortcut);
-   } else {
+   else
return NULL;
-   }

data = wmalloc(sizeof(WUserMenuData));
if (!data)
@@ -160,7 +161,7 @@ static WUserMenuData *convertShortcuts(WScreen *  
scr, WMPropList * shortcut)

else
wstrlcpy(buf, WMGetFromPLString(shortcut), 
MAX_SHORTCUT_LENGTH);

-   b = (char *)buf;
+   b = (char *) buf;

while ((k = strchr(b, '+')) != NULL) {
*k = 0;
@@ -181,8 +182,6 @@ static WUserMenuData *convertShortcuts(WScreen *  
scr, WMPropList * shortcut)

j++;
}

- keyover:
-
/* get key */
if (!j) {
puts("fatal j");
@@ -190,17 +189,18 @@ static WUserMenuData *convertShortcuts(WScreen  
* scr, WMPropList * shortcut)

wfree(data);
return NULL;
}
+
data->key_no = j;
data->screen = scr;

return data;
 }

-static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
+static WMenu *configureUserMenu(WScreen *scr, WMPropList *plum)
 {
char *mtitle;
WMenu *menu = NULL;
-   WMPropList *elem, *title, *command, *params;
+   WMPropList *elem, *title, *command, *params = NULL;
int count, i;
WUserMenuData *data;

@@ -219,18 +219,18 @@ static WMenu *configureUserMenu(WScreen * scr,  
WMPropList * plum)

return NULL;

mtitle = WMGetFromPLString(elem);
-
menu = wMenuCreateForApp(scr, mtitle, True);

for (i = 1; i < count; i++) {
elem = WMGetFromPLArray(plum, i);
if (WMIsPLArray(WMGetFromPLArray(elem, 1))) {
WMenu *submenu;
-   WMenuEntry *mentry;
+   WMenuEntry *mentry = NULL;

submenu = configureUserMenu(scr, elem);
if (submenu)
mentry = wMenuAddCallback(menu, 
submenu->frame->title, NULL, NULL);
+
wMenuEntrySetCascade(menu, mentry, submenu);
} else {
int idx = 0;
@@ -277,7 +277,7 @@ static WMenu *configureUserMenu(WScreen * scr,  
WMPropList * plum)

return menu;
 }

-void wUserMenuRefreshInstances(WMenu * menu, WWindow * wwin)
+void wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
 {
int i, j, count, paintflag;

@@ -301,10 +301,12 @@ void wUserMenuRefreshInstances(WMenu * menu,  
WWindow * wwin)

break;
}
}
+
if (oldflag != menu->entries[i]->flags.enabled)
paintflag = 1;
}
}
+
for (i = 0; i < menu->cascade_no; i++) {
if (!menu->cascades[i]->flags.brother)
wUserMenuRefreshInstances(menu->cascades[i], wwin);
@@ -326,14 +328,15 @@ static WMenu *readUserMenuFile(WScreen *scr,  
const char *file_name)

menu = configureUserMenu(scr, plum);
WMReleasePropList

[PATCH 1/2] usermenu.c Avoid compiler warnings

2015-08-25 Thread kix
This patch includes some changes to avoid compiler warnings and
some code style.

Compiler warnings are:

- notifyClient, do not uses the menu argument. Including (void) menu.
- WUserMenuData, keyover: label is not used.
- configureUserMenu, params is not initialized.
- configureUserMenu, mentry is not initialized.

Signed-off-by: Rodolfo García Peñas (kix) 
---
 src/usermenu.c | 38 +-
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/usermenu.c b/src/usermenu.c
index c349810..b5c0cfe 100644
--- a/src/usermenu.c
+++ b/src/usermenu.c
@@ -87,7 +87,7 @@ typedef struct {
int key_no;
 } WUserMenuData;
 
-static void notifyClient(WMenu * menu, WMenuEntry * entry)
+static void notifyClient(WMenu *menu, WMenuEntry *entry)
 {
XEvent event;
WUserMenuData *data = entry->clientdata;
@@ -95,6 +95,8 @@ static void notifyClient(WMenu * menu, WMenuEntry * entry)
Window window;
int i;
 
+   (void) menu;
+
window = scr->focused_window->client_win;
 
for (i = 0; i < data->key_no; i++) {
@@ -128,20 +130,19 @@ static void removeUserMenudata(void *menudata)
wfree(data);
 }
 
-static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
+static WUserMenuData *convertShortcuts(WScreen *scr, WMPropList *shortcut)
 {
WUserMenuData *data;
KeySym ksym;
char *k, buf[MAX_SHORTCUT_LENGTH], *b;
int keycount, i, j, mod;
 
-   if (WMIsPLString(shortcut)) {
+   if (WMIsPLString(shortcut))
keycount = 1;
-   } else if (WMIsPLArray(shortcut)) {
+   else if (WMIsPLArray(shortcut))
keycount = WMGetPropListItemCount(shortcut);
-   } else {
+   else
return NULL;
-   }
 
data = wmalloc(sizeof(WUserMenuData));
if (!data)
@@ -160,7 +161,7 @@ static WUserMenuData *convertShortcuts(WScreen * scr, 
WMPropList * shortcut)
else
wstrlcpy(buf, WMGetFromPLString(shortcut), 
MAX_SHORTCUT_LENGTH);
 
-   b = (char *)buf;
+   b = (char *) buf;
 
while ((k = strchr(b, '+')) != NULL) {
*k = 0;
@@ -181,8 +182,6 @@ static WUserMenuData *convertShortcuts(WScreen * scr, 
WMPropList * shortcut)
j++;
}
 
- keyover:
-
/* get key */
if (!j) {
puts("fatal j");
@@ -190,17 +189,18 @@ static WUserMenuData *convertShortcuts(WScreen * scr, 
WMPropList * shortcut)
wfree(data);
return NULL;
}
+
data->key_no = j;
data->screen = scr;
 
return data;
 }
 
-static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
+static WMenu *configureUserMenu(WScreen *scr, WMPropList *plum)
 {
char *mtitle;
WMenu *menu = NULL;
-   WMPropList *elem, *title, *command, *params;
+   WMPropList *elem, *title, *command, *params = NULL;
int count, i;
WUserMenuData *data;
 
@@ -219,18 +219,18 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList 
* plum)
return NULL;
 
mtitle = WMGetFromPLString(elem);
-
menu = wMenuCreateForApp(scr, mtitle, True);
 
for (i = 1; i < count; i++) {
elem = WMGetFromPLArray(plum, i);
if (WMIsPLArray(WMGetFromPLArray(elem, 1))) {
WMenu *submenu;
-   WMenuEntry *mentry;
+   WMenuEntry *mentry = NULL;
 
submenu = configureUserMenu(scr, elem);
if (submenu)
mentry = wMenuAddCallback(menu, 
submenu->frame->title, NULL, NULL);
+
wMenuEntrySetCascade(menu, mentry, submenu);
} else {
int idx = 0;
@@ -277,7 +277,7 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList * 
plum)
return menu;
 }
 
-void wUserMenuRefreshInstances(WMenu * menu, WWindow * wwin)
+void wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
 {
int i, j, count, paintflag;
 
@@ -301,10 +301,12 @@ void wUserMenuRefreshInstances(WMenu * menu, WWindow * 
wwin)
break;
}
}
+
if (oldflag != menu->entries[i]->flags.enabled)
paintflag = 1;
}
}
+
for (i = 0; i < menu->cascade_no; i++) {
if (!menu->cascades[i]->flags.brother)
wUserMenuRefreshInstances(menu->cascades[i], wwin);
@@ -326,14 +328,15 @@ static WMenu *readUserMenuFile(WScreen *scr, const char 
*file_name)
menu = configureUserMenu(scr, plum);
WMReleasePropList(plum);
}
+
return menu;
 }
 
-WMenu *wUserMenuGet(WScreen * scr, WWindow * wwin)
+WMenu *wUserMenuGet(W

[PATCH 2/2] Enable usermenu

2015-08-25 Thread kix
This patch enables the usermenu when the application is launched
and the usermenu file exists.

Signed-off-by: Rodolfo García Peñas (kix) 
---
 src/actions.c | 1 +
 src/application.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/actions.c b/src/actions.c
index 5adfab4..b210888 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -225,6 +225,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
wUserMenuRefreshInstances(napp->menu, wwin);
 #endif /* USER_MENU */
 
+   /* kix: Only menu map with mouse, not alt+tab! */
if (wwin->flags.mapped)
wAppMenuMap(napp->menu, wwin);
}
diff --git a/src/application.c b/src/application.c
index c43df04..6ff3d3f 100644
--- a/src/application.c
+++ b/src/application.c
@@ -129,6 +129,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
 #ifdef USER_MENU
if (!wapp->menu)
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
+
+   wAppMenuMap(wapp->menu, wwin);
 #endif
 
/* Set application wide attributes from the leader */
-- 
2.5.0


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.