@@ -63,12 +63,17 @@ public class Gala.Background.BackgroundWindow : Gtk.Window, PantheonWayland.Exte
6363
6464 child. realize. connect (() = > {
6565 connect_to_shell ();
66- get_surface (). notify[" scale" ]. connect (setup_size );
66+ get_surface (). notify[" scale" ]. connect (update_size );
6767 });
6868
6969 map. connect (() = > {
70- make_background (monitor_index);
71- setup_size ();
70+ if (get_surface () is Gdk . Wayland . Surface ) {
71+ make_background (monitor_index);
72+ } else {
73+ make_background_x11 ();
74+ }
75+
76+ update_size ();
7277 });
7378
7479 var gesture = new Gtk .GestureClick () {
@@ -90,7 +95,7 @@ public class Gala.Background.BackgroundWindow : Gtk.Window, PantheonWayland.Exte
9095 present ();
9196 }
9297
93- private void setup_size () {
98+ private void update_size () {
9499 var monitor = Gdk . Display . get_default (). get_monitor_at_surface (get_surface ());
95100 var geom = monitor. get_geometry ();
96101
@@ -126,6 +131,26 @@ public class Gala.Background.BackgroundWindow : Gtk.Window, PantheonWayland.Exte
126131 animation. play ();
127132 }
128133
134+ private void make_background_x11 () {
135+ var monitor = (Gdk . X11. Monitor ) Gdk . Display . get_default (). get_monitors (). get_item (monitor_index);
136+
137+ var geom = monitor. geometry;
138+
139+ unowned var xdisplay = ((Gdk . X11. Display ) display). get_xdisplay ();
140+
141+ unowned var x_window = ((Gdk . X11. Surface ) get_surface ()). get_xid ();
142+
143+ var atom = xdisplay. intern_atom (" _NET_WM_WINDOW_TYPE" , false );
144+ var dock_atom = xdisplay. intern_atom (" _NET_WM_WINDOW_TYPE_DESKTOP" , false );
145+
146+ // (X.Atom) 4 is XA_ATOM
147+ // 32 is format
148+ // 0 means replace
149+ xdisplay. change_property (x_window, atom, (X . Atom ) 4 , 32 , 0 , (uchar[]) dock_atom, 1 );
150+
151+ xdisplay. move_window (x_window, geom. x, geom. y);
152+ }
153+
129154 private static void action_launch (SimpleAction action , Variant ? variant ) {
130155 try {
131156 AppInfo . launch_default_for_uri (variant. get_string (), null );
0 commit comments