X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient_menu.c;h=e92a772cc827f7465f4e7b961b86d18d246b1526;hb=b1a50affe5bc968bffaac0e87ae108259beed428;hp=b0a483838956efcb66114c1335489a03ed093f39;hpb=0fedacf700e9f8af32a8fdda91a369b5562ab4ba;p=chaz%2Fopenbox diff --git a/openbox/client_menu.c b/openbox/client_menu.c index b0a48383..e92a772c 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -19,11 +19,13 @@ #include "debug.h" #include "menu.h" #include "menuframe.h" +#include "config.h" #include "screen.h" #include "client.h" #include "openbox.h" #include "frame.h" #include "moveresize.h" +#include "event.h" #include "prop.h" #include "gettext.h" @@ -45,8 +47,7 @@ enum { CLIENT_ICONIFY, CLIENT_RESTORE, CLIENT_MAXIMIZE, - CLIENT_ROLL_UP, - CLIENT_ROLL_DOWN, + CLIENT_SHADE, CLIENT_DECORATE, CLIENT_MOVE, CLIENT_RESIZE, @@ -78,11 +79,8 @@ static gboolean client_menu_update(ObMenuFrame *frame, gpointer data) *en = ((c->functions & OB_CLIENT_FUNC_MAXIMIZE) && (!c->max_horz || !c->max_vert)); break; - case CLIENT_ROLL_UP: - *en = c->functions & OB_CLIENT_FUNC_SHADE && !c->shaded; - break; - case CLIENT_ROLL_DOWN: - *en = c->functions & OB_CLIENT_FUNC_SHADE && c->shaded; + case CLIENT_SHADE: + *en = c->functions & OB_CLIENT_FUNC_SHADE; break; case CLIENT_MOVE: *en = c->functions & OB_CLIENT_FUNC_MOVE; @@ -94,7 +92,7 @@ static gboolean client_menu_update(ObMenuFrame *frame, gpointer data) *en = c->functions & OB_CLIENT_FUNC_CLOSE; break; case CLIENT_DECORATE: - *en = client_normal(c); + *en = c->functions & OB_CLIENT_FUNC_UNDECORATE; break; default: *en = TRUE; @@ -105,13 +103,16 @@ static gboolean client_menu_update(ObMenuFrame *frame, gpointer data) } static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f, - ObClient *c, guint state, gpointer data, - Time time) + ObClient *c, guint state, gpointer data) { gint x, y; + gulong ignore_start; g_assert(c); + if (!config_focus_under_mouse) + ignore_start = event_start_ignore_all_enters(); + switch (e->id) { case CLIENT_ICONIFY: /* the client won't be on screen anymore so hide the menu */ @@ -126,11 +127,8 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f, case CLIENT_MAXIMIZE: client_maximize(c, TRUE, 0); break; - case CLIENT_ROLL_UP: - client_shade(c, TRUE); - break; - case CLIENT_ROLL_DOWN: - client_shade(c, FALSE); + case CLIENT_SHADE: + client_shade(c, !c->shaded); break; case CLIENT_DECORATE: client_set_undecorated(c, !c->undecorated); @@ -160,6 +158,9 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f, g_assert_not_reached(); } + if (!config_focus_under_mouse) + event_end_ignore_all_enters(ignore_start); + /* update the menu cuz stuff can have changed */ if (f) { client_menu_update(f, NULL); @@ -183,13 +184,13 @@ static gboolean layer_menu_update(ObMenuFrame *frame, gpointer data) if (e->type == OB_MENU_ENTRY_TYPE_NORMAL) { switch (e->id) { case LAYER_TOP: - *en = !c->above; + *en = !c->above && (c->functions & OB_CLIENT_FUNC_ABOVE); break; case LAYER_NORMAL: *en = c->above || c->below; break; case LAYER_BOTTOM: - *en = !c->below; + *en = !c->below && (c->functions & OB_CLIENT_FUNC_BELOW); break; default: *en = TRUE; @@ -200,11 +201,15 @@ static gboolean layer_menu_update(ObMenuFrame *frame, gpointer data) } static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f, - ObClient *c, guint state, gpointer data, - Time time) + ObClient *c, guint state, gpointer data) { + gulong ignore_start; + g_assert(c); + if (!config_focus_under_mouse) + ignore_start = event_start_ignore_all_enters(); + switch (e->id) { case LAYER_TOP: client_set_layer(c, 1); @@ -219,6 +224,9 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f, g_assert_not_reached(); } + if (!config_focus_under_mouse) + event_end_ignore_all_enters(ignore_start); + /* update the menu cuz stuff can have changed */ if (f) { layer_menu_update(f, NULL); @@ -271,23 +279,22 @@ static gboolean send_to_menu_update(ObMenuFrame *frame, gpointer data) } static void send_to_menu_execute(ObMenuEntry *e, ObMenuFrame *f, - ObClient *c, guint state, gpointer data, - Time time) + ObClient *c, guint state, gpointer data) { g_assert(c); - client_set_desktop(c, e->id, FALSE); + client_set_desktop(c, e->id, FALSE, FALSE); /* the client won't even be on the screen anymore, so hide the menu */ if (f) menu_frame_hide_all(); } static void client_menu_place(ObMenuFrame *frame, gint *x, gint *y, - gint button, gpointer data) + gboolean mouse, gpointer data) { gint dx, dy; - if (button == 0 && frame->client) { + if (!mouse && frame->client) { *x = frame->client->frame->area.x; /* try below the titlebar */ @@ -398,9 +405,7 @@ void client_menu_startup() e->data.normal.mask_disabled_selected_color = ob_rr_theme->menu_disabled_selected_color; - menu_add_normal(menu, CLIENT_ROLL_UP, _("Roll &up"), NULL, TRUE); - - menu_add_normal(menu, CLIENT_ROLL_DOWN, _("Roll do&wn"), NULL, TRUE); + menu_add_normal(menu, CLIENT_SHADE, _("&Roll up/down"), NULL, TRUE); menu_add_normal(menu, CLIENT_DECORATE, _("Un/&Decorate"), NULL, TRUE);