Last active
December 16, 2022 12:21
-
-
Save tiagovignatti/9601000 to your computer and use it in GitHub Desktop.
Chromium App Launcher support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ffbaf37149ea3cdb4eb6a7be0368281d4cc67765 Mon Sep 17 00:00:00 2001 | |
From: Tiago Vignatti <[email protected]> | |
Date: Mon, 17 Mar 2014 17:18:40 +0200 | |
Subject: [PATCH] wip: Bubble shell thing | |
--- | |
content/messages.h | 2 +- | |
.../desktop_window_tree_host_wayland.cc | 6 ++++++ | |
ui/events/window_constants.h | 3 ++- | |
wayland/display.cc | 5 ++++- | |
wayland/shell/wl_shell_surface.cc | 3 +++ | |
wayland/window.h | 1 + | |
6 files changed, 17 insertions(+), 3 deletions(-) | |
diff --git a/content/messages.h b/content/messages.h | |
index cf35a04..55b1eaa 100644 | |
--- a/content/messages.h | |
+++ b/content/messages.h | |
@@ -23,7 +23,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(ui::EventType, | |
IPC_ENUM_TRAITS_MAX_VALUE(ui::WidgetState, | |
ui::DESTROYED) | |
IPC_ENUM_TRAITS_MAX_VALUE(ui::WidgetType, | |
- ui::POPUP) | |
+ ui::BUBBLE) | |
IPC_MESSAGE_CONTROL2(WaylandInput_MotionNotify, // NOLINT(readability/fn_size) | |
float /*x*/, | |
diff --git a/ui/desktop_aura/desktop_window_tree_host_wayland.cc b/ui/desktop_aura/desktop_window_tree_host_wayland.cc | |
index ee882b4..1f30221 100644 | |
--- a/ui/desktop_aura/desktop_window_tree_host_wayland.cc | |
+++ b/ui/desktop_aura/desktop_window_tree_host_wayland.cc | |
@@ -158,6 +158,12 @@ void DesktopWindowTreeHostWayland::InitWaylandWindow( | |
break; | |
} | |
case Widget::InitParams::TYPE_BUBBLE: | |
+ state_handler->SetWidgetAttributes(window_, | |
+ 0, | |
+ 0, | |
+ 0, | |
+ ui::BUBBLE); | |
+ break; | |
case Widget::InitParams::TYPE_WINDOW: | |
state_handler->SetWidgetAttributes(window_, | |
0, | |
diff --git a/ui/events/window_constants.h b/ui/events/window_constants.h | |
index a3a68ca..a46dc95 100644 | |
--- a/ui/events/window_constants.h | |
+++ b/ui/events/window_constants.h | |
@@ -24,9 +24,10 @@ namespace ui { | |
enum WidgetType { | |
WINDOW = 1, // A decorated Window. | |
WINDOWFRAMELESS = 2, // An undecorated Window. | |
- POPUP = 3 // An undecorated Window, with transient positioning relative to | |
+ POPUP = 3, // An undecorated Window, with transient positioning relative to | |
// its parent and in which the input pointer is implicit grabbed | |
// (i.e. Wayland install the grab) by the Window. | |
+ BUBBLE = 4 | |
}; | |
} // namespace ui | |
diff --git a/wayland/display.cc b/wayland/display.cc | |
index 42041a0..278a3a7 100644 | |
--- a/wayland/display.cc | |
+++ b/wayland/display.cc | |
@@ -166,6 +166,9 @@ void WaylandDisplay::SetWidgetAttributes(unsigned widget, | |
WaylandWindow* parent_window = GetWidget(parent); | |
DCHECK(window); | |
switch (type) { | |
+ case ui::BUBBLE: | |
+ window->SetShellAttributes(WaylandWindow::LAUNCHER); | |
+ break; | |
case ui::WINDOW: | |
window->SetShellAttributes(WaylandWindow::TOPLEVEL); | |
break; | |
@@ -180,7 +183,7 @@ void WaylandDisplay::SetWidgetAttributes(unsigned widget, | |
y); | |
break; | |
default: | |
- break; | |
+ NOTREACHED(); | |
} | |
} | |
diff --git a/wayland/shell/wl_shell_surface.cc b/wayland/shell/wl_shell_surface.cc | |
index fb98ca7..a03fd8a 100644 | |
--- a/wayland/shell/wl_shell_surface.cc | |
+++ b/wayland/shell/wl_shell_surface.cc | |
@@ -27,6 +27,9 @@ void WLShellSurface::UpdateShellSurface(WaylandWindow::ShellType type, | |
unsigned x, | |
unsigned y) const { | |
switch (type) { | |
+ case WaylandWindow::LAUNCHER: | |
+ wl_shell_surface_set_launcher(shell_surface_); | |
+ break; | |
case WaylandWindow::TOPLEVEL: | |
wl_shell_surface_set_toplevel(shell_surface_); | |
break; | |
diff --git a/wayland/window.h b/wayland/window.h | |
index b07abc4..299696d 100644 | |
--- a/wayland/window.h | |
+++ b/wayland/window.h | |
@@ -23,6 +23,7 @@ class WaylandWindow { | |
public: | |
enum ShellType { | |
None, | |
+ LAUNCHER, | |
TOPLEVEL, | |
FULLSCREEN, | |
POPUP, | |
-- | |
1.7.9.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 0c4fa586d48dd3f666ec46b79445029f31cbcc73 Mon Sep 17 00:00:00 2001 | |
From: Tiago Vignatti <[email protected]> | |
Date: Tue, 25 Feb 2014 20:06:24 +0200 | |
Subject: [PATCH] protocol: Add experimental set_launcher shell surface | |
--- | |
protocol/wayland.xml | 5 +++++ | |
1 file changed, 5 insertions(+) | |
diff --git a/protocol/wayland.xml b/protocol/wayland.xml | |
index e1edbe5..952392b 100644 | |
--- a/protocol/wayland.xml | |
+++ b/protocol/wayland.xml | |
@@ -894,6 +894,11 @@ | |
<arg name="output" type="object" interface="wl_output" allow-null="true"/> | |
</request> | |
+ <request name="set_launcher"> | |
+ <description summary="make the surface a desktop App Launcher surface"> | |
+ </description> | |
+ </request> | |
+ | |
<request name="set_title"> | |
<description summary="set surface title"> | |
Set a short title for the surface. | |
-- | |
1.7.9.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 7594d70b9b688070437d171747e3ea6dd1d6c485 Mon Sep 17 00:00:00 2001 | |
From: Tiago Vignatti <[email protected]> | |
Date: Tue, 25 Feb 2014 18:45:24 +0200 | |
Subject: [PATCH] desktop-shell: Implement experimental Launcher shell surface | |
Place the surface below the desktop panel bar, useful for App Launcher. | |
Requires changes in Wayland protocol, shell_surface interface. | |
--- | |
desktop-shell/shell.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ | |
1 file changed, 53 insertions(+) | |
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c | |
index fd9ead0..5b2c9d7 100644 | |
--- a/desktop-shell/shell.c | |
+++ b/desktop-shell/shell.c | |
@@ -58,6 +58,7 @@ struct focus_state { | |
enum shell_surface_type { | |
SHELL_SURFACE_NONE, | |
+ SHELL_SURFACE_LAUNCHER, | |
SHELL_SURFACE_TOPLEVEL, | |
SHELL_SURFACE_POPUP, | |
SHELL_SURFACE_XWAYLAND | |
@@ -2464,6 +2465,24 @@ shell_surface_set_maximized(struct wl_client *client, | |
shsurf->state_changed = true; | |
} | |
+static void | |
+set_launcher(struct shell_surface *shsurf) | |
+{ | |
+ shell_surface_set_parent(shsurf, NULL); | |
+ surface_clear_next_states(shsurf); | |
+ shsurf->type = SHELL_SURFACE_LAUNCHER; | |
+} | |
+ | |
+static void | |
+shell_surface_set_launcher(struct wl_client *client, | |
+ struct wl_resource *resource) | |
+{ | |
+ struct shell_surface *surface = wl_resource_get_user_data(resource); | |
+ | |
+ set_launcher(surface); | |
+} | |
+ | |
+ | |
/* This is only ever called from set_surface_type(), so there’s no need to | |
* update layer_links here, since they’ll be updated when we return. */ | |
static int | |
@@ -2522,6 +2541,7 @@ set_surface_type(struct shell_surface *shsurf) | |
shsurf->transient.y); | |
break; | |
+ case SHELL_SURFACE_LAUNCHER: | |
case SHELL_SURFACE_POPUP: | |
case SHELL_SURFACE_NONE: | |
default: | |
@@ -2957,6 +2977,7 @@ static const struct wl_shell_surface_interface shell_surface_implementation = { | |
shell_surface_set_fullscreen, | |
shell_surface_set_popup, | |
shell_surface_set_maximized, | |
+ shell_surface_set_launcher, | |
shell_surface_set_title, | |
shell_surface_set_class | |
}; | |
@@ -4629,6 +4650,31 @@ center_on_output(struct weston_view *view, struct weston_output *output) | |
} | |
static void | |
+weston_view_set_launcher_position(struct weston_view *view, | |
+ struct desktop_shell *shell) | |
+{ | |
+ struct weston_compositor *compositor = shell->compositor; | |
+ int ix = 0, iy = 0; | |
+ struct weston_output *output = NULL; | |
+ struct weston_seat *seat; | |
+ | |
+ wl_list_for_each(seat, &compositor->seat_list, link) { | |
+ if (seat->pointer) { | |
+ ix = wl_fixed_to_int(seat->pointer->x); | |
+ iy = wl_fixed_to_int(seat->pointer->y); | |
+ break; | |
+ } | |
+ } | |
+ | |
+ wl_list_for_each(output, &compositor->output_list, link) { | |
+ if (pixman_region32_contains_point(&output->region, ix, iy, NULL)) | |
+ break; | |
+ } | |
+ | |
+ weston_view_set_position(view, 0, get_output_panel_height(shell, output)); | |
+} | |
+ | |
+static void | |
weston_view_set_initial_position(struct weston_view *view, | |
struct desktop_shell *shell) | |
{ | |
@@ -4701,6 +4747,9 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf, | |
/* initial positioning, see also configure() */ | |
switch (shsurf->type) { | |
+ case SHELL_SURFACE_LAUNCHER: | |
+ weston_view_set_launcher_position(shsurf->view, shell); | |
+ break; | |
case SHELL_SURFACE_TOPLEVEL: | |
if (shsurf->state.fullscreen) { | |
center_on_output(shsurf->view, shsurf->fullscreen_output); | |
@@ -4743,6 +4792,10 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf, | |
} | |
switch (shsurf->type) { | |
+ case SHELL_SURFACE_LAUNCHER: | |
+ wl_list_for_each(seat, &compositor->seat_list, link) | |
+ activate(shell, shsurf->surface, seat); | |
+ break; | |
/* XXX: xwayland's using the same fields for transient type */ | |
case SHELL_SURFACE_XWAYLAND: | |
if (shsurf->transient.flags == | |
-- | |
1.7.9.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my Weston's config file (~/.config/weston.ini) has a section that looks something like this: | |
[launcher] | |
icon=/home/tiago/git/chromium/src/ash/resources/default_100_percent/common/launcher/launcher_appmenu.png | |
path=/home/tiago/git/chromium/src/out/Debug/chrome --no-sandbox --show-app-list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment