From 4bb45abc46def3f05f83561745349c121e6a8a2a Mon Sep 17 00:00:00 2001 From: David Eklov Date: Sun, 10 Jul 2016 11:03:39 -0500 Subject: Don't treat backgrounds as shell surfaces This code had some issues. Remove it now so that we can start clean and fix it later. --- include/extensions.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/extensions.h b/include/extensions.h index 7c508b5e..2e2e4b07 100644 --- a/include/extensions.h +++ b/include/extensions.h @@ -11,8 +11,6 @@ struct background_config { wlc_resource surface; // we need the wl_resource of the surface in the destructor struct wl_resource *wl_surface_res; - // used to determine if client is a background - struct wl_client *client; }; struct panel_config { -- cgit v1.2.3 From 5c4f52f9537ad0e8e1f251392fea986871ab73b0 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Wed, 6 Jul 2016 00:28:14 -0500 Subject: Set panels' geometries correctly and don't render them explicitly Panels were explicitly rendered by calling wlc_surface_render in handle_output_pre_render. Calling wlc_surface_render does not set the surface's geometry (like wlc_view_set_geometry does). Sway did not call wlc_view_set_geometry for panels, so wlc defaulted their geometry to be at the origin. This is not correct for bars unless their location is top. Furthermore, for a surface to receive pointer events, its mask has to be set to visible. This causes wlc to render these surfaces, causing panels and backgrounds to be rendered twice. This commit makes panels and surfaces visible, sets the correct geometries and removes the code that explicitly rendered them. --- include/extensions.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/extensions.h b/include/extensions.h index 2e2e4b07..d26e95c1 100644 --- a/include/extensions.h +++ b/include/extensions.h @@ -23,6 +23,8 @@ struct panel_config { enum desktop_shell_panel_position panel_position; // used to determine if client is a panel struct wl_client *client; + // wlc handle for this panel's surface, not set until panel is created + wlc_handle handle; }; struct desktop_shell_state { -- cgit v1.2.3 From c805e42635f3935ccf0ce927143433b94c78a3e7 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Sun, 10 Jul 2016 22:47:10 -0500 Subject: Extract workspace size computation from render_workspace_button() Also remove some unnecessary strtup()s and rename a few variables and functions. --- include/bar/bar.h | 3 +++ include/bar/render.h | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'include') diff --git a/include/bar/bar.h b/include/bar/bar.h index c20efc55..a3c511d9 100644 --- a/include/bar/bar.h +++ b/include/bar/bar.h @@ -32,6 +32,9 @@ struct workspace { bool urgent; }; +/** Global bar state */ +extern struct bar swaybar; + /** * Setup bar. */ diff --git a/include/bar/render.h b/include/bar/render.h index 931a1cdd..114f43f4 100644 --- a/include/bar/render.h +++ b/include/bar/render.h @@ -14,4 +14,9 @@ void render(struct output *output, struct config *config, struct status_line *li */ void set_window_height(struct window *window, int height); +/** + * Compute the size of a workspace name + */ +void workspace_button_size(struct window *window, const char *workspace_name, int *width, int *height); + #endif /* _SWAYBAR_RENDER_H */ -- cgit v1.2.3 From 679c7b397c4e9dfdc69d6c67c523494dfe987f60 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Mon, 11 Jul 2016 00:03:15 -0500 Subject: Use int instead of wl_fixed_t for mouse coordinates --- include/client/window.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/client/window.h b/include/client/window.h index 7be4fff3..55a12225 100644 --- a/include/client/window.h +++ b/include/client/window.h @@ -28,10 +28,10 @@ struct cursor { }; struct pointer_input { - wl_fixed_t last_x; - wl_fixed_t last_y; + int last_x; + int last_y; - void (*notify)(struct window *window, wl_fixed_t x, wl_fixed_t y, uint32_t button); + void (*notify)(struct window *window, int x, int y, uint32_t button); }; struct window { -- cgit v1.2.3 From a0c8799c8008da4eccde3ae4bd5865b5c4422058 Mon Sep 17 00:00:00 2001 From: David Eklov Date: Mon, 11 Jul 2016 00:11:38 -0500 Subject: Compute what workspace button is clicked This commit does not do anything with this information other than logging it. --- include/bar/ipc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/bar/ipc.h b/include/bar/ipc.h index 741c067b..c11931d0 100644 --- a/include/bar/ipc.h +++ b/include/bar/ipc.h @@ -13,5 +13,11 @@ void ipc_bar_init(struct bar *bar, const char *bar_id); */ bool handle_ipc_event(struct bar *bar); + +/** + * Send workspace command to sway + */ +void ipc_send_workspace_command(const char *workspace_name); + #endif /* _SWAYBAR_IPC_H */ -- cgit v1.2.3