Skip to content

Commit

Permalink
PantheonShell: Add more warnings (#1929)
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 authored May 28, 2024
1 parent 8e361c3 commit 3a40014
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/PantheonShell.vala
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,14 @@ namespace Gala {
internal static void set_anchor (Wl.Client client, Wl.Resource resource, [CCode (type = "uint32_t")] Pantheon.Desktop.Anchor anchor) {
unowned PanelSurface? panel_surface = resource.get_user_data<PanelSurface> ();
if (panel_surface.wayland_surface == null) {
warning ("Window tried to set anchor but wayland surface is null.");
return;
}

Meta.Window? window;
panel_surface.wayland_surface.get ("window", out window, null);
if (window == null) {
warning ("Window tried to set anchor but wayland surface had no associated window.");
return;
}

Expand Down Expand Up @@ -261,12 +263,14 @@ namespace Gala {
internal static void focus (Wl.Client client, Wl.Resource resource) {
unowned PanelSurface? panel_surface = resource.get_user_data<PanelSurface> ();
if (panel_surface.wayland_surface == null) {
warning ("Window tried to focus but wayland surface is null.");
return;
}

Meta.Window? window;
panel_surface.wayland_surface.get ("window", out window, null);
if (window == null) {
warning ("Window tried to focus but wayland surface had no associated window.");
return;
}

Expand All @@ -276,12 +280,14 @@ namespace Gala {
internal static void set_size (Wl.Client client, Wl.Resource resource, int width, int height) {
unowned PanelSurface? panel_surface = resource.get_user_data<PanelSurface> ();
if (panel_surface.wayland_surface == null) {
warning ("Window tried to set size but wayland surface is null.");
return;
}

Meta.Window? window;
panel_surface.wayland_surface.get ("window", out window, null);
if (window == null) {
warning ("Window tried to set size but wayland surface had no associated window.");
return;
}

Expand All @@ -291,12 +297,14 @@ namespace Gala {
internal static void set_hide_mode (Wl.Client client, Wl.Resource resource, [CCode (type = "uint32_t")] Pantheon.Desktop.HideMode hide_mode) {
unowned PanelSurface? panel_surface = resource.get_user_data<PanelSurface> ();
if (panel_surface.wayland_surface == null) {
warning ("Window tried to set hide mode but wayland surface is null.");
return;
}

Meta.Window? window;
panel_surface.wayland_surface.get ("window", out window, null);
if (window == null) {
warning ("Window tried to set hide mode but wayland surface had no associated window.");
return;
}

Expand Down

0 comments on commit 3a40014

Please sign in to comment.