mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
src/: fix coding style
This commit is contained in:
parent
0e41413dc8
commit
cce3c8cda0
7 changed files with 97 additions and 53 deletions
25
src/cursor.c
25
src/cursor.c
|
|
@ -20,13 +20,17 @@ request_cursor_notify(struct wl_listener *listener, void *data)
|
|||
struct wlr_seat_client *focused_client =
|
||||
seat->seat->pointer_state.focused_client;
|
||||
|
||||
/* This can be sent by any client, so we check to make sure this one is
|
||||
* actually has pointer focus first. */
|
||||
/*
|
||||
* This can be sent by any client, so we check to make sure this one is
|
||||
* actually has pointer focus first.
|
||||
*/
|
||||
if (focused_client == event->seat_client) {
|
||||
/* Once we've vetted the client, we can tell the cursor to use
|
||||
/*
|
||||
* Once we've vetted the client, we can tell the cursor to use
|
||||
* the provided surface as the cursor image. It will set the
|
||||
* hardware cursor on the output that it's currently on and
|
||||
* continue to do so as the cursor moves between outputs. */
|
||||
* continue to do so as the cursor moves between outputs.
|
||||
*/
|
||||
wlr_cursor_set_surface(seat->cursor, event->surface,
|
||||
event->hotspot_x, event->hotspot_y);
|
||||
}
|
||||
|
|
@ -140,15 +144,16 @@ process_cursor_motion(struct server *server, uint32_t time)
|
|||
struct wlr_surface *surface = NULL;
|
||||
int view_area = LAB_SSD_NONE;
|
||||
struct view *view =
|
||||
desktop_view_at(server, server->seat.cursor->x, server->seat.cursor->y,
|
||||
&surface, &sx, &sy, &view_area);
|
||||
desktop_view_at(server, server->seat.cursor->x,
|
||||
server->seat.cursor->y, &surface, &sx, &sy, &view_area);
|
||||
if (!view) {
|
||||
set_cursor(server, XCURSOR_DEFAULT);
|
||||
} else {
|
||||
uint32_t resize_edges = ssd_resize_edges(view_area);
|
||||
if (resize_edges) {
|
||||
cursor_name_set_by_server = true;
|
||||
set_cursor(server, wlr_xcursor_get_resize_name(resize_edges));
|
||||
set_cursor(server,
|
||||
wlr_xcursor_get_resize_name(resize_edges));
|
||||
} else if (view_area != LAB_SSD_NONE) {
|
||||
/* title and buttons */
|
||||
set_cursor(server, XCURSOR_DEFAULT);
|
||||
|
|
@ -192,8 +197,10 @@ process_cursor_motion(struct server *server, uint32_t time)
|
|||
wlr_seat_pointer_notify_motion(wlr_seat, time, sx, sy);
|
||||
}
|
||||
} else {
|
||||
/* Clear pointer focus so future button events and such are not
|
||||
* sent to the last client to have the cursor over it. */
|
||||
/*
|
||||
* Clear pointer focus so future button events and such are not
|
||||
* sent to the last client to have the cursor over it.
|
||||
*/
|
||||
wlr_seat_pointer_clear_focus(wlr_seat);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,12 @@ apply_exclusive(struct wlr_box *usable_area, uint32_t anchor, int32_t exclusive,
|
|||
for (size_t i = 0; i < sizeof(edges) / sizeof(edges[0]); ++i) {
|
||||
if ((anchor & edges[i].anchors) == edges[i].anchors) {
|
||||
if (edges[i].positive_axis) {
|
||||
*edges[i].positive_axis += exclusive + edges[i].margin;
|
||||
*edges[i].positive_axis +=
|
||||
exclusive + edges[i].margin;
|
||||
}
|
||||
if (edges[i].negative_axis) {
|
||||
*edges[i].negative_axis -= exclusive + edges[i].margin;
|
||||
*edges[i].negative_axis -=
|
||||
exclusive + edges[i].margin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
src/output.c
40
src/output.c
|
|
@ -248,9 +248,9 @@ void output_layer_for_each_surface(struct output *output,
|
|||
wl_list_for_each(layer_surface, layer_surfaces, link) {
|
||||
struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
|
||||
layer_surface->layer_surface;
|
||||
output_surface_for_each_surface(output, wlr_layer_surface_v1->surface,
|
||||
layer_surface->geo.x, layer_surface->geo.y, iterator,
|
||||
user_data);
|
||||
output_surface_for_each_surface(output,
|
||||
wlr_layer_surface_v1->surface, layer_surface->geo.x,
|
||||
layer_surface->geo.y, iterator, user_data);
|
||||
/* TODO: handle popups */
|
||||
}
|
||||
}
|
||||
|
|
@ -275,8 +275,8 @@ output_for_each_surface(struct output *output, surface_iterator_func_t iterator,
|
|||
}
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
output_unmanaged_for_each_surface(output, &output->server->unmanaged_surfaces,
|
||||
iterator, user_data);
|
||||
output_unmanaged_for_each_surface(output,
|
||||
&output->server->unmanaged_surfaces, iterator, user_data);
|
||||
#endif
|
||||
|
||||
output_layer_for_each_surface(output,
|
||||
|
|
@ -638,7 +638,8 @@ render_view_popups(struct view *view, struct output *output,
|
|||
struct render_data data = {
|
||||
.damage = damage,
|
||||
};
|
||||
output_view_for_each_popup_surface(output, view, render_surface_iterator, &data);
|
||||
output_view_for_each_popup_surface(output, view,
|
||||
render_surface_iterator, &data);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -949,7 +950,8 @@ output_config_apply(struct server *server,
|
|||
int32_t width = head->state.custom_mode.width;
|
||||
int32_t height = head->state.custom_mode.height;
|
||||
int32_t refresh = head->state.custom_mode.refresh;
|
||||
wlr_output_set_custom_mode(o, width, height, refresh);
|
||||
wlr_output_set_custom_mode(o, width,
|
||||
height, refresh);
|
||||
}
|
||||
wlr_output_layout_move(server->output_layout, o,
|
||||
head->state.x, head->state.y);
|
||||
|
|
@ -972,7 +974,8 @@ verify_output_config_v1(const struct wlr_output_configuration_v1 *config)
|
|||
static void
|
||||
handle_output_manager_apply(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct server *server = wl_container_of(listener, server, output_manager_apply);
|
||||
struct server *server =
|
||||
wl_container_of(listener, server, output_manager_apply);
|
||||
struct wlr_output_configuration_v1 *config = data;
|
||||
|
||||
bool config_is_good = verify_output_config_v1(config);
|
||||
|
|
@ -994,7 +997,8 @@ handle_output_manager_apply(struct wl_listener *listener, void *data)
|
|||
static struct
|
||||
wlr_output_configuration_v1 *create_output_config(struct server *server)
|
||||
{
|
||||
struct wlr_output_configuration_v1 *config = wlr_output_configuration_v1_create();
|
||||
struct wlr_output_configuration_v1 *config =
|
||||
wlr_output_configuration_v1_create();
|
||||
if (!config) {
|
||||
wlr_log(WLR_ERROR, "wlr_output_configuration_v1_create()");
|
||||
return NULL;
|
||||
|
|
@ -1006,11 +1010,13 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
|
|||
wlr_output_configuration_head_v1_create(config,
|
||||
output->wlr_output);
|
||||
if (!head) {
|
||||
wlr_log(WLR_ERROR, "wlr_output_configuration_head_v1_create()");
|
||||
wlr_log(WLR_ERROR,
|
||||
"wlr_output_configuration_head_v1_create()");
|
||||
wlr_output_configuration_v1_destroy(config);
|
||||
return NULL;
|
||||
}
|
||||
struct wlr_box *box = wlr_output_layout_get_box(server->output_layout,
|
||||
struct wlr_box *box =
|
||||
wlr_output_layout_get_box(server->output_layout,
|
||||
output->wlr_output);
|
||||
if (box) {
|
||||
head->state.x = box->x;
|
||||
|
|
@ -1025,15 +1031,19 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
|
|||
static void
|
||||
handle_output_layout_change(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct server *server = wl_container_of(listener, server, output_layout_change);
|
||||
struct server *server =
|
||||
wl_container_of(listener, server, output_layout_change);
|
||||
|
||||
bool done_changing = server->pending_output_config == NULL;
|
||||
if (done_changing) {
|
||||
struct wlr_output_configuration_v1 *config = create_output_config(server);
|
||||
struct wlr_output_configuration_v1 *config =
|
||||
create_output_config(server);
|
||||
if (config) {
|
||||
wlr_output_manager_v1_set_configuration(server->output_manager, config);
|
||||
wlr_output_manager_v1_set_configuration(
|
||||
server->output_manager, config);
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "wlr_output_manager_v1_set_configuration()");
|
||||
wlr_log(WLR_ERROR,
|
||||
"wlr_output_manager_v1_set_configuration()");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ subsurface_handle_destroy(struct wl_listener *listener, void *data)
|
|||
void
|
||||
subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface)
|
||||
{
|
||||
struct view_subsurface *subsurface = calloc(1, sizeof(struct view_subsurface));
|
||||
struct view_subsurface *subsurface =
|
||||
calloc(1, sizeof(struct view_subsurface));
|
||||
if (!subsurface) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
54
src/theme.c
54
src/theme.c
|
|
@ -84,12 +84,18 @@ theme_builtin(struct theme *theme)
|
|||
parse_hexstr("#dddad6", theme->window_active_title_bg_color);
|
||||
parse_hexstr("#f6f5f4", theme->window_inactive_title_bg_color);
|
||||
|
||||
parse_hexstr("#000000", theme->window_active_button_iconify_unpressed_image_color);
|
||||
parse_hexstr("#000000", theme->window_active_button_max_unpressed_image_color);
|
||||
parse_hexstr("#000000", theme->window_active_button_close_unpressed_image_color);
|
||||
parse_hexstr("#000000", theme->window_inactive_button_iconify_unpressed_image_color);
|
||||
parse_hexstr("#000000", theme->window_inactive_button_max_unpressed_image_color);
|
||||
parse_hexstr("#000000", theme->window_inactive_button_close_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
theme->window_active_button_iconify_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
theme->window_active_button_max_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
theme->window_active_button_close_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
theme->window_inactive_button_iconify_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
theme->window_inactive_button_max_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
theme->window_inactive_button_close_unpressed_image_color);
|
||||
|
||||
parse_hexstr("#fcfbfa", theme->menu_items_bg_color);
|
||||
parse_hexstr("#000000", theme->menu_items_text_color);
|
||||
|
|
@ -137,34 +143,46 @@ entry(struct theme *theme, const char *key, const char *value)
|
|||
|
||||
/* universal button */
|
||||
if (match(key, "window.active.button.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_active_button_iconify_unpressed_image_color);
|
||||
parse_hexstr(value, theme->window_active_button_max_unpressed_image_color);
|
||||
parse_hexstr(value, theme->window_active_button_close_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_active_button_iconify_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_active_button_max_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_active_button_close_unpressed_image_color);
|
||||
}
|
||||
if (match(key, "window.inactive.button.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_inactive_button_iconify_unpressed_image_color);
|
||||
parse_hexstr(value, theme->window_inactive_button_max_unpressed_image_color);
|
||||
parse_hexstr(value, theme->window_inactive_button_close_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_inactive_button_iconify_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_inactive_button_max_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_inactive_button_close_unpressed_image_color);
|
||||
}
|
||||
|
||||
/* individual buttons */
|
||||
if (match(key, "window.active.button.iconify.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_active_button_iconify_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_active_button_iconify_unpressed_image_color);
|
||||
}
|
||||
if (match(key, "window.active.button.max.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_active_button_max_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_active_button_max_unpressed_image_color);
|
||||
}
|
||||
if (match(key, "window.active.button.close.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_active_button_close_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_active_button_close_unpressed_image_color);
|
||||
}
|
||||
if (match(key, "window.inactive.button.iconify.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_inactive_button_iconify_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_inactive_button_iconify_unpressed_image_color);
|
||||
}
|
||||
if (match(key, "window.inactive.button.max.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_inactive_button_max_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_inactive_button_max_unpressed_image_color);
|
||||
}
|
||||
if (match(key, "window.inactive.button.close.unpressed.image.color")) {
|
||||
parse_hexstr(value, theme->window_inactive_button_close_unpressed_image_color);
|
||||
parse_hexstr(value,
|
||||
theme->window_inactive_button_close_unpressed_image_color);
|
||||
}
|
||||
|
||||
if (match(key, "menu.items.bg.color")) {
|
||||
|
|
|
|||
15
src/xdg.c
15
src/xdg.c
|
|
@ -102,13 +102,15 @@ handle_destroy(struct wl_listener *listener, void *data)
|
|||
static void
|
||||
handle_request_move(struct wl_listener *listener, void *data)
|
||||
{
|
||||
/* This event is raised when a client would like to begin an interactive
|
||||
/*
|
||||
* This event is raised when a client would like to begin an interactive
|
||||
* move, typically because the user clicked on their client-side
|
||||
* decorations. Note that a more sophisticated compositor should check
|
||||
* the provied serial against a list of button press serials sent to
|
||||
* this
|
||||
* client, to prevent the client from requesting this whenever they
|
||||
* want. */
|
||||
* want.
|
||||
*/
|
||||
struct view *view = wl_container_of(listener, view, request_move);
|
||||
interactive_begin(view, LAB_INPUT_STATE_MOVE, 0);
|
||||
}
|
||||
|
|
@ -116,13 +118,15 @@ handle_request_move(struct wl_listener *listener, void *data)
|
|||
static void
|
||||
handle_request_resize(struct wl_listener *listener, void *data)
|
||||
{
|
||||
/* This event is raised when a client would like to begin an interactive
|
||||
/*
|
||||
* This event is raised when a client would like to begin an interactive
|
||||
* resize, typically because the user clicked on their client-side
|
||||
* decorations. Note that a more sophisticated compositor should check
|
||||
* the provied serial against a list of button press serials sent to
|
||||
* this
|
||||
* client, to prevent the client from requesting this whenever they
|
||||
* want. */
|
||||
* want.
|
||||
*/
|
||||
struct wlr_xdg_toplevel_resize_event *event = data;
|
||||
struct view *view = wl_container_of(listener, view, request_resize);
|
||||
interactive_begin(view, LAB_INPUT_STATE_RESIZE, event->edges);
|
||||
|
|
@ -249,7 +253,8 @@ static void
|
|||
position_xdg_toplevel_view(struct view *view)
|
||||
{
|
||||
if (istopmost(view)) {
|
||||
struct wlr_box box = output_usable_area_from_cursor_coords(view->server);
|
||||
struct wlr_box box =
|
||||
output_usable_area_from_cursor_coords(view->server);
|
||||
view->x = box.x;
|
||||
view->y = box.y;
|
||||
view->w = view->xdg_surface->geometry.width;
|
||||
|
|
|
|||
|
|
@ -192,7 +192,8 @@ map(struct view *view)
|
|||
|
||||
foreign_toplevel_handle_create(view);
|
||||
|
||||
struct wlr_box box = output_usable_area_from_cursor_coords(view->server);
|
||||
struct wlr_box box =
|
||||
output_usable_area_from_cursor_coords(view->server);
|
||||
view->x = box.x;
|
||||
view->y = box.y;
|
||||
view_center(view);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue