mate-desktop / marco

MATE default window manager
https://mate-desktop.org
GNU General Public License v2.0
192 stars 85 forks source link

trouble on second screen #745

Open cgrzemba opened 1 year ago

cgrzemba commented 1 year ago

Expected behaviour

I can place windows on the second screen.

Actual behaviour

I have a setup with one Display and 2 Screens (SunRay Multihead). Marco logs this so:

Window manager: Trying screen 0 on display ':12'
XINERAMA: No Xinerama screens, using default screen info
Window manager: Added screen 0 (':12.0') root 0x1c5
Window manager: Trying screen 1 on display ':12'
XINERAMA: No Xinerama screens, using default screen info
Window manager: Added screen 1 (':12.1') root 0x1c7

If metacity 2.30.3 is used ,on second screen backdrop image and top panel is shown. Windows can be opend with option --display=:12.1

With marco 1.26.0 on the second screen :12.1 it will not show the background image if I start $ mate-terminal --display=:12.1 marco 1.26.0 will core in

00007fffabb89852 _gdk_window_has_impl () + 2
 00007fff896279e7 meta_ui_create_frame_window () + 107
 00007fff895d56cf meta_window_ensure_frame () + af
 00007fff895fda88 meta_window_new_with_attrs.part.34 () + ba8
 00007fff895fdd7c meta_window_new () + 6c
 00007fff895d0adf event_callback () + 102f
 00007fff8962732a filter_func () + 2a
 00007fffabbab640 gdk_event_apply_filters () + 50
 00007fffabbaba46 _gdk_x11_display_queue_events () + 216
 00007fffabb74123 gdk_display_get_event () + 43
 00007fffabbab6ea gdk_event_source_dispatch () + 1a
 00007fffaea20e4a g_main_context_dispatch () + 53a
 00007fffaea21138 g_main_context_iterate.isra.26 () + 258
 00007fffaea216aa g_main_loop_run () + 1aa
 00000000004037e9 main () + 6b9

it seems that on the second screen gdk_screen_get_root_window(screen) cannot find the root window and in follow frame = meta_frames_lookup_window (frames, xwindow) cannot provide a valid frame.

How can I fix this? For me is the relation of the datatypes GdkScreen -- MateScreen not clear.

If I catch the the invalid frame returns to prevents the marco crashes (also replacing g_assert),

diff --git a/src/ui/frames.c b/src/ui/frames.c
index d65dac8..764989c 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -764,6 +764,10 @@ meta_ui_frame_get_borders (MetaFrames       *frames,
   MetaFrameType type;
   gint scale;

+  if (frame == NULL) {
+     g_critical("Frame NULL");
+     return;
+  }
   meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwin
dow,
                  META_CORE_GET_FRAME_FLAGS, &flags,
                  META_CORE_GET_FRAME_TYPE, &type,
@@ -861,6 +867,10 @@ meta_frames_get_corner_radiuses (MetaFrames *frames,

   frame = meta_frames_lookup_window (frames, xwindow);

+  if (frame == NULL) {
+    g_critical ("No such frame on xwindow 0x%lx\n", xwindow);
+    return;
+  }
   meta_ui_frame_get_corner_radiuses (frames, frame, top_left, top_right,
                                      bottom_left, bottom_right);
 }
@@ -1238,6 +1254,10 @@ meta_frames_move_resize_frame (MetaFrames *frames,
   int old_width, old_height;
   gint scale;

+  if (frame == NULL) {
+    g_critical ("No such frame on xwindow 0x%lx\n", xwindow);
+    return;
+  }
   old_width = gdk_window_get_width (frame->window);
   old_height = gdk_window_get_height (frame->window);

@@ -1257,6 +1277,10 @@ meta_frames_queue_draw (MetaFrames *frames,

   frame = meta_frames_lookup_window (frames, xwindow);

+  if (frame == NULL) {
+    g_critical ("No such frame on xwindow 0x%lx\n", xwindow);
+    return;
+  }
   invalidate_whole_window (frames, frame);
 }

@@ -1269,7 +1293,10 @@ meta_frames_set_title (MetaFrames *frames,

   frame = meta_frames_lookup_window (frames, xwindow);

-  g_assert (frame);
+  if (frame == NULL) {
+    g_critical ("No such frame on xwindow 0x%lx\n", xwindow);
+    return;
+  }

   g_free (frame->title);
   frame->title = g_strdup (title);
@@ -1287,7 +1314,7 @@ meta_frames_update_frame_style (MetaFrames *frames,

   frame = meta_frames_lookup_window (frames, xwindow);

-  g_assert (frame);
+  if (frame == NULL) return;

   meta_frames_attach_style (frames, frame);
   invalidate_whole_window (frames, frame);
@@ -1301,6 +1328,10 @@ meta_frames_repaint_frame (MetaFrames *frames,

   frame = meta_frames_lookup_window (frames, xwindow);

+  if (frame == NULL) {
+    g_critical ("No such frame on xwindow 0x%lx\n", xwindow);
+    return;
+  }
   g_assert (frame);

   /* repaint everything, so the other frame don't

the window will opened but is not visible because of the incomplete frame handling (only in rare circumstances).

MATE general version

1.26.0

Package version

Linux Distribution

Openindiana

lukefromdc commented 1 year ago

I've never had this problem in the past, but right now my second (and smaller) monitor is packed away for lack of space so cannot test this at the moment. Anyone else here w two monitors want to see if they can duplicate this?

muktupavels commented 1 year ago

@lukefromdc There is huge possibility that you have never used such setup!

He speaks about separate X screens on one X display... DISPLAY on typical pc will be :0 or :0.0, one display with one screen. He have :0.0 and :0.1, one display and two screens.

@cgrzemba Multi-screen is not supported by GTK since 3.10 if I remember correctly... New metacity versions also will manage only default screen. I guess you could try to start extra wm for second screen.

lukefromdc commented 1 year ago

I was using the default multiscreen setup offered by xrandr, mostly for video editing when I had lower resolution monitors. That's what I am familiar with.