mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
Fix trivial coding style breaches
This commit is contained in:
parent
8e1f115486
commit
5b34c81768
22 changed files with 151 additions and 91 deletions
|
|
@ -15,6 +15,6 @@
|
||||||
* For example, the xml structure <a><b><c></c></b></a> would return the
|
* For example, the xml structure <a><b><c></c></b></a> would return the
|
||||||
* name c.b.a
|
* name c.b.a
|
||||||
*/
|
*/
|
||||||
char *nodename(xmlNode *node, char *buf, int len);
|
char *nodename(xmlNode * node, char *buf, int len);
|
||||||
|
|
||||||
#endif /* __LABWC_NODENAME_H */
|
#endif /* __LABWC_NODENAME_H */
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
|
||||||
struct rcxml {
|
struct rcxml {
|
||||||
|
|
||||||
/* core */
|
/* core */
|
||||||
bool xdg_shell_server_side_deco;
|
bool xdg_shell_server_side_deco;
|
||||||
int gap;
|
int gap;
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ struct server {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LAB_NR_LAYERS (4)
|
#define LAB_NR_LAYERS (4)
|
||||||
|
|
||||||
struct output {
|
struct output {
|
||||||
struct wl_list link; /* server::outputs */
|
struct wl_list link; /* server::outputs */
|
||||||
struct server *server;
|
struct server *server;
|
||||||
|
|
@ -229,6 +230,7 @@ struct output {
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener frame;
|
struct wl_listener frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef LAB_NR_LAYERS
|
#undef LAB_NR_LAYERS
|
||||||
|
|
||||||
enum view_type {
|
enum view_type {
|
||||||
|
|
|
||||||
29
src/action.c
29
src/action.c
|
|
@ -54,11 +54,10 @@ const char *action_names[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static enum action_type
|
static enum action_type
|
||||||
action_type_from_str(const char *action_name)
|
action_type_from_str(const char *action_name)
|
||||||
{
|
{
|
||||||
for (size_t i = 1; action_names[i] != NULL; i++) {
|
for (size_t i = 1; action_names[i]; i++) {
|
||||||
if (!strcasecmp(action_name, action_names[i])) {
|
if (!strcasecmp(action_name, action_names[i])) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +143,10 @@ actions_run(struct view *activator, struct server *server,
|
||||||
wlr_log(WLR_DEBUG, "Handling action %s (%u) with arg %s",
|
wlr_log(WLR_DEBUG, "Handling action %s (%u) with arg %s",
|
||||||
action_names[action->type], action->type, action->arg);
|
action_names[action->type], action->type, action->arg);
|
||||||
|
|
||||||
/* Refetch view because it may have been changed due to the previous action */
|
/*
|
||||||
|
* Refetch view because it may have been changed due to the
|
||||||
|
* previous action
|
||||||
|
*/
|
||||||
view = activator_or_focused_view(activator, server);
|
view = activator_or_focused_view(activator, server);
|
||||||
|
|
||||||
switch (action->type) {
|
switch (action->type) {
|
||||||
|
|
@ -176,13 +178,13 @@ actions_run(struct view *activator, struct server *server,
|
||||||
view_snap_to_edge(view, action->arg);
|
view_snap_to_edge(view, action->arg);
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_NEXT_WINDOW:
|
case ACTION_TYPE_NEXT_WINDOW:
|
||||||
server->cycle_view =
|
server->cycle_view = desktop_cycle_view(server,
|
||||||
desktop_cycle_view(server, server->cycle_view, LAB_CYCLE_DIR_FORWARD);
|
server->cycle_view, LAB_CYCLE_DIR_FORWARD);
|
||||||
osd_update(server);
|
osd_update(server);
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_PREVIOUS_WINDOW:
|
case ACTION_TYPE_PREVIOUS_WINDOW:
|
||||||
server->cycle_view =
|
server->cycle_view = desktop_cycle_view(server,
|
||||||
desktop_cycle_view(server, server->cycle_view, LAB_CYCLE_DIR_BACKWARD);
|
server->cycle_view, LAB_CYCLE_DIR_BACKWARD);
|
||||||
osd_update(server);
|
osd_update(server);
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_RECONFIGURE:
|
case ACTION_TYPE_RECONFIGURE:
|
||||||
|
|
@ -232,11 +234,14 @@ actions_run(struct view *activator, struct server *server,
|
||||||
case ACTION_TYPE_RESIZE:
|
case ACTION_TYPE_RESIZE:
|
||||||
view = desktop_view_at_cursor(server);
|
view = desktop_view_at_cursor(server);
|
||||||
if (view) {
|
if (view) {
|
||||||
interactive_begin(view, LAB_INPUT_STATE_RESIZE, resize_edges);
|
interactive_begin(view, LAB_INPUT_STATE_RESIZE,
|
||||||
|
resize_edges);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_NONE:
|
case ACTION_TYPE_NONE:
|
||||||
wlr_log(WLR_ERROR, "Not executing unknown action with arg %s", action->arg);
|
wlr_log(WLR_ERROR,
|
||||||
|
"Not executing unknown action with arg %s",
|
||||||
|
action->arg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
|
|
@ -244,8 +249,10 @@ actions_run(struct view *activator, struct server *server,
|
||||||
* action_names and action_type being out of sync or by
|
* action_names and action_type being out of sync or by
|
||||||
* adding a new action without installing a handler here.
|
* adding a new action without installing a handler here.
|
||||||
*/
|
*/
|
||||||
wlr_log(WLR_ERROR, "Not executing invalid action (%u) with arg %s"
|
wlr_log(WLR_ERROR,
|
||||||
" This is a BUG. Please report.", action->type, action->arg);
|
"Not executing invalid action (%u) with arg %s"
|
||||||
|
" This is a BUG. Please report.",
|
||||||
|
action->type, action->arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "common/buf.h"
|
#include "common/buf.h"
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
strip_curly_braces(char *s)
|
strip_curly_braces(char *s)
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +44,7 @@ buf_expand_shell_variables(struct buf *s)
|
||||||
} else {
|
} else {
|
||||||
/* just add one character at a time */
|
/* just add one character at a time */
|
||||||
if (new.alloc <= new.len + 1) {
|
if (new.alloc <= new.len + 1) {
|
||||||
new.alloc = new.alloc * 3/2 + 16;
|
new.alloc = new.alloc * 3 / 2 + 16;
|
||||||
new.buf = realloc(new.buf, new.alloc);
|
new.buf = realloc(new.buf, new.alloc);
|
||||||
}
|
}
|
||||||
new.buf[new.len++] = s->buf[i];
|
new.buf[new.len++] = s->buf[i];
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,9 @@ find_dir(struct ctx *ctx)
|
||||||
if (!prefix) {
|
if (!prefix) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
gchar **prefixes;
|
gchar * *prefixes;
|
||||||
prefixes = g_strsplit(prefix, ":", -1);
|
prefixes = g_strsplit(prefix, ":", -1);
|
||||||
for (gchar **p = prefixes; *p; p++) {
|
for (gchar * *p = prefixes; *p; p++) {
|
||||||
ctx->build_path_fn(ctx, *p, d.path);
|
ctx->build_path_fn(ctx, *p, d.path);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
fprintf(stderr, "%s\n", ctx->buf);
|
fprintf(stderr, "%s\n", ctx->buf);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ keybind_create(const char *keybind)
|
||||||
k->modifiers |= modifier;
|
k->modifiers |= modifier;
|
||||||
} else {
|
} else {
|
||||||
xkb_keysym_t sym = xkb_keysym_to_lower(
|
xkb_keysym_t sym = xkb_keysym_to_lower(
|
||||||
xkb_keysym_from_name(symname, XKB_KEYSYM_CASE_INSENSITIVE));
|
xkb_keysym_from_name(symname,
|
||||||
|
XKB_KEYSYM_CASE_INSENSITIVE));
|
||||||
if (sym == XKB_KEY_NoSymbol) {
|
if (sym == XKB_KEY_NoSymbol) {
|
||||||
wlr_log(WLR_ERROR, "unknown keybind (%s)", symname);
|
wlr_log(WLR_ERROR, "unknown keybind (%s)", symname);
|
||||||
free(k);
|
free(k);
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,6 @@ get_accel_profile(const char *s)
|
||||||
static void
|
static void
|
||||||
fill_libinput_category(char *nodename, char *content)
|
fill_libinput_category(char *nodename, char *content)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!strcmp(nodename, "category.device.libinput")) {
|
if (!strcmp(nodename, "category.device.libinput")) {
|
||||||
current_libinput_category = libinput_category_create();
|
current_libinput_category = libinput_category_create();
|
||||||
}
|
}
|
||||||
|
|
@ -214,14 +213,17 @@ fill_libinput_category(char *nodename, char *content)
|
||||||
LIBINPUT_CONFIG_TAP_DISABLED;
|
LIBINPUT_CONFIG_TAP_DISABLED;
|
||||||
} else if (!strcasecmp(nodename, "tapButtonMap")) {
|
} else if (!strcasecmp(nodename, "tapButtonMap")) {
|
||||||
if (!strcmp(content, "lrm")) {
|
if (!strcmp(content, "lrm")) {
|
||||||
current_libinput_category->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
current_libinput_category->tap_button_map =
|
||||||
|
LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||||
} else if (!strcmp(content, "lmr")) {
|
} else if (!strcmp(content, "lmr")) {
|
||||||
current_libinput_category->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
|
current_libinput_category->tap_button_map =
|
||||||
|
LIBINPUT_CONFIG_TAP_MAP_LMR;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "invalid tapButtonMap");
|
wlr_log(WLR_ERROR, "invalid tapButtonMap");
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(nodename, "accelProfile")) {
|
} else if (!strcasecmp(nodename, "accelProfile")) {
|
||||||
current_libinput_category->accel_profile = get_accel_profile(content);
|
current_libinput_category->accel_profile =
|
||||||
|
get_accel_profile(content);
|
||||||
} else if (!strcasecmp(nodename, "middleEmulation")) {
|
} else if (!strcasecmp(nodename, "middleEmulation")) {
|
||||||
current_libinput_category->middle_emu = get_bool(content) ?
|
current_libinput_category->middle_emu = get_bool(content) ?
|
||||||
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
|
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
|
||||||
|
|
@ -690,7 +692,6 @@ no_config:
|
||||||
void
|
void
|
||||||
rcxml_finish(void)
|
rcxml_finish(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
zfree(rc.font_name_activewindow);
|
zfree(rc.font_name_activewindow);
|
||||||
zfree(rc.font_name_menuitem);
|
zfree(rc.font_name_menuitem);
|
||||||
zfree(rc.font_name_osd);
|
zfree(rc.font_name_osd);
|
||||||
|
|
|
||||||
41
src/cursor.c
41
src/cursor.c
|
|
@ -189,8 +189,8 @@ input_inhibit_blocks_surface(struct seat *seat, struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
struct wl_client *inhibiting_client =
|
struct wl_client *inhibiting_client =
|
||||||
seat->active_client_while_inhibited;
|
seat->active_client_while_inhibited;
|
||||||
return (inhibiting_client != NULL) &&
|
return inhibiting_client
|
||||||
inhibiting_client != wl_resource_get_client(resource);
|
&& inhibiting_client != wl_resource_get_client(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -387,7 +387,7 @@ destroy_constraint(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
wl_list_remove(&constraint->destroy.link);
|
wl_list_remove(&constraint->destroy.link);
|
||||||
if (seat->current_constraint == wlr_constraint) {
|
if (seat->current_constraint == wlr_constraint) {
|
||||||
if (seat->constraint_commit.link.next != NULL) {
|
if (seat->constraint_commit.link.next) {
|
||||||
wl_list_remove(&seat->constraint_commit.link);
|
wl_list_remove(&seat->constraint_commit.link);
|
||||||
}
|
}
|
||||||
wl_list_init(&seat->constraint_commit.link);
|
wl_list_init(&seat->constraint_commit.link);
|
||||||
|
|
@ -433,7 +433,7 @@ constrain_cursor(struct server *server, struct wlr_pointer_constraint_v1
|
||||||
|
|
||||||
seat->current_constraint = constraint;
|
seat->current_constraint = constraint;
|
||||||
|
|
||||||
if (constraint == NULL) {
|
if (!constraint) {
|
||||||
wl_list_init(&seat->constraint_commit.link);
|
wl_list_init(&seat->constraint_commit.link);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -554,9 +554,13 @@ handle_release_mousebinding(struct view *view, struct server *server,
|
||||||
continue;
|
continue;
|
||||||
case MOUSE_ACTION_DRAG:
|
case MOUSE_ACTION_DRAG:
|
||||||
if (mousebind->pressed_in_context) {
|
if (mousebind->pressed_in_context) {
|
||||||
/* Swallow the release event as well as the press one */
|
/*
|
||||||
|
* Swallow the release event as well as
|
||||||
|
* the press one
|
||||||
|
*/
|
||||||
activated_any = true;
|
activated_any = true;
|
||||||
activated_any_frame |= mousebind->context == LAB_SSD_FRAME;
|
activated_any_frame |=
|
||||||
|
mousebind->context == LAB_SSD_FRAME;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
|
|
@ -620,7 +624,7 @@ handle_press_mousebinding(struct view *view, struct server *server,
|
||||||
&& mousebind->button == button
|
&& mousebind->button == button
|
||||||
&& modifiers == mousebind->modifiers) {
|
&& modifiers == mousebind->modifiers) {
|
||||||
switch (mousebind->mouse_event) {
|
switch (mousebind->mouse_event) {
|
||||||
case MOUSE_ACTION_DRAG: /* FALLTHROUGH */
|
case MOUSE_ACTION_DRAG: /* fallthrough */
|
||||||
case MOUSE_ACTION_CLICK:
|
case MOUSE_ACTION_CLICK:
|
||||||
/*
|
/*
|
||||||
* DRAG and CLICK actions will be processed on
|
* DRAG and CLICK actions will be processed on
|
||||||
|
|
@ -628,9 +632,13 @@ handle_press_mousebinding(struct view *view, struct server *server,
|
||||||
* counted as a DOUBLECLICK.
|
* counted as a DOUBLECLICK.
|
||||||
*/
|
*/
|
||||||
if (!double_click) {
|
if (!double_click) {
|
||||||
/* Swallow the press event as well as the release one */
|
/*
|
||||||
|
* Swallow the press event as well as
|
||||||
|
* the release one
|
||||||
|
*/
|
||||||
activated_any = true;
|
activated_any = true;
|
||||||
activated_any_frame |= mousebind->context == LAB_SSD_FRAME;
|
activated_any_frame |=
|
||||||
|
mousebind->context == LAB_SSD_FRAME;
|
||||||
mousebind->pressed_in_context = true;
|
mousebind->pressed_in_context = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -719,7 +727,10 @@ cursor_button(struct wl_listener *listener, void *data)
|
||||||
server->grabbed_view = NULL;
|
server->grabbed_view = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Focus surface under cursor and force updating the cursor icon */
|
/*
|
||||||
|
* Focus surface under cursor and force updating the
|
||||||
|
* cursor icon
|
||||||
|
*/
|
||||||
cursor_rebase(&server->seat, event->time_msec, true);
|
cursor_rebase(&server->seat, event->time_msec, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -733,10 +744,16 @@ cursor_button(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
if (server->input_mode == LAB_INPUT_STATE_MENU) {
|
if (server->input_mode == LAB_INPUT_STATE_MENU) {
|
||||||
if (view_area != LAB_SSD_MENU) {
|
if (view_area != LAB_SSD_MENU) {
|
||||||
/* We close the menu on release so we don't leak a stray release */
|
/*
|
||||||
|
* We close the menu on release so we don't leak a stray
|
||||||
|
* release
|
||||||
|
*/
|
||||||
close_menu = true;
|
close_menu = true;
|
||||||
} else if (menu_call_actions(node)) {
|
} else if (menu_call_actions(node)) {
|
||||||
/* Action was successfull, may fail if item just opens a submenu */
|
/*
|
||||||
|
* Action was successfull, may fail if item just opens a
|
||||||
|
* submenu
|
||||||
|
*/
|
||||||
close_menu = true;
|
close_menu = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,14 @@ interactive_end(struct view *view)
|
||||||
} else if (cursor_y <= area->y + snap_range) {
|
} else if (cursor_y <= area->y + snap_range) {
|
||||||
if (rc.snap_top_maximize) {
|
if (rc.snap_top_maximize) {
|
||||||
view_maximize(view, true);
|
view_maximize(view, true);
|
||||||
/* When unmaximizing later on restore original position */
|
/*
|
||||||
view->unmaximized_geometry.x = view->server->grab_box.x;
|
* When unmaximizing later on restore
|
||||||
view->unmaximized_geometry.y = view->server->grab_box.y;
|
* original position
|
||||||
|
*/
|
||||||
|
view->unmaximized_geometry.x =
|
||||||
|
view->server->grab_box.x;
|
||||||
|
view->unmaximized_geometry.y =
|
||||||
|
view->server->grab_box.y;
|
||||||
} else {
|
} else {
|
||||||
view_snap_to_edge(view, "up");
|
view_snap_to_edge(view, "up");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ any_modifiers_pressed(struct wlr_keyboard *keyboard)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -42,7 +41,7 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
||||||
if (server->cycle_view) {
|
if (server->cycle_view) {
|
||||||
struct wlr_keyboard_key_event *event = data;
|
struct wlr_keyboard_key_event *event = data;
|
||||||
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||||
if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED
|
||||||
&& !any_modifiers_pressed(keyboard)) {
|
&& !any_modifiers_pressed(keyboard)) {
|
||||||
/* end cycle */
|
/* end cycle */
|
||||||
desktop_focus_and_activate_view(&server->seat,
|
desktop_focus_and_activate_view(&server->seat,
|
||||||
|
|
@ -130,7 +129,10 @@ handle_compositor_keybindings(struct wl_listener *listener,
|
||||||
unsigned int vt = syms[i] - XKB_KEY_XF86Switch_VT_1 + 1;
|
unsigned int vt = syms[i] - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||||
if (vt >= 1 && vt <= 12) {
|
if (vt >= 1 && vt <= 12) {
|
||||||
change_vt(server, vt);
|
change_vt(server, vt);
|
||||||
/* don't send any key events to clients when changing tty */
|
/*
|
||||||
|
* Don't send any key events to clients when
|
||||||
|
* changing tty
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,9 +157,11 @@ handle_compositor_keybindings(struct wl_listener *listener,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ignore) {
|
if (!ignore) {
|
||||||
server->cycle_view =
|
enum lab_cycle_dir dir = backwards
|
||||||
desktop_cycle_view(server, server->cycle_view,
|
? LAB_CYCLE_DIR_BACKWARD
|
||||||
backwards ? LAB_CYCLE_DIR_BACKWARD : LAB_CYCLE_DIR_FORWARD);
|
: LAB_CYCLE_DIR_FORWARD;
|
||||||
|
server->cycle_view = desktop_cycle_view(server,
|
||||||
|
server->cycle_view, dir);
|
||||||
osd_update(server);
|
osd_update(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -507,7 +507,8 @@ close_all_submenus(struct menu *menu)
|
||||||
struct menuitem *item;
|
struct menuitem *item;
|
||||||
wl_list_for_each (item, &menu->menuitems, link) {
|
wl_list_for_each (item, &menu->menuitems, link) {
|
||||||
if (item->submenu) {
|
if (item->submenu) {
|
||||||
wlr_scene_node_set_enabled(&item->submenu->scene_tree->node, false);
|
wlr_scene_node_set_enabled(
|
||||||
|
&item->submenu->scene_tree->node, false);
|
||||||
close_all_submenus(item->submenu);
|
close_all_submenus(item->submenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +556,6 @@ menu_process_cursor_motion(struct wlr_scene_node *node)
|
||||||
item->parent->selection.menu = item->submenu;
|
item->parent->selection.menu = item->submenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
menu_call_actions(struct wlr_scene_node *node)
|
menu_call_actions(struct wlr_scene_node *node)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ static const char *
|
||||||
get_formatted_app_id(struct view *view)
|
get_formatted_app_id(struct view *view)
|
||||||
{
|
{
|
||||||
char *s = (char *)view_get_string_prop(view, "app_id");
|
char *s = (char *)view_get_string_prop(view, "app_id");
|
||||||
if (s == NULL) {
|
if (!s) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* remove the first two nodes of 'org.' strings */
|
/* remove the first two nodes of 'org.' strings */
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ new_output_notify(struct wl_listener *listener, void *data)
|
||||||
if (wlr_output->non_desktop) {
|
if (wlr_output->non_desktop) {
|
||||||
wlr_log(WLR_DEBUG, "Not configuring non-desktop output");
|
wlr_log(WLR_DEBUG, "Not configuring non-desktop output");
|
||||||
if (server->drm_lease_manager) {
|
if (server->drm_lease_manager) {
|
||||||
wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager,
|
wlr_drm_lease_v1_manager_offer_output(
|
||||||
wlr_output);
|
server->drm_lease_manager, wlr_output);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -344,7 +344,7 @@ handle_output_layout_change(struct wl_listener *listener, void *data)
|
||||||
struct server *server =
|
struct server *server =
|
||||||
wl_container_of(listener, server, output_layout_change);
|
wl_container_of(listener, server, output_layout_change);
|
||||||
|
|
||||||
bool done_changing = server->pending_output_config == NULL;
|
bool done_changing = !server->pending_output_config;
|
||||||
if (done_changing) {
|
if (done_changing) {
|
||||||
struct wlr_output_configuration_v1 *config =
|
struct wlr_output_configuration_v1 *config =
|
||||||
create_output_config(server);
|
create_output_config(server);
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,10 @@ resistance_move_apply(struct view *view, double *x, double *y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset the flags */
|
/* reset the flags */
|
||||||
flags.left = flags.top = flags.right = flags.bottom = 0;
|
flags.left = 0;
|
||||||
|
flags.top = 0;
|
||||||
|
flags.right = 0;
|
||||||
|
flags.bottom = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +129,6 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_list_for_each(output, &server->outputs, link) {
|
wl_list_for_each(output, &server->outputs, link) {
|
||||||
|
|
||||||
mgeom = output_usable_area_in_layout_coords(output);
|
mgeom = output_usable_area_in_layout_coords(output);
|
||||||
|
|
||||||
if (!wlr_box_intersection(&intersection, &vgeom, &mgeom)
|
if (!wlr_box_intersection(&intersection, &vgeom, &mgeom)
|
||||||
|
|
@ -171,6 +173,9 @@ resistance_resize_apply(struct view *view, struct wlr_box *new_view_geo)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset the flags */
|
/* reset the flags */
|
||||||
flags.left = flags.top = flags.right = flags.bottom = 0;
|
flags.left = 0;
|
||||||
|
flags.top = 0;
|
||||||
|
flags.right = 0;
|
||||||
|
flags.bottom = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,8 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_INFO, "tap configured");
|
wlr_log(WLR_INFO, "tap configured");
|
||||||
libinput_device_config_tap_set_enabled(libinput_dev, dc->tap);
|
libinput_device_config_tap_set_enabled(libinput_dev, dc->tap);
|
||||||
libinput_device_config_tap_set_button_map(libinput_dev, dc->tap_button_map);
|
libinput_device_config_tap_set_button_map(libinput_dev,
|
||||||
|
dc->tap_button_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libinput_device_config_scroll_has_natural_scroll(libinput_dev) <= 0
|
if (libinput_device_config_scroll_has_natural_scroll(libinput_dev) <= 0
|
||||||
|
|
@ -128,7 +129,7 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||||
static struct wlr_output *
|
static struct wlr_output *
|
||||||
output_by_name(struct server *server, const char *name)
|
output_by_name(struct server *server, const char *name)
|
||||||
{
|
{
|
||||||
assert(name != NULL);
|
assert(name);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &server->outputs, link) {
|
wl_list_for_each(output, &server->outputs, link) {
|
||||||
if (!strcasecmp(output->wlr_output->name, name)) {
|
if (!strcasecmp(output->wlr_output->name, name)) {
|
||||||
|
|
@ -152,7 +153,7 @@ new_pointer(struct seat *seat, struct input *input)
|
||||||
wlr_log(WLR_INFO, "map pointer to output %s\n",
|
wlr_log(WLR_INFO, "map pointer to output %s\n",
|
||||||
dev->pointer->output_name);
|
dev->pointer->output_name);
|
||||||
struct wlr_output *output = NULL;
|
struct wlr_output *output = NULL;
|
||||||
if (dev->pointer->output_name != NULL) {
|
if (dev->pointer->output_name) {
|
||||||
output = output_by_name(seat->server, dev->pointer->output_name);
|
output = output_by_name(seat->server, dev->pointer->output_name);
|
||||||
}
|
}
|
||||||
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
||||||
|
|
@ -183,7 +184,7 @@ new_touch(struct seat *seat, struct input *input)
|
||||||
wlr_log(WLR_INFO, "map touch to output %s\n",
|
wlr_log(WLR_INFO, "map touch to output %s\n",
|
||||||
dev->pointer->output_name);
|
dev->pointer->output_name);
|
||||||
struct wlr_output *output = NULL;
|
struct wlr_output *output = NULL;
|
||||||
if (dev->pointer->output_name != NULL) {
|
if (dev->pointer->output_name) {
|
||||||
output = output_by_name(seat->server, dev->pointer->output_name);
|
output = output_by_name(seat->server, dev->pointer->output_name);
|
||||||
}
|
}
|
||||||
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
||||||
|
|
|
||||||
19
src/server.c
19
src/server.c
|
|
@ -103,8 +103,7 @@ seat_inhibit_input(struct seat *seat, struct wl_client *active_client)
|
||||||
|
|
||||||
struct wlr_seat_client *previous_ptr_client =
|
struct wlr_seat_client *previous_ptr_client =
|
||||||
seat->seat->pointer_state.focused_client;
|
seat->seat->pointer_state.focused_client;
|
||||||
if (previous_ptr_client &&
|
if (previous_ptr_client && previous_ptr_client->client != active_client) {
|
||||||
(previous_ptr_client->client != active_client)) {
|
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -124,8 +123,6 @@ seat_disinhibit_input(struct seat *seat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_input_inhibit(struct wl_listener *listener, void *data)
|
handle_input_inhibit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -147,9 +144,12 @@ handle_input_disinhibit(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_drm_lease_request(struct wl_listener *listener, void *data) {
|
handle_drm_lease_request(struct wl_listener *listener, void *data)
|
||||||
/* We only offer non-desktop outputs, but in the future we might want to do
|
{
|
||||||
* more logic here. */
|
/*
|
||||||
|
* We only offer non-desktop outputs, but in the future we might want to do
|
||||||
|
* more logic here.
|
||||||
|
*/
|
||||||
|
|
||||||
struct wlr_drm_lease_request_v1 *req = data;
|
struct wlr_drm_lease_request_v1 *req = data;
|
||||||
struct wlr_drm_lease_v1 *lease = wlr_drm_lease_request_v1_grant(req);
|
struct wlr_drm_lease_v1 *lease = wlr_drm_lease_request_v1_grant(req);
|
||||||
|
|
@ -352,8 +352,8 @@ server_init(struct server *server)
|
||||||
server->foreign_toplevel_manager =
|
server->foreign_toplevel_manager =
|
||||||
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
|
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
|
||||||
|
|
||||||
server->drm_lease_manager=
|
server->drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
||||||
wlr_drm_lease_v1_manager_create(server->wl_display, server->backend);
|
server->wl_display, server->backend);
|
||||||
if (server->drm_lease_manager) {
|
if (server->drm_lease_manager) {
|
||||||
server->drm_lease_request.notify = handle_drm_lease_request;
|
server->drm_lease_request.notify = handle_drm_lease_request;
|
||||||
wl_signal_add(&server->drm_lease_manager->events.request,
|
wl_signal_add(&server->drm_lease_manager->events.request,
|
||||||
|
|
@ -447,7 +447,6 @@ server_start(struct server *server)
|
||||||
void
|
void
|
||||||
server_finish(struct server *server)
|
server_finish(struct server *server)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* TODO: clean up various scene_tree nodes */
|
/* TODO: clean up various scene_tree nodes */
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
wlr_xwayland_destroy(server->xwayland);
|
wlr_xwayland_destroy(server->xwayland);
|
||||||
|
|
|
||||||
|
|
@ -63,20 +63,25 @@ ssd_border_update(struct view *view)
|
||||||
rect = lab_wlr_scene_get_rect(part->node);
|
rect = lab_wlr_scene_get_rect(part->node);
|
||||||
switch (part->type) {
|
switch (part->type) {
|
||||||
case LAB_SSD_PART_LEFT:
|
case LAB_SSD_PART_LEFT:
|
||||||
wlr_scene_rect_set_size(rect, theme->border_width, height);
|
wlr_scene_rect_set_size(rect,
|
||||||
|
theme->border_width, height);
|
||||||
continue;
|
continue;
|
||||||
case LAB_SSD_PART_RIGHT:
|
case LAB_SSD_PART_RIGHT:
|
||||||
wlr_scene_rect_set_size(rect, theme->border_width, height);
|
wlr_scene_rect_set_size(rect,
|
||||||
wlr_scene_node_set_position(
|
theme->border_width, height);
|
||||||
part->node, theme->border_width + width, 0);
|
wlr_scene_node_set_position(part->node,
|
||||||
|
theme->border_width + width, 0);
|
||||||
continue;
|
continue;
|
||||||
case LAB_SSD_PART_BOTTOM:
|
case LAB_SSD_PART_BOTTOM:
|
||||||
wlr_scene_rect_set_size(rect, full_width, theme->border_width);
|
wlr_scene_rect_set_size(rect,
|
||||||
wlr_scene_node_set_position(part->node, 0, height);
|
full_width, theme->border_width);
|
||||||
|
wlr_scene_node_set_position(part->node,
|
||||||
|
0, height);
|
||||||
continue;
|
continue;
|
||||||
case LAB_SSD_PART_TOP:
|
case LAB_SSD_PART_TOP:
|
||||||
wlr_scene_rect_set_size(rect,
|
wlr_scene_rect_set_size(rect,
|
||||||
width - 2 * BUTTON_WIDTH, theme->border_width);
|
width - 2 * BUTTON_WIDTH,
|
||||||
|
theme->border_width);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,8 @@ ssd_extents_update(struct view *view)
|
||||||
if (part_box.width != result_box.width
|
if (part_box.width != result_box.width
|
||||||
|| part_box.height != result_box.height) {
|
|| part_box.height != result_box.height) {
|
||||||
/* Partly visible */
|
/* Partly visible */
|
||||||
wlr_scene_rect_set_size(rect, result_box.width, result_box.height);
|
wlr_scene_rect_set_size(rect, result_box.width,
|
||||||
|
result_box.height);
|
||||||
wlr_scene_node_set_position(part->node,
|
wlr_scene_node_set_position(part->node,
|
||||||
target->x + (result_box.x - part_box.x),
|
target->x + (result_box.x - part_box.x),
|
||||||
target->y + (result_box.y - part_box.y));
|
target->y + (result_box.y - part_box.y));
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,8 @@ ssd_titlebar_update(struct view *view)
|
||||||
wl_list_for_each(part, &subtree->parts, link) {
|
wl_list_for_each(part, &subtree->parts, link) {
|
||||||
switch (part->type) {
|
switch (part->type) {
|
||||||
case LAB_SSD_PART_TITLEBAR:
|
case LAB_SSD_PART_TITLEBAR:
|
||||||
wlr_scene_rect_set_size(lab_wlr_scene_get_rect(part->node),
|
wlr_scene_rect_set_size(
|
||||||
|
lab_wlr_scene_get_rect(part->node),
|
||||||
width - BUTTON_WIDTH * BUTTON_COUNT,
|
width - BUTTON_WIDTH * BUTTON_COUNT,
|
||||||
theme->title_height);
|
theme->title_height);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -102,7 +103,8 @@ ssd_titlebar_update(struct view *view)
|
||||||
case LAB_SSD_BUTTON_CLOSE:
|
case LAB_SSD_BUTTON_CLOSE:
|
||||||
if (is_direct_child(part->node, subtree)) {
|
if (is_direct_child(part->node, subtree)) {
|
||||||
wlr_scene_node_set_position(part->node,
|
wlr_scene_node_set_position(part->node,
|
||||||
width - BUTTON_WIDTH * 1, -theme->border_width);
|
width - BUTTON_WIDTH * 1,
|
||||||
|
-theme->border_width);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
23
src/view.c
23
src/view.c
|
|
@ -194,10 +194,12 @@ view_apply_maximized_geometry(struct view *view)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlr_box box = output_usable_area_in_layout_coords(output);
|
struct wlr_box box = output_usable_area_in_layout_coords(output);
|
||||||
if (box.height == output->wlr_output->height && output->wlr_output->scale != 1) {
|
if (box.height == output->wlr_output->height
|
||||||
|
&& output->wlr_output->scale != 1) {
|
||||||
box.height /= output->wlr_output->scale;
|
box.height /= output->wlr_output->scale;
|
||||||
}
|
}
|
||||||
if (box.width == output->wlr_output->width && output->wlr_output->scale != 1) {
|
if (box.width == output->wlr_output->width
|
||||||
|
&& output->wlr_output->scale != 1) {
|
||||||
box.width /= output->wlr_output->scale;
|
box.width /= output->wlr_output->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,7 +217,8 @@ static void
|
||||||
view_apply_unmaximized_geometry(struct view *view)
|
view_apply_unmaximized_geometry(struct view *view)
|
||||||
{
|
{
|
||||||
struct wlr_output_layout *layout = view->server->output_layout;
|
struct wlr_output_layout *layout = view->server->output_layout;
|
||||||
if (wlr_output_layout_intersects(layout, NULL, &view->unmaximized_geometry)) {
|
if (wlr_output_layout_intersects(layout, NULL,
|
||||||
|
&view->unmaximized_geometry)) {
|
||||||
/* restore to original geometry */
|
/* restore to original geometry */
|
||||||
view_move_resize(view, view->unmaximized_geometry);
|
view_move_resize(view, view->unmaximized_geometry);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -300,7 +303,7 @@ void
|
||||||
view_set_fullscreen(struct view *view, bool fullscreen,
|
view_set_fullscreen(struct view *view, bool fullscreen,
|
||||||
struct wlr_output *wlr_output)
|
struct wlr_output *wlr_output)
|
||||||
{
|
{
|
||||||
if (fullscreen == (view->fullscreen != NULL)) {
|
if (fullscreen != !view->fullscreen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (view->impl->set_fullscreen) {
|
if (view->impl->set_fullscreen) {
|
||||||
|
|
@ -426,10 +429,12 @@ view_move_to_edge(struct view *view, const char *direction)
|
||||||
}
|
}
|
||||||
struct border border = view_border(view);
|
struct border border = view_border(view);
|
||||||
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
||||||
if (usable.height == output->wlr_output->height && output->wlr_output->scale != 1) {
|
if (usable.height == output->wlr_output->height
|
||||||
|
&& output->wlr_output->scale != 1) {
|
||||||
usable.height /= output->wlr_output->scale;
|
usable.height /= output->wlr_output->scale;
|
||||||
}
|
}
|
||||||
if (usable.width == output->wlr_output->width && output->wlr_output->scale != 1) {
|
if (usable.width == output->wlr_output->width
|
||||||
|
&& output->wlr_output->scale != 1) {
|
||||||
usable.width /= output->wlr_output->scale;
|
usable.width /= output->wlr_output->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -503,10 +508,12 @@ view_get_edge_snap_box(struct view *view, struct output *output,
|
||||||
{
|
{
|
||||||
struct border border = view_border(view);
|
struct border border = view_border(view);
|
||||||
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
||||||
if (usable.height == output->wlr_output->height && output->wlr_output->scale != 1) {
|
if (usable.height == output->wlr_output->height
|
||||||
|
&& output->wlr_output->scale != 1) {
|
||||||
usable.height /= output->wlr_output->scale;
|
usable.height /= output->wlr_output->scale;
|
||||||
}
|
}
|
||||||
if (usable.width == output->wlr_output->width && output->wlr_output->scale != 1) {
|
if (usable.width == output->wlr_output->width
|
||||||
|
&& output->wlr_output->scale != 1) {
|
||||||
usable.width /= output->wlr_output->scale;
|
usable.width /= output->wlr_output->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
src/xdg.c
17
src/xdg.c
|
|
@ -24,7 +24,8 @@ has_ssd(struct view *view)
|
||||||
* geometry.{x,y} seems to be greater than zero. We filter on that
|
* geometry.{x,y} seems to be greater than zero. We filter on that
|
||||||
* on the assumption that this will remain true.
|
* on the assumption that this will remain true.
|
||||||
*/
|
*/
|
||||||
if (view->xdg_surface->current.geometry.x || view->xdg_surface->current.geometry.y) {
|
struct wlr_xdg_surface_state *current = &view->xdg_surface->current;
|
||||||
|
if (current->geometry.x || current->geometry.y) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -42,8 +43,10 @@ handle_commit(struct wl_listener *listener, void *data)
|
||||||
view->h = size.height;
|
view->h = size.height;
|
||||||
|
|
||||||
/* padding changes with maximize/unmaximize */
|
/* padding changes with maximize/unmaximize */
|
||||||
view->padding.top = view->padding.bottom = size.y;
|
view->padding.top = size.y;
|
||||||
view->padding.left = view->padding.right = size.x;
|
view->padding.bottom = size.y;
|
||||||
|
view->padding.left = size.x;
|
||||||
|
view->padding.right = size.x;
|
||||||
|
|
||||||
uint32_t serial = view->pending_move_resize.configure_serial;
|
uint32_t serial = view->pending_move_resize.configure_serial;
|
||||||
if (serial > 0 && serial >= view->xdg_surface->current.configure_serial) {
|
if (serial > 0 && serial >= view->xdg_surface->current.configure_serial) {
|
||||||
|
|
@ -213,8 +216,10 @@ update_padding(struct view *view)
|
||||||
{
|
{
|
||||||
struct wlr_box padding;
|
struct wlr_box padding;
|
||||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &padding);
|
wlr_xdg_surface_get_geometry(view->xdg_surface, &padding);
|
||||||
view->padding.top = view->padding.bottom = padding.y;
|
view->padding.top = padding.y;
|
||||||
view->padding.left = view->padding.right = padding.x;
|
view->padding.bottom = padding.y;
|
||||||
|
view->padding.left = padding.x;
|
||||||
|
view->padding.right = padding.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -241,7 +246,7 @@ xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
||||||
static bool
|
static bool
|
||||||
istopmost(struct view *view)
|
istopmost(struct view *view)
|
||||||
{
|
{
|
||||||
return view->xdg_surface->toplevel->parent == NULL;
|
return !view->xdg_surface->toplevel->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct view *
|
static struct view *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue