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.
@@ -111,7 +111,7 @@ <mouse>
<dragThreshold>3</dragThreshold> <doubleClickTime>200</doubleClickTime> - <context name="frame"> + <context name="Frame"> <mousebind button="A-Left" action="Drag"> <action name="Move"/> </mousebind>@@ -143,7 +143,7 @@ <mousebind button="C-A-Down" action="Click">
<action name="SendToDesktopPrevious"/> </mousebind> </context> - <context name="titlebar"> + <context name="Titlebar"> <mousebind button="Left" action="Drag"> <action name="Move"/> </mousebind>@@ -169,7 +169,7 @@ <mousebind button="Right" action="Press">
<action name="ShowMenu"><menu>client-menu</menu></action> </mousebind> </context> - <context name="handle"> + <context name="Handle"> <mousebind button="Left" action="Drag"> <action name="Move"/> </mousebind>@@ -183,7 +183,7 @@ <mousebind button="Middle" action="Press">
<action name="Lower"/> </mousebind> </context> - <context name="blcorner"> + <context name="BLCorner"> <mousebind button="Left" action="Drag"> <action name="Resize"/> </mousebind>@@ -191,7 +191,7 @@ <mousebind button="Left" action="Press">
<action name="Focus"/> </mousebind> </context> - <context name="brcorner"> + <context name="BRCorner"> <mousebind button="Left" action="Drag"> <action name="Resize"/> </mousebind>@@ -199,7 +199,7 @@ <mousebind button="Left" action="Press">
<action name="Focus"/> </mousebind> </context> - <context name="tlcorner"> + <context name="TLCorner"> <mousebind button="Left" action="Drag"> <action name="Resize"/> </mousebind>@@ -207,7 +207,7 @@ <mousebind button="Left" action="Press">
<action name="Focus"/> </mousebind> </context> - <context name="trcorner"> + <context name="TRCorner"> <mousebind button="Left" action="Drag"> <action name="Resize"/> </mousebind>@@ -215,7 +215,7 @@ <mousebind button="Left" action="Press">
<action name="Focus"/> </mousebind> </context> - <context name="client"> + <context name="Client"> <mousebind button="Left" action="Press"> <action name="Focus"/> <action name="Raise"/>@@ -227,7 +227,7 @@ <mousebind button="Right" action="Press">
<action name="Focus"/> </mousebind> </context> - <context name="icon"> + <context name="Icon"> <mousebind button="Left" action="Press"> <action name="Focus"/> </mousebind>@@ -241,7 +241,7 @@ <mousebind button="Left" action="DoubleClick">
<action name="Close"/> </mousebind> </context> - <context name="alldesktops"> + <context name="AllDesktops"> <mousebind button="Left" action="Press"> <action name="Focus"/> </mousebind>@@ -249,7 +249,7 @@ <mousebind button="Left" action="Click">
<action name="ToggleOmnipresent"/> </mousebind> </context> - <context name="shade"> + <context name="Shade"> <mousebind button="Left" action="Press"> <action name="Focus"/> </mousebind>@@ -257,7 +257,7 @@ <mousebind button="Left" action="Click">
<action name="ToggleShade"/> </mousebind> </context> - <context name="iconify"> + <context name="Iconify"> <mousebind button="Left" action="Press"> <action name="Focus"/> </mousebind>@@ -265,7 +265,7 @@ <mousebind button="Left" action="Click">
<action name="Iconify"/> </mousebind> </context> - <context name="maximize"> + <context name="Maximize"> <mousebind button="Left" action="Press"> <action name="Focus"/> </mousebind>@@ -285,7 +285,7 @@ <mousebind button="Right" action="Click">
<action name="ToggleMaximizeHorz"/> </mousebind> </context> - <context name="close"> + <context name="Close"> <mousebind button="Left" action="Press"> <action name="Focus"/> </mousebind>@@ -293,17 +293,17 @@ <mousebind button="Left" action="Click">
<action name="Close"/> </mousebind> </context> - <context name="desktop"> - <mousebind button="Up" action="Click"> + <context name="Desktop"> + <mousebind button="Up" action="Press"> <action name="DesktopNext"/> </mousebind> - <mousebind button="Down" action="Click"> + <mousebind button="Down" action="Press"> <action name="DesktopPrevious"/> </mousebind> - <mousebind button="A-Up" action="Click"> + <mousebind button="A-Up" action="Press"> <action name="DesktopNext"/> </mousebind> - <mousebind button="A-Down" action="Click"> + <mousebind button="A-Down" action="Press"> <action name="DesktopPrevious"/> </mousebind> <mousebind button="Left" action="Press">@@ -314,6 +314,20 @@ <action name="ShowMenu"><menu>client-list-menu</menu></action>
</mousebind> <mousebind button="Right" action="Press"> <action name="ShowMenu"><menu>root-menu</menu></action> + </mousebind> + </context> + <context name="MoveResize"> + <mousebind button="Up" action="Press"> + <action name="DesktopNext"/> + </mousebind> + <mousebind button="Down" action="Press"> + <action name="DesktopPrevious"/> + </mousebind> + <mousebind button="A-Up" action="Press"> + <action name="DesktopNext"/> + </mousebind> + <mousebind button="A-Down" action="Press"> + <action name="DesktopPrevious"/> </mousebind> </context> </mouse>
@@ -5,6 +5,7 @@ #include "extensions.h"
#include "config.h" #include "framerender.h" #include "mainloop.h" +#include "moveresize.h" #include "render/theme.h" #define PLATE_EVENTMASK (SubstructureRedirectMask | ButtonPressMask)@@ -629,42 +630,47 @@ }
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; } 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;
@@ -25,6 +25,9 @@ OB_FRAME_CONTEXT_SHADE,
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;
@@ -46,6 +46,7 @@ case OB_FRAME_CONTEXT_CLIENT:
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 @@ g_warning("invalid button '%s'", buttonstr);
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;