[Xfce4-commits] [xfce/xfwm4] 29/32: main: add support for multiple screens with GDK 3
noreply at xfce.org
noreply at xfce.org
Tue Dec 5 09:22:15 CET 2017
This is an automated email from the git hooks/post-receive script.
o l i v i e r p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfwm4.
commit b52c2f5b740434803342c471d4dcb5dd62eb99a1
Author: Viktor Odintsev <ninetls at xfce.org>
Date: Sun Nov 12 14:52:46 2017 +0300
main: add support for multiple screens with GDK 3
---
src/main.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
index cf29f2e..8546fa7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -481,7 +481,7 @@ static int
initialize (gint compositor_mode, gboolean replace_wm)
{
DisplayInfo *display_info;
- gint i, nscreens;
+ gint i, nscreens, default_screen;
TRACE ("entering initialize");
@@ -514,13 +514,41 @@ initialize (gint compositor_mode, gboolean replace_wm)
setupHandler (TRUE);
- nscreens = gdk_display_get_n_screens (display_info->gdisplay);
+ nscreens = ScreenCount (display_info->dpy);
+ default_screen = DefaultScreen (display_info->dpy);
for(i = 0; i < nscreens; i++)
{
ScreenInfo *screen_info;
GdkScreen *gscr;
+ Window temp_xwindow;
+ GdkWindow *screen_window;
- gscr = gdk_display_get_screen (display_info->gdisplay, i);
+ if (i == default_screen)
+ {
+ gscr = gdk_display_get_default_screen (display_info->gdisplay);
+ }
+ else
+ {
+ /* create temp 1x1 child window on this screen */
+ temp_xwindow = XCreateSimpleWindow (display_info->dpy, RootWindow (display_info->dpy, i),
+ 0, 0, 1, 1, 0, 0, 0);
+ /* allocate new GdkWindow with GdkScreen for this window */
+ screen_window = gdk_x11_window_foreign_new_for_display (display_info->gdisplay,
+ temp_xwindow);
+ XDestroyWindow (display_info->dpy, temp_xwindow);
+
+ if (screen_window == NULL)
+ {
+ g_warning ("Cannot create GdkScreen for screen %i", i);
+ continue;
+ }
+
+ gscr = gdk_window_get_screen (screen_window);
+
+ /* foreign windows have 2 references */
+ g_object_unref (screen_window);
+ g_object_unref (screen_window);
+ }
screen_info = myScreenInit (display_info, gscr, MAIN_EVENT_MASK, replace_wm);
if (!screen_info)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list