[Xfce4-commits] [xfce/xfce4-settings] 04/05: display: Use current display

noreply at xfce.org noreply at xfce.org
Fri Jul 26 00:15:54 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       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/xfce4-settings.

commit 4cdf8a91cb8789a5104f9eb96548497deb591cd7
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sat Jul 20 15:29:12 2019 +0200

    display: Use current display
    
    Instead of getting the default display again and again.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 xfsettingsd/displays.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c
index ac990fe..4f138fe 100644
--- a/xfsettingsd/displays.c
+++ b/xfsettingsd/displays.c
@@ -239,12 +239,12 @@ xfce_displays_helper_init (XfceDisplaysHelper *helper)
         if (XRRQueryVersion (helper->xdisplay, &major, &minor)
             && (major > 1 || (major == 1 && minor >= 2)))
         {
-            gdk_x11_display_error_trap_push (gdk_display_get_default ());
+            gdk_x11_display_error_trap_push (helper->display);
             /* get the screen resource */
             helper->resources = XRRGetScreenResources (helper->xdisplay,
                                                        GDK_WINDOW_XID (helper->root_window));
-            gdk_display_flush (gdk_display_get_default ());
-            err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
+            gdk_display_flush (helper->display);
+            err = gdk_x11_display_error_trap_pop (helper->display);
             if (err)
             {
                 g_critical ("XRRGetScreenResources failed (err: %d). "
@@ -375,10 +375,10 @@ xfce_displays_helper_finalize (GObject *object)
     /* Free the screen resources */
     if (helper->resources)
     {
-        gdk_x11_display_error_trap_push (gdk_display_get_default ());
+        gdk_x11_display_error_trap_push (helper->display);
         XRRFreeScreenResources (helper->resources);
-        gdk_display_flush (gdk_display_get_default ());
-        if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
+        gdk_display_flush (helper->display);
+        if (gdk_x11_display_error_trap_pop (helper->display) != 0)
         {
             g_critical ("Failed to free screen resources");
         }
@@ -401,7 +401,7 @@ xfce_displays_helper_reload (XfceDisplaysHelper *helper)
     g_ptr_array_unref (helper->outputs);
     g_ptr_array_unref (helper->crtcs);
 
-    gdk_x11_display_error_trap_push (gdk_display_get_default ());
+    gdk_x11_display_error_trap_push (helper->display);
 
     /* Free the screen resources */
     XRRFreeScreenResources (helper->resources);
@@ -419,8 +419,8 @@ xfce_displays_helper_reload (XfceDisplaysHelper *helper)
     helper->resources = XRRGetScreenResources (helper->xdisplay,
                                                GDK_WINDOW_XID (helper->root_window));
 
-    gdk_display_flush (gdk_display_get_default ());
-    err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
+    gdk_display_flush (helper->display);
+    err = gdk_x11_display_error_trap_pop (helper->display);
     if (err)
         g_critical ("Failed to reload the RandR cache (err: %d).", err);
 
@@ -960,10 +960,10 @@ xfce_displays_helper_list_outputs (XfceDisplaysHelper *helper)
     outputs = g_ptr_array_new_with_free_func ((GDestroyNotify) xfce_displays_helper_free_output);
     for (n = 0; n < helper->resources->noutput; ++n)
     {
-        gdk_x11_display_error_trap_push (gdk_display_get_default ());
+        gdk_x11_display_error_trap_push (helper->display);
         output_info = XRRGetOutputInfo (helper->xdisplay, helper->resources, helper->resources->outputs[n]);
-        gdk_display_flush (gdk_display_get_default ());
-        err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
+        gdk_display_flush (helper->display);
+        err = gdk_x11_display_error_trap_pop (helper->display);
         if (err || !output_info)
         {
             g_warning ("Failed to load info for output %lu (err: %d). Skipping.",
@@ -1066,10 +1066,10 @@ xfce_displays_helper_list_crtcs (XfceDisplaysHelper *helper)
     {
         xfsettings_dbg (XFSD_DEBUG_DISPLAYS, "Detected CRTC %lu.", helper->resources->crtcs[n]);
 
-        gdk_x11_display_error_trap_push (gdk_display_get_default ());
+        gdk_x11_display_error_trap_push (helper->display);
         crtc_info = XRRGetCrtcInfo (helper->xdisplay, helper->resources, helper->resources->crtcs[n]);
-        gdk_display_flush (gdk_display_get_default ());
-        err = gdk_x11_display_error_trap_pop (gdk_display_get_default ());
+        gdk_display_flush (helper->display);
+        err = gdk_x11_display_error_trap_pop (helper->display);
         if (err || !crtc_info)
         {
             g_warning ("Failed to load info for CRTC %lu (err: %d). Skipping.",
@@ -1407,7 +1407,7 @@ xfce_displays_helper_apply_all (XfceDisplaysHelper *helper)
     g_ptr_array_foreach (helper->crtcs, (GFunc) xfce_displays_helper_get_topleftmost_pos, helper);
     g_ptr_array_foreach (helper->crtcs, (GFunc) xfce_displays_helper_normalize_crtc, helper);
 
-    gdk_x11_display_error_trap_push (gdk_display_get_default ());
+    gdk_x11_display_error_trap_push (helper->display);
 
     /* grab server to prevent clients from thinking no output is enabled */
     gdk_x11_display_grab (helper->display);
@@ -1429,8 +1429,8 @@ xfce_displays_helper_apply_all (XfceDisplaysHelper *helper)
 
     /* release the grab, changes are done */
     gdk_x11_display_ungrab (helper->display);
-    gdk_display_flush (gdk_display_get_default ());
-    if (gdk_x11_display_error_trap_pop (gdk_display_get_default ()) != 0)
+    gdk_display_flush (helper->display);
+    if (gdk_x11_display_error_trap_pop (helper->display) != 0)
     {
         g_critical ("Failed to apply display settings");
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list