all repos — openbox @ 1ef0d8eb53fcae52afbae74310fbef0cac729951

openbox fork - make it a bit more like ryudo

Fixing bug from commit 041d17373e04

Pressing a button and leave/enter would cause the button to show hover mode, not pressed mode.  Change the behaviour back to how it used to be for pressing (the button stays pressed when you move outside of its box) and make it work correctly, as commit 041d17373e04 also did for menus.

Reverting this behaviour because it seems impossible to do the enter/leave stuff correctly for the close button on maximized windows.  Leaving the titlebar contexts doesn't give us an Enter event to go along with it, so even if we check all motion events, the button will flash unpressed when leaving the topright contexts.
Dana Jansens danakj@orodu.net
commit

1ef0d8eb53fcae52afbae74310fbef0cac729951

parent

dd97c9beac2778cddb97603315b21778323a25c7

3 files changed, 42 insertions(+), 27 deletions(-)

jump to
M openbox/event.copenbox/event.c

@@ -872,7 +872,10 @@ con = frame_context(client, e->xbutton.window, px, py);

con = mouse_button_frame_context(con, e->xbutton.button, e->xbutton.state); - if (e->type == ButtonRelease && e->xbutton.button == pb) + /* button presses on CLIENT_CONTEXTs are not accompanied by a + release because they are Replayed to the client */ + if ((e->type == ButtonRelease || CLIENT_CONTEXT(con, client)) && + e->xbutton.button == pb) pb = 0, px = py = -1, pcon = OB_FRAME_CONTEXT_NONE; switch (con) {

@@ -968,41 +971,48 @@ case OB_FRAME_CONTEXT_TITLEBAR:

case OB_FRAME_CONTEXT_TLCORNER: case OB_FRAME_CONTEXT_TRCORNER: /* we've left the button area inside the titlebar */ - if (client->frame->max_hover || client->frame->desk_hover || - client->frame->shade_hover || client->frame->iconify_hover || - client->frame->close_hover) - { - client->frame->max_hover = FALSE; - client->frame->desk_hover = FALSE; - client->frame->shade_hover = FALSE; - client->frame->iconify_hover = FALSE; - client->frame->close_hover = FALSE; - frame_adjust_state(client->frame); + client->frame->max_hover = FALSE; + client->frame->desk_hover = FALSE; + client->frame->shade_hover = FALSE; + client->frame->iconify_hover = FALSE; + client->frame->close_hover = FALSE; + if (e->xcrossing.mode == NotifyGrab) { + client->frame->max_press = FALSE; + client->frame->desk_press = FALSE; + client->frame->shade_press = FALSE; + client->frame->iconify_press = FALSE; + client->frame->close_press = FALSE; } + frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_MAXIMIZE: client->frame->max_hover = FALSE; - client->frame->max_press = FALSE; + if (e->xcrossing.mode == NotifyGrab) + client->frame->max_press = FALSE; frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_ALLDESKTOPS: client->frame->desk_hover = FALSE; - client->frame->desk_press = FALSE; + if (e->xcrossing.mode == NotifyGrab) + client->frame->desk_press = FALSE; frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_SHADE: client->frame->shade_hover = FALSE; - client->frame->shade_press = FALSE; + if (e->xcrossing.mode == NotifyGrab) + client->frame->shade_press = FALSE; frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_ICONIFY: client->frame->iconify_hover = FALSE; - client->frame->iconify_press = FALSE; + if (e->xcrossing.mode == NotifyGrab) + client->frame->iconify_press = FALSE; frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_CLOSE: client->frame->close_hover = FALSE; - client->frame->close_press = FALSE; + if (e->xcrossing.mode == NotifyGrab) + client->frame->close_press = FALSE; frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_FRAME:

@@ -1041,27 +1051,32 @@ e->xcrossing.x, e->xcrossing.y);

switch (con) { case OB_FRAME_CONTEXT_MAXIMIZE: client->frame->max_hover = TRUE; - client->frame->max_press = (con == pcon); + if (e->xcrossing.mode == NotifyUngrab) + client->frame->max_press = (con == pcon); frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_ALLDESKTOPS: client->frame->desk_hover = TRUE; - client->frame->desk_press = (con == pcon); + if (e->xcrossing.mode == NotifyUngrab) + client->frame->desk_press = (con == pcon); frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_SHADE: client->frame->shade_hover = TRUE; - client->frame->shade_press = (con == pcon); + if (e->xcrossing.mode == NotifyUngrab) + client->frame->shade_press = (con == pcon); frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_ICONIFY: client->frame->iconify_hover = TRUE; - client->frame->iconify_press = (con == pcon); + if (e->xcrossing.mode == NotifyUngrab) + client->frame->iconify_press = (con == pcon); frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_CLOSE: client->frame->close_hover = TRUE; - client->frame->close_press = (con == pcon); + if (e->xcrossing.mode == NotifyUngrab) + client->frame->close_press = (con == pcon); frame_adjust_state(client->frame); break; case OB_FRAME_CONTEXT_FRAME:
M openbox/frame.hopenbox/frame.h

@@ -56,6 +56,12 @@ OB_FRAME_CONTEXT_MOVE_RESIZE,

OB_FRAME_NUM_CONTEXTS } ObFrameContext; +#define FRAME_CONTEXT(co, cl) ((cl && cl->type != OB_CLIENT_TYPE_DESKTOP) ? \ + co == OB_FRAME_CONTEXT_FRAME : FALSE) +#define CLIENT_CONTEXT(co, cl) ((cl && cl->type == OB_CLIENT_TYPE_DESKTOP) ? \ + co == OB_FRAME_CONTEXT_DESKTOP : \ + co == OB_FRAME_CONTEXT_CLIENT) + /*! The decorations the client window wants to be displayed on it */ typedef enum { OB_FRAME_DECOR_TITLEBAR = 1 << 0, /*!< Display a titlebar */
M openbox/mouse.copenbox/mouse.c

@@ -38,12 +38,6 @@ guint button;

GSList *actions[OB_NUM_MOUSE_ACTIONS]; /* lists of Action pointers */ } ObMouseBinding; -#define FRAME_CONTEXT(co, cl) ((cl && cl->type != OB_CLIENT_TYPE_DESKTOP) ? \ - co == OB_FRAME_CONTEXT_FRAME : FALSE) -#define CLIENT_CONTEXT(co, cl) ((cl && cl->type == OB_CLIENT_TYPE_DESKTOP) ? \ - co == OB_FRAME_CONTEXT_DESKTOP : \ - co == OB_FRAME_CONTEXT_CLIENT) - /* Array of GSList*s of ObMouseBinding*s. */ static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS]; /* TRUE when we have a grab on the pointer and need to replay the pointer event