@@ -55,7 +55,7 @@ namespace Gala {
5555 wayland_pantheon_panel_interface = {
5656 destroy_panel_surface,
5757 set_anchor,
58- focus ,
58+ focus_panel ,
5959 set_size,
6060 set_hide_mode,
6161 };
@@ -67,9 +67,13 @@ namespace Gala {
6767 wayland_pantheon_extended_behavior_interface = {
6868 destroy_extended_behavior_surface,
6969 set_keep_above,
70+ make_centered,
71+ focus_extended_behavior,
7072 };
7173
7274 PanelSurface . quark = GLib . Quark . from_string (" -gala-wayland-panel-surface-data" );
75+ WidgetSurface . quark = GLib . Quark . from_string (" -gala-wayland-widget-surface-data" );
76+ ExtendedBehaviorSurface . quark = GLib . Quark . from_string (" -gala-wayland-extended-behavior-surface-data" );
7377
7478 shell_global = Wl . Global . create (wl_disp, ref Pantheon . Desktop . ShellInterface . iface, 1 , (client, version, id) = > {
7579 unowned var resource = client. create_resource (ref Pantheon . Desktop . ShellInterface . iface, (int ) version, id);
@@ -260,15 +264,29 @@ namespace Gala {
260264 ShellClientsManager . get_instance (). set_anchor (window, side);
261265 }
262266
263- internal static void focus (Wl .Client client , Wl .Resource resource ) {
267+ internal static void focus_panel (Wl .Client client , Wl .Resource resource ) {
264268 unowned PanelSurface ? panel_surface = resource. get_user_data< PanelSurface > ();
265269 if (panel_surface. wayland_surface == null ) {
266270 warning (" Window tried to focus but wayland surface is null." );
267271 return ;
268272 }
269273
274+ focus (panel_surface. wayland_surface);
275+ }
276+
277+ internal static void focus_extended_behavior (Wl .Client client , Wl .Resource resource ) {
278+ unowned ExtendedBehaviorSurface ? extended_behavior_surface = resource. get_user_data< ExtendedBehaviorSurface > ();
279+ if (extended_behavior_surface. wayland_surface == null ) {
280+ warning (" Window tried to focus but wayland surface is null." );
281+ return ;
282+ }
283+
284+ focus (extended_behavior_surface. wayland_surface);
285+ }
286+
287+ internal static void focus (Object wayland_surface ) {
270288 Meta . Window ? window;
271- panel_surface . wayland_surface. get (" window" , out window, null );
289+ wayland_surface. get (" window" , out window, null );
272290 if (window == null ) {
273291 warning (" Window tried to focus but wayland surface had no associated window." );
274292 return ;
@@ -326,6 +344,21 @@ namespace Gala {
326344 window. make_above ();
327345 }
328346
347+ internal static void make_centered (Wl .Client client , Wl .Resource resource ) {
348+ unowned ExtendedBehaviorSurface ? eb_surface = resource. get_user_data< ExtendedBehaviorSurface > ();
349+ if (eb_surface. wayland_surface == null ) {
350+ return ;
351+ }
352+
353+ Meta . Window ? window;
354+ eb_surface. wayland_surface. get (" window" , out window, null );
355+ if (window == null ) {
356+ return ;
357+ }
358+
359+ ShellClientsManager . get_instance (). make_centered (window);
360+ }
361+
329362 internal static void destroy_panel_surface (Wl .Client client , Wl .Resource resource ) {
330363 resource. destroy ();
331364 }
0 commit comments