From 88b839834242d237eaf98fcc0aac94e21a767ace Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 17 Sep 2003 06:44:04 +0000 Subject: [PATCH] add the MoveResize context, which is used while doing a move/resize on a window. Actions bound in this context can be executed with the mouse during a move/resize on a window. --- data/rc.xml | 52 +++++++++++++++++++++++++++++++------------------ openbox/frame.c | 36 ++++++++++++++++++++-------------- openbox/frame.h | 3 +++ openbox/mouse.c | 4 +--- 4 files changed, 58 insertions(+), 37 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index 2d98fc2e..5000c59d 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -111,7 +111,7 @@ 3 200 - + @@ -143,7 +143,7 @@ - + @@ -169,7 +169,7 @@ client-menu - + @@ -183,7 +183,7 @@ - + @@ -191,7 +191,7 @@ - + @@ -199,7 +199,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -227,7 +227,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -249,7 +249,7 @@ - + @@ -257,7 +257,7 @@ - + @@ -265,7 +265,7 @@ - + @@ -285,7 +285,7 @@ - + @@ -293,17 +293,17 @@ - - + + - + - + - + @@ -316,6 +316,20 @@ root-menu + + + + + + + + + + + + + + diff --git a/openbox/frame.c b/openbox/frame.c index 327507f2..8d69c395 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -5,6 +5,7 @@ #include "config.h" #include "framerender.h" #include "mainloop.h" +#include "moveresize.h" #include "render/theme.h" #define PLATE_EVENTMASK (SubstructureRedirectMask | ButtonPressMask) @@ -629,36 +630,38 @@ static void layout_title(ObFrame *self) ObFrameContext frame_context_from_string(char *name) { - if (!g_ascii_strcasecmp("desktop", name)) + if (!g_ascii_strcasecmp("Desktop", name)) return OB_FRAME_CONTEXT_DESKTOP; - else if (!g_ascii_strcasecmp("client", name)) + else if (!g_ascii_strcasecmp("Client", name)) return OB_FRAME_CONTEXT_CLIENT; - else if (!g_ascii_strcasecmp("titlebar", name)) + else if (!g_ascii_strcasecmp("Titlebar", name)) return OB_FRAME_CONTEXT_TITLEBAR; - else if (!g_ascii_strcasecmp("handle", name)) + else if (!g_ascii_strcasecmp("Handle", name)) return OB_FRAME_CONTEXT_HANDLE; - else if (!g_ascii_strcasecmp("frame", name)) + else if (!g_ascii_strcasecmp("Frame", name)) return OB_FRAME_CONTEXT_FRAME; - else if (!g_ascii_strcasecmp("tlcorner", name)) + else if (!g_ascii_strcasecmp("TLCorner", name)) return OB_FRAME_CONTEXT_TLCORNER; - else if (!g_ascii_strcasecmp("trcorner", name)) + else if (!g_ascii_strcasecmp("TRCorner", name)) return OB_FRAME_CONTEXT_TRCORNER; - else if (!g_ascii_strcasecmp("blcorner", name)) + else if (!g_ascii_strcasecmp("BLCorner", name)) return OB_FRAME_CONTEXT_BLCORNER; - else if (!g_ascii_strcasecmp("brcorner", name)) + else if (!g_ascii_strcasecmp("BRCorner", name)) return OB_FRAME_CONTEXT_BRCORNER; - else if (!g_ascii_strcasecmp("maximize", name)) + else if (!g_ascii_strcasecmp("Maximize", name)) return OB_FRAME_CONTEXT_MAXIMIZE; - else if (!g_ascii_strcasecmp("alldesktops", name)) + else if (!g_ascii_strcasecmp("AllDesktops", name)) return OB_FRAME_CONTEXT_ALLDESKTOPS; - else if (!g_ascii_strcasecmp("shade", name)) + else if (!g_ascii_strcasecmp("Shade", name)) return OB_FRAME_CONTEXT_SHADE; - else if (!g_ascii_strcasecmp("iconify", name)) + else if (!g_ascii_strcasecmp("Iconify", name)) return OB_FRAME_CONTEXT_ICONIFY; - else if (!g_ascii_strcasecmp("icon", name)) + else if (!g_ascii_strcasecmp("Icon", name)) return OB_FRAME_CONTEXT_ICON; - else if (!g_ascii_strcasecmp("close", name)) + else if (!g_ascii_strcasecmp("Close", name)) return OB_FRAME_CONTEXT_CLOSE; + else if (!g_ascii_strcasecmp("MoveResize", name)) + return OB_FRAME_CONTEXT_MOVE_RESIZE; return OB_FRAME_CONTEXT_NONE; } @@ -666,6 +669,9 @@ ObFrameContext frame_context(ObClient *client, Window win) { ObFrame *self; + if (moveresize_in_progress) + return OB_FRAME_CONTEXT_MOVE_RESIZE; + if (win == RootWindow(ob_display, ob_screen)) return OB_FRAME_CONTEXT_DESKTOP; if (client == NULL) return OB_FRAME_CONTEXT_NONE; diff --git a/openbox/frame.h b/openbox/frame.h index 78206c33..9d1cb10d 100644 --- a/openbox/frame.h +++ b/openbox/frame.h @@ -25,6 +25,9 @@ typedef enum { OB_FRAME_CONTEXT_ICONIFY, OB_FRAME_CONTEXT_ICON, OB_FRAME_CONTEXT_CLOSE, + /*! This is a special context, which occurs while dragging a window in + a move/resize */ + OB_FRAME_CONTEXT_MOVE_RESIZE, OB_FRAME_NUM_CONTEXTS } ObFrameContext; diff --git a/openbox/mouse.c b/openbox/mouse.c index 26aa8596..27bd6584 100644 --- a/openbox/mouse.c +++ b/openbox/mouse.c @@ -46,6 +46,7 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context, case OB_FRAME_CONTEXT_TITLEBAR: case OB_FRAME_CONTEXT_HANDLE: case OB_FRAME_CONTEXT_FRAME: + case OB_FRAME_CONTEXT_MOVE_RESIZE: break; case OB_FRAME_CONTEXT_BLCORNER: case OB_FRAME_CONTEXT_BRCORNER: @@ -289,14 +290,11 @@ gboolean mouse_bind(char *buttonstr, char *contextstr, ObMouseAction mact, return FALSE; } - contextstr = g_ascii_strdown(contextstr, -1); context = frame_context_from_string(contextstr); if (!context) { g_warning("invalid context '%s'", contextstr); - g_free(contextstr); return FALSE; } - g_free(contextstr); for (it = bound_contexts[context]; it != NULL; it = it->next){ b = it->data; -- 2.39.2