mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
commit
1483158b26
5 changed files with 47 additions and 32 deletions
|
|
@ -186,8 +186,10 @@ The rest of this man page describes configuration options.
|
||||||
*<action>* can exist within one *<mousebind>*
|
*<action>* can exist within one *<mousebind>*
|
||||||
|
|
||||||
Define a mouse binding. Supported context-names include:
|
Define a mouse binding. Supported context-names include:
|
||||||
- TitleBar: The area where the title of the window is shown.
|
- TitleBar: The decoration on top of the window, where the window
|
||||||
- Title: The title of the window itself.
|
buttons and the window title are shown.
|
||||||
|
- Title: The area of the titlebar (including blank space) between
|
||||||
|
the window buttons, where the window title is displayed.
|
||||||
- WindowMenu: The button on the left.
|
- WindowMenu: The button on the left.
|
||||||
- Iconify: The button that looks like an underline.
|
- Iconify: The button that looks like an underline.
|
||||||
- Maximize: The button that looks like a box.
|
- Maximize: The button that looks like a box.
|
||||||
|
|
|
||||||
|
|
@ -215,9 +215,6 @@
|
||||||
<action name="Focus"/>
|
<action name="Focus"/>
|
||||||
<action name="Raise"/>
|
<action name="Raise"/>
|
||||||
</mousebind>
|
</mousebind>
|
||||||
<mousebind button="Left" action="Drag">
|
|
||||||
<action name="Move"/>
|
|
||||||
</mousebind>
|
|
||||||
<mousebind button="Right" action="Click">
|
<mousebind button="Right" action="Click">
|
||||||
<action name="Focus" />
|
<action name="Focus" />
|
||||||
<action name="Raise" />
|
<action name="Raise" />
|
||||||
|
|
@ -225,9 +222,13 @@
|
||||||
<menu>client-menu</menu>
|
<menu>client-menu</menu>
|
||||||
</action>
|
</action>
|
||||||
</mousebind>
|
</mousebind>
|
||||||
|
</context>
|
||||||
|
|
||||||
|
<context name="Title">
|
||||||
|
<mousebind button="Left" action="Drag">
|
||||||
|
<action name="Move"/>
|
||||||
|
</mousebind>
|
||||||
<mousebind button="Left" action="DoubleClick">
|
<mousebind button="Left" action="DoubleClick">
|
||||||
<action name="Focus"/>
|
|
||||||
<action name="Raise"/>
|
|
||||||
<action name="ToggleMaximize"/>
|
<action name="ToggleMaximize"/>
|
||||||
</mousebind>
|
</mousebind>
|
||||||
</context>
|
</context>
|
||||||
|
|
|
||||||
|
|
@ -570,8 +570,8 @@ static struct mouse_combos {
|
||||||
{ "Frame", "A-Right", "Drag", "Resize", NULL},
|
{ "Frame", "A-Right", "Drag", "Resize", NULL},
|
||||||
{ "Titlebar", "Left", "Press", "Focus", NULL},
|
{ "Titlebar", "Left", "Press", "Focus", NULL},
|
||||||
{ "Titlebar", "Left", "Press", "Raise", NULL},
|
{ "Titlebar", "Left", "Press", "Raise", NULL},
|
||||||
{ "TitleBar", "Left", "Drag", "Move", NULL },
|
{ "Title", "Left", "Drag", "Move", NULL },
|
||||||
{ "TitleBar", "Left", "DoubleClick", "ToggleMaximize", NULL },
|
{ "Title", "Left", "DoubleClick", "ToggleMaximize", NULL },
|
||||||
{ "TitleBar", "Right", "Click", "Focus", NULL},
|
{ "TitleBar", "Right", "Click", "Focus", NULL},
|
||||||
{ "TitleBar", "Right", "Click", "Raise", NULL},
|
{ "TitleBar", "Right", "Click", "Raise", NULL},
|
||||||
{ "TitleBar", "Right", "Click", "ShowMenu", "client-menu"},
|
{ "TitleBar", "Right", "Click", "ShowMenu", "client-menu"},
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,26 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
|
||||||
/* We don't allow resizing while in maximized or fullscreen state */
|
/* We don't allow resizing while in maximized or fullscreen state */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function sets up an interactive move or resize operation, where
|
||||||
|
* the compositor stops propagating pointer events to clients and
|
||||||
|
* instead consumes them itself, to move or resize windows.
|
||||||
|
*/
|
||||||
|
struct seat *seat = &view->server->seat;
|
||||||
|
struct server *server = view->server;
|
||||||
|
server->grabbed_view = view;
|
||||||
|
server->input_mode = mode;
|
||||||
|
|
||||||
|
/* Remember view and cursor positions at start of move/resize */
|
||||||
|
server->grab_x = seat->cursor->x;
|
||||||
|
server->grab_y = seat->cursor->y;
|
||||||
|
server->grab_box.x = view->x;
|
||||||
|
server->grab_box.y = view->y;
|
||||||
|
server->grab_box.width = view->w;
|
||||||
|
server->grab_box.height = view->h;
|
||||||
|
server->resize_edges = edges;
|
||||||
|
|
||||||
if (view->maximized || view->tiled) {
|
if (view->maximized || view->tiled) {
|
||||||
if (mode == LAB_INPUT_STATE_MOVE) {
|
if (mode == LAB_INPUT_STATE_MOVE) {
|
||||||
/* Exit maximized or tiled mode */
|
/* Exit maximized or tiled mode */
|
||||||
|
|
@ -52,35 +72,16 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
|
||||||
* the current values in server->grab_box. We pretend the
|
* the current values in server->grab_box. We pretend the
|
||||||
* configure already happened by setting them manually.
|
* configure already happened by setting them manually.
|
||||||
*/
|
*/
|
||||||
view->x = new_x;
|
server->grab_box.x = new_x;
|
||||||
view->y = new_y;
|
server->grab_box.y = new_y;
|
||||||
view->w = view->natural_geometry.width;
|
server->grab_box.width = view->natural_geometry.width;
|
||||||
view->h = view->natural_geometry.height;
|
server->grab_box.height = view->natural_geometry.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Moving or resizing always resets tiled state */
|
/* Moving or resizing always resets tiled state */
|
||||||
view->tiled = 0;
|
view->tiled = 0;
|
||||||
|
|
||||||
/*
|
|
||||||
* This function sets up an interactive move or resize operation, where
|
|
||||||
* the compositor stops propagating pointer events to clients and
|
|
||||||
* instead consumes them itself, to move or resize windows.
|
|
||||||
*/
|
|
||||||
struct seat *seat = &view->server->seat;
|
|
||||||
struct server *server = view->server;
|
|
||||||
server->grabbed_view = view;
|
|
||||||
server->input_mode = mode;
|
|
||||||
|
|
||||||
/* Remember view and cursor positions at start of move/resize */
|
|
||||||
server->grab_x = seat->cursor->x;
|
|
||||||
server->grab_y = seat->cursor->y;
|
|
||||||
struct wlr_box box = {
|
|
||||||
.x = view->x, .y = view->y, .width = view->w, .height = view->h
|
|
||||||
};
|
|
||||||
memcpy(&server->grab_box, &box, sizeof(struct wlr_box));
|
|
||||||
server->resize_edges = edges;
|
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case LAB_INPUT_STATE_MOVE:
|
case LAB_INPUT_STATE_MOVE:
|
||||||
cursor_set(&server->seat, "grab");
|
cursor_set(&server->seat, "grab");
|
||||||
|
|
|
||||||
|
|
@ -68,12 +68,16 @@ ssd_get_part_type(struct view *view, struct wlr_scene_node *node)
|
||||||
struct wl_list *part_list = NULL;
|
struct wl_list *part_list = NULL;
|
||||||
struct wlr_scene_tree *grandparent =
|
struct wlr_scene_tree *grandparent =
|
||||||
node->parent ? node->parent->node.parent : NULL;
|
node->parent ? node->parent->node.parent : NULL;
|
||||||
|
struct wlr_scene_tree *greatgrandparent =
|
||||||
|
grandparent ? grandparent->node.parent : NULL;
|
||||||
|
|
||||||
/* active titlebar */
|
/* active titlebar */
|
||||||
if (node->parent == view->ssd.titlebar.active.tree) {
|
if (node->parent == view->ssd.titlebar.active.tree) {
|
||||||
part_list = &view->ssd.titlebar.active.parts;
|
part_list = &view->ssd.titlebar.active.parts;
|
||||||
} else if (grandparent == view->ssd.titlebar.active.tree) {
|
} else if (grandparent == view->ssd.titlebar.active.tree) {
|
||||||
part_list = &view->ssd.titlebar.active.parts;
|
part_list = &view->ssd.titlebar.active.parts;
|
||||||
|
} else if (greatgrandparent == view->ssd.titlebar.active.tree) {
|
||||||
|
part_list = &view->ssd.titlebar.active.parts;
|
||||||
|
|
||||||
/* extents */
|
/* extents */
|
||||||
} else if (node->parent == view->ssd.extents.tree) {
|
} else if (node->parent == view->ssd.extents.tree) {
|
||||||
|
|
@ -88,6 +92,8 @@ ssd_get_part_type(struct view *view, struct wlr_scene_node *node)
|
||||||
part_list = &view->ssd.titlebar.inactive.parts;
|
part_list = &view->ssd.titlebar.inactive.parts;
|
||||||
} else if (grandparent == view->ssd.titlebar.inactive.tree) {
|
} else if (grandparent == view->ssd.titlebar.inactive.tree) {
|
||||||
part_list = &view->ssd.titlebar.inactive.parts;
|
part_list = &view->ssd.titlebar.inactive.parts;
|
||||||
|
} else if (greatgrandparent == view->ssd.titlebar.inactive.tree) {
|
||||||
|
part_list = &view->ssd.titlebar.inactive.parts;
|
||||||
|
|
||||||
/* inactive border */
|
/* inactive border */
|
||||||
} else if (node->parent == view->ssd.border.inactive.tree) {
|
} else if (node->parent == view->ssd.border.inactive.tree) {
|
||||||
|
|
@ -243,6 +249,11 @@ ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate)
|
||||||
return candidate >= LAB_SSD_BUTTON_CLOSE
|
return candidate >= LAB_SSD_BUTTON_CLOSE
|
||||||
&& candidate <= LAB_SSD_PART_TITLE;
|
&& candidate <= LAB_SSD_PART_TITLE;
|
||||||
}
|
}
|
||||||
|
if (whole == LAB_SSD_PART_TITLE) {
|
||||||
|
/* "Title" includes blank areas of "Titlebar" as well */
|
||||||
|
return candidate >= LAB_SSD_PART_TITLEBAR
|
||||||
|
&& candidate <= LAB_SSD_PART_TITLE;
|
||||||
|
}
|
||||||
if (whole == LAB_SSD_FRAME) {
|
if (whole == LAB_SSD_FRAME) {
|
||||||
return candidate >= LAB_SSD_BUTTON_CLOSE
|
return candidate >= LAB_SSD_BUTTON_CLOSE
|
||||||
&& candidate <= LAB_SSD_CLIENT;
|
&& candidate <= LAB_SSD_CLIENT;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue