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
|
|
@ -11,7 +11,6 @@
|
|||
#include "theme.h"
|
||||
|
||||
struct rcxml {
|
||||
|
||||
/* core */
|
||||
bool xdg_shell_server_side_deco;
|
||||
int gap;
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ struct server {
|
|||
};
|
||||
|
||||
#define LAB_NR_LAYERS (4)
|
||||
|
||||
struct output {
|
||||
struct wl_list link; /* server::outputs */
|
||||
struct server *server;
|
||||
|
|
@ -229,6 +230,7 @@ struct output {
|
|||
struct wl_listener destroy;
|
||||
struct wl_listener frame;
|
||||
};
|
||||
|
||||
#undef LAB_NR_LAYERS
|
||||
|
||||
enum view_type {
|
||||
|
|
|
|||
29
src/action.c
29
src/action.c
|
|
@ -54,11 +54,10 @@ const char *action_names[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
|
||||
static enum action_type
|
||||
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])) {
|
||||
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",
|
||||
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);
|
||||
|
||||
switch (action->type) {
|
||||
|
|
@ -176,13 +178,13 @@ actions_run(struct view *activator, struct server *server,
|
|||
view_snap_to_edge(view, action->arg);
|
||||
break;
|
||||
case ACTION_TYPE_NEXT_WINDOW:
|
||||
server->cycle_view =
|
||||
desktop_cycle_view(server, server->cycle_view, LAB_CYCLE_DIR_FORWARD);
|
||||
server->cycle_view = desktop_cycle_view(server,
|
||||
server->cycle_view, LAB_CYCLE_DIR_FORWARD);
|
||||
osd_update(server);
|
||||
break;
|
||||
case ACTION_TYPE_PREVIOUS_WINDOW:
|
||||
server->cycle_view =
|
||||
desktop_cycle_view(server, server->cycle_view, LAB_CYCLE_DIR_BACKWARD);
|
||||
server->cycle_view = desktop_cycle_view(server,
|
||||
server->cycle_view, LAB_CYCLE_DIR_BACKWARD);
|
||||
osd_update(server);
|
||||
break;
|
||||
case ACTION_TYPE_RECONFIGURE:
|
||||
|
|
@ -232,11 +234,14 @@ actions_run(struct view *activator, struct server *server,
|
|||
case ACTION_TYPE_RESIZE:
|
||||
view = desktop_view_at_cursor(server);
|
||||
if (view) {
|
||||
interactive_begin(view, LAB_INPUT_STATE_RESIZE, resize_edges);
|
||||
interactive_begin(view, LAB_INPUT_STATE_RESIZE,
|
||||
resize_edges);
|
||||
}
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
/*
|
||||
|
|
@ -244,8 +249,10 @@ actions_run(struct view *activator, struct server *server,
|
|||
* action_names and action_type being out of sync or by
|
||||
* adding a new action without installing a handler here.
|
||||
*/
|
||||
wlr_log(WLR_ERROR, "Not executing invalid action (%u) with arg %s"
|
||||
" This is a BUG. Please report.", action->type, action->arg);
|
||||
wlr_log(WLR_ERROR,
|
||||
"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 "common/buf.h"
|
||||
|
||||
|
||||
static void
|
||||
strip_curly_braces(char *s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ keybind_create(const char *keybind)
|
|||
k->modifiers |= modifier;
|
||||
} else {
|
||||
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) {
|
||||
wlr_log(WLR_ERROR, "unknown keybind (%s)", symname);
|
||||
free(k);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ get_accel_profile(const char *s)
|
|||
static void
|
||||
fill_libinput_category(char *nodename, char *content)
|
||||
{
|
||||
|
||||
if (!strcmp(nodename, "category.device.libinput")) {
|
||||
current_libinput_category = libinput_category_create();
|
||||
}
|
||||
|
|
@ -214,14 +213,17 @@ fill_libinput_category(char *nodename, char *content)
|
|||
LIBINPUT_CONFIG_TAP_DISABLED;
|
||||
} else if (!strcasecmp(nodename, "tapButtonMap")) {
|
||||
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")) {
|
||||
current_libinput_category->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
|
||||
current_libinput_category->tap_button_map =
|
||||
LIBINPUT_CONFIG_TAP_MAP_LMR;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "invalid tapButtonMap");
|
||||
}
|
||||
} 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")) {
|
||||
current_libinput_category->middle_emu = get_bool(content) ?
|
||||
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
|
||||
|
|
@ -690,7 +692,6 @@ no_config:
|
|||
void
|
||||
rcxml_finish(void)
|
||||
{
|
||||
|
||||
zfree(rc.font_name_activewindow);
|
||||
zfree(rc.font_name_menuitem);
|
||||
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 =
|
||||
seat->active_client_while_inhibited;
|
||||
return (inhibiting_client != NULL) &&
|
||||
inhibiting_client != wl_resource_get_client(resource);
|
||||
return inhibiting_client
|
||||
&& inhibiting_client != wl_resource_get_client(resource);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -387,7 +387,7 @@ destroy_constraint(struct wl_listener *listener, void *data)
|
|||
|
||||
wl_list_remove(&constraint->destroy.link);
|
||||
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_init(&seat->constraint_commit.link);
|
||||
|
|
@ -433,7 +433,7 @@ constrain_cursor(struct server *server, struct wlr_pointer_constraint_v1
|
|||
|
||||
seat->current_constraint = constraint;
|
||||
|
||||
if (constraint == NULL) {
|
||||
if (!constraint) {
|
||||
wl_list_init(&seat->constraint_commit.link);
|
||||
return;
|
||||
}
|
||||
|
|
@ -554,9 +554,13 @@ handle_release_mousebinding(struct view *view, struct server *server,
|
|||
continue;
|
||||
case MOUSE_ACTION_DRAG:
|
||||
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_frame |= mousebind->context == LAB_SSD_FRAME;
|
||||
activated_any_frame |=
|
||||
mousebind->context == LAB_SSD_FRAME;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
|
|
@ -620,7 +624,7 @@ handle_press_mousebinding(struct view *view, struct server *server,
|
|||
&& mousebind->button == button
|
||||
&& modifiers == mousebind->modifiers) {
|
||||
switch (mousebind->mouse_event) {
|
||||
case MOUSE_ACTION_DRAG: /* FALLTHROUGH */
|
||||
case MOUSE_ACTION_DRAG: /* fallthrough */
|
||||
case MOUSE_ACTION_CLICK:
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
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_frame |= mousebind->context == LAB_SSD_FRAME;
|
||||
activated_any_frame |=
|
||||
mousebind->context == LAB_SSD_FRAME;
|
||||
mousebind->pressed_in_context = true;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -719,7 +727,10 @@ cursor_button(struct wl_listener *listener, void *data)
|
|||
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);
|
||||
return;
|
||||
}
|
||||
|
|
@ -733,10 +744,16 @@ cursor_button(struct wl_listener *listener, void *data)
|
|||
|
||||
if (server->input_mode == LAB_INPUT_STATE_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;
|
||||
} 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;
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -97,9 +97,14 @@ interactive_end(struct view *view)
|
|||
} else if (cursor_y <= area->y + snap_range) {
|
||||
if (rc.snap_top_maximize) {
|
||||
view_maximize(view, true);
|
||||
/* When unmaximizing later on restore original position */
|
||||
view->unmaximized_geometry.x = view->server->grab_box.x;
|
||||
view->unmaximized_geometry.y = view->server->grab_box.y;
|
||||
/*
|
||||
* When unmaximizing later on restore
|
||||
* original position
|
||||
*/
|
||||
view->unmaximized_geometry.x =
|
||||
view->server->grab_box.x;
|
||||
view->unmaximized_geometry.y =
|
||||
view->server->grab_box.y;
|
||||
} else {
|
||||
view_snap_to_edge(view, "up");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ any_modifiers_pressed(struct wlr_keyboard *keyboard)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
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) {
|
||||
struct wlr_keyboard_key_event *event = data;
|
||||
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)) {
|
||||
/* end cycle */
|
||||
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;
|
||||
if (vt >= 1 && vt <= 12) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -155,9 +157,11 @@ handle_compositor_keybindings(struct wl_listener *listener,
|
|||
}
|
||||
|
||||
if (!ignore) {
|
||||
server->cycle_view =
|
||||
desktop_cycle_view(server, server->cycle_view,
|
||||
backwards ? LAB_CYCLE_DIR_BACKWARD : LAB_CYCLE_DIR_FORWARD);
|
||||
enum lab_cycle_dir dir = backwards
|
||||
? LAB_CYCLE_DIR_BACKWARD
|
||||
: LAB_CYCLE_DIR_FORWARD;
|
||||
server->cycle_view = desktop_cycle_view(server,
|
||||
server->cycle_view, dir);
|
||||
osd_update(server);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -507,7 +507,8 @@ close_all_submenus(struct menu *menu)
|
|||
struct menuitem *item;
|
||||
wl_list_for_each (item, &menu->menuitems, link) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -555,7 +556,6 @@ menu_process_cursor_motion(struct wlr_scene_node *node)
|
|||
item->parent->selection.menu = item->submenu;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
menu_call_actions(struct wlr_scene_node *node)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static const char *
|
|||
get_formatted_app_id(struct view *view)
|
||||
{
|
||||
char *s = (char *)view_get_string_prop(view, "app_id");
|
||||
if (s == NULL) {
|
||||
if (!s) {
|
||||
return NULL;
|
||||
}
|
||||
/* 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) {
|
||||
wlr_log(WLR_DEBUG, "Not configuring non-desktop output");
|
||||
if (server->drm_lease_manager) {
|
||||
wlr_drm_lease_v1_manager_offer_output(server->drm_lease_manager,
|
||||
wlr_output);
|
||||
wlr_drm_lease_v1_manager_offer_output(
|
||||
server->drm_lease_manager, wlr_output);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -344,7 +344,7 @@ handle_output_layout_change(struct wl_listener *listener, void *data)
|
|||
struct server *server =
|
||||
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) {
|
||||
struct wlr_output_configuration_v1 *config =
|
||||
create_output_config(server);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,10 @@ resistance_move_apply(struct view *view, double *x, double *y)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
wl_list_for_each(output, &server->outputs, link) {
|
||||
|
||||
mgeom = output_usable_area_in_layout_coords(output);
|
||||
|
||||
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 */
|
||||
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 {
|
||||
wlr_log(WLR_INFO, "tap configured");
|
||||
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
|
||||
|
|
@ -128,7 +129,7 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
|||
static struct wlr_output *
|
||||
output_by_name(struct server *server, const char *name)
|
||||
{
|
||||
assert(name != NULL);
|
||||
assert(name);
|
||||
struct output *output;
|
||||
wl_list_for_each(output, &server->outputs, link) {
|
||||
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",
|
||||
dev->pointer->output_name);
|
||||
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);
|
||||
}
|
||||
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",
|
||||
dev->pointer->output_name);
|
||||
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);
|
||||
}
|
||||
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 =
|
||||
seat->seat->pointer_state.focused_client;
|
||||
if (previous_ptr_client &&
|
||||
(previous_ptr_client->client != active_client)) {
|
||||
if (previous_ptr_client && previous_ptr_client->client != active_client) {
|
||||
wlr_seat_pointer_clear_focus(seat->seat);
|
||||
}
|
||||
}
|
||||
|
|
@ -124,8 +123,6 @@ seat_disinhibit_input(struct seat *seat)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
handle_input_inhibit(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -147,9 +144,12 @@ handle_input_disinhibit(struct wl_listener *listener, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
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. */
|
||||
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.
|
||||
*/
|
||||
|
||||
struct wlr_drm_lease_request_v1 *req = data;
|
||||
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 =
|
||||
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
|
||||
|
||||
server->drm_lease_manager=
|
||||
wlr_drm_lease_v1_manager_create(server->wl_display, server->backend);
|
||||
server->drm_lease_manager = wlr_drm_lease_v1_manager_create(
|
||||
server->wl_display, server->backend);
|
||||
if (server->drm_lease_manager) {
|
||||
server->drm_lease_request.notify = handle_drm_lease_request;
|
||||
wl_signal_add(&server->drm_lease_manager->events.request,
|
||||
|
|
@ -447,7 +447,6 @@ server_start(struct server *server)
|
|||
void
|
||||
server_finish(struct server *server)
|
||||
{
|
||||
|
||||
/* TODO: clean up various scene_tree nodes */
|
||||
#if HAVE_XWAYLAND
|
||||
wlr_xwayland_destroy(server->xwayland);
|
||||
|
|
|
|||
|
|
@ -63,20 +63,25 @@ ssd_border_update(struct view *view)
|
|||
rect = lab_wlr_scene_get_rect(part->node);
|
||||
switch (part->type) {
|
||||
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;
|
||||
case LAB_SSD_PART_RIGHT:
|
||||
wlr_scene_rect_set_size(rect, theme->border_width, height);
|
||||
wlr_scene_node_set_position(
|
||||
part->node, theme->border_width + width, 0);
|
||||
wlr_scene_rect_set_size(rect,
|
||||
theme->border_width, height);
|
||||
wlr_scene_node_set_position(part->node,
|
||||
theme->border_width + width, 0);
|
||||
continue;
|
||||
case LAB_SSD_PART_BOTTOM:
|
||||
wlr_scene_rect_set_size(rect, full_width, theme->border_width);
|
||||
wlr_scene_node_set_position(part->node, 0, height);
|
||||
wlr_scene_rect_set_size(rect,
|
||||
full_width, theme->border_width);
|
||||
wlr_scene_node_set_position(part->node,
|
||||
0, height);
|
||||
continue;
|
||||
case LAB_SSD_PART_TOP:
|
||||
wlr_scene_rect_set_size(rect,
|
||||
width - 2 * BUTTON_WIDTH, theme->border_width);
|
||||
width - 2 * BUTTON_WIDTH,
|
||||
theme->border_width);
|
||||
continue;
|
||||
default:
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -183,7 +183,8 @@ ssd_extents_update(struct view *view)
|
|||
if (part_box.width != result_box.width
|
||||
|| part_box.height != result_box.height) {
|
||||
/* 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,
|
||||
target->x + (result_box.x - part_box.x),
|
||||
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) {
|
||||
switch (part->type) {
|
||||
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,
|
||||
theme->title_height);
|
||||
continue;
|
||||
|
|
@ -102,7 +103,8 @@ ssd_titlebar_update(struct view *view)
|
|||
case LAB_SSD_BUTTON_CLOSE:
|
||||
if (is_direct_child(part->node, subtree)) {
|
||||
wlr_scene_node_set_position(part->node,
|
||||
width - BUTTON_WIDTH * 1, -theme->border_width);
|
||||
width - BUTTON_WIDTH * 1,
|
||||
-theme->border_width);
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
|
|
|
|||
23
src/view.c
23
src/view.c
|
|
@ -194,10 +194,12 @@ view_apply_maximized_geometry(struct view *view)
|
|||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +217,8 @@ static void
|
|||
view_apply_unmaximized_geometry(struct view *view)
|
||||
{
|
||||
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 */
|
||||
view_move_resize(view, view->unmaximized_geometry);
|
||||
} else {
|
||||
|
|
@ -300,7 +303,7 @@ void
|
|||
view_set_fullscreen(struct view *view, bool fullscreen,
|
||||
struct wlr_output *wlr_output)
|
||||
{
|
||||
if (fullscreen == (view->fullscreen != NULL)) {
|
||||
if (fullscreen != !view->fullscreen) {
|
||||
return;
|
||||
}
|
||||
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 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -503,10 +508,12 @@ view_get_edge_snap_box(struct view *view, struct output *output,
|
|||
{
|
||||
struct border border = view_border(view);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
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
|
||||
* 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 true;
|
||||
|
|
@ -42,8 +43,10 @@ handle_commit(struct wl_listener *listener, void *data)
|
|||
view->h = size.height;
|
||||
|
||||
/* padding changes with maximize/unmaximize */
|
||||
view->padding.top = view->padding.bottom = size.y;
|
||||
view->padding.left = view->padding.right = size.x;
|
||||
view->padding.top = size.y;
|
||||
view->padding.bottom = size.y;
|
||||
view->padding.left = size.x;
|
||||
view->padding.right = size.x;
|
||||
|
||||
uint32_t serial = view->pending_move_resize.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;
|
||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &padding);
|
||||
view->padding.top = view->padding.bottom = padding.y;
|
||||
view->padding.left = view->padding.right = padding.x;
|
||||
view->padding.top = padding.y;
|
||||
view->padding.bottom = padding.y;
|
||||
view->padding.left = padding.x;
|
||||
view->padding.right = padding.x;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -241,7 +246,7 @@ xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
|||
static bool
|
||||
istopmost(struct view *view)
|
||||
{
|
||||
return view->xdg_surface->toplevel->parent == NULL;
|
||||
return !view->xdg_surface->toplevel->parent;
|
||||
}
|
||||
|
||||
static struct view *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue