<!--
Multiple <mousebind> can exist within one <context>
Multiple <actions> can exist within one <mousebind>
- The following openbox-actions are not supported: "Unshade" and "Drag"
+ Currently, the only openbox-action not supported is "Unshade"
-->
<mouse>
<doubleClickTime>500</doubleClickTime>
<context name="Frame">
- <mousebind button="A-Left" action="Press">
+ <mousebind button="A-Left" action="Drag">
<action name="Focus"/>
<action name="Raise"/>
<action name="Move"/>
</mousebind>
- <mousebind button="A-Right" action="Press">
+ <mousebind button="A-Right" action="Drag">
<action name="Focus"/>
<action name="Raise"/>
<action name="Resize"/>
</context>
<context name="Top">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="Left">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="Right">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="Bottom">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="TRCorner">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="BRCorner">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="TLCorner">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="BLCorner">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Resize"/>
</mousebind>
</context>
<context name="TitleBar">
- <mousebind button="Left" action="Press">
+ <mousebind button="Left" action="Drag">
<action name="Focus"/>
<action name="Raise"/>
<action name="Move"/>
static struct {
const char *context, *button, *event, *action, *command;
} mouse_combos[] = {
- { "Left", "Left", "Press", "Resize", NULL},
- { "Top", "Left", "Press", "Resize", NULL},
- { "Bottom", "Left", "Press", "Resize", NULL},
- { "Right", "Left", "Press", "Resize", NULL},
- { "TLCorner", "Left", "Press", "Resize", NULL},
- { "TRCorner", "Left", "Press", "Resize", NULL},
- { "BRCorner", "Left", "Press", "Resize", NULL},
- { "BLCorner", "Left", "Press", "Resize", NULL},
- { "Frame", "A-Left", "Press", "Focus", NULL},
- { "Frame", "A-Left", "Press", "Raise", NULL},
- { "Frame", "A-Left", "Press", "Move", NULL},
- { "Frame", "A-Right", "Press", "Focus", NULL},
- { "Frame", "A-Right", "Press", "Raise", NULL},
- { "Frame", "A-Right", "Press", "Resize", NULL},
- { "Titlebar", "Left", "Press", "Focus", NULL},
- { "Titlebar", "Left", "Press", "Raise", NULL},
- { "TitleBar", "Left", "Press", "Move", NULL },
+ { "Left", "Left", "Drag", "Resize", NULL},
+ { "Top", "Left", "Drag", "Resize", NULL},
+ { "Bottom", "Left", "Drag", "Resize", NULL},
+ { "Right", "Left", "Drag", "Resize", NULL},
+ { "TLCorner", "Left", "Drag", "Resize", NULL},
+ { "TRCorner", "Left", "Drag", "Resize", NULL},
+ { "BRCorner", "Left", "Drag", "Resize", NULL},
+ { "BLCorner", "Left", "Drag", "Resize", NULL},
+ { "Frame", "A-Left", "Drag", "Focus", NULL},
+ { "Frame", "A-Left", "Drag", "Raise", NULL},
+ { "Frame", "A-Left", "Drag", "Move", NULL},
+ { "Frame", "A-Right", "Drag", "Focus", NULL},
+ { "Frame", "A-Right", "Drag", "Raise", NULL},
+ { "Frame", "A-Right", "Drag", "Resize", NULL},
+ { "Titlebar", "Left", "Drag", "Focus", NULL},
+ { "Titlebar", "Left", "Drag", "Raise", NULL},
+ { "TitleBar", "Left", "Drag", "Move", NULL },
{ "TitleBar", "Left", "DoubleClick", "ToggleMaximize", NULL },
{ "Close", "Left", "Click", "Close", NULL },
{ "Iconify", "Left", "Click", "Iconify", NULL},
server->seat.cursor->x, server->seat.cursor->y, &surface,
&sx, &sy, &view_area);
+ /* resize handles */
+ uint32_t resize_edges = ssd_resize_edges(view_area);
+
/* Set cursor */
if (!view) {
/* root, etc. */
cursor_set(&server->seat, XCURSOR_DEFAULT);
} else {
- /* resize handles */
- uint32_t resize_edges = ssd_resize_edges(view_area);
if (resize_edges) {
cursor_name_set_by_server = true;
cursor_set(&server->seat,
}
}
+ struct mousebind *mousebind;
+ wl_list_for_each(mousebind, &rc.mousebinds, link) {
+ if (mousebind->mouse_event == MOUSE_ACTION_DRAG
+ && mousebind->pressed_in_context) {
+ /* Find closest resize edges in case action is Resize */
+ if (view) {
+ resize_edges |= server->seat.cursor->x
+ < view->x + view->w / 2 ? WLR_EDGE_LEFT
+ : WLR_EDGE_RIGHT;
+ resize_edges |= server->seat.cursor->y
+ < view->y + view->h / 2 ? WLR_EDGE_TOP
+ : WLR_EDGE_BOTTOM;
+ }
+
+ mousebind->pressed_in_context = false;
+ action(NULL, server, &mousebind->actions, resize_edges);
+ }
+ }
+
/* Required for iconify/maximize/close button mouse-over deco */
damage_all_outputs(server);
activated_any_frame |= mousebind->context == LAB_SSD_FRAME;
action(view, server, &mousebind->actions, resize_edges);
}
+ /* For the drag events */
+ mousebind->pressed_in_context = false;
}
return activated_any && activated_any_frame;
}
&& mousebind->button == button
&& modifiers == mousebind->modifiers) {
switch (mousebind->mouse_event) {
+ case MOUSE_ACTION_DRAG: /* FALLTHROUGH */
case MOUSE_ACTION_CLICK:
mousebind->pressed_in_context = true;
continue;