Skip to content

Commit 953da77

Browse files
author
raveit65
committed
mate-rr: replace deprecated Gdk functions
1 parent c49a780 commit 953da77

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

libmate-desktop/mate-rr.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ fill_out_screen_info (Display *xdisplay,
437437
{
438438
#ifdef HAVE_RANDR
439439
XRRScreenResources *resources;
440+
GdkDisplay *display;
440441

441442
g_assert (xdisplay != NULL);
442443
g_assert (info != NULL);
@@ -468,14 +469,15 @@ fill_out_screen_info (Display *xdisplay,
468469
if (needs_reprobe) {
469470
gboolean success;
470471

471-
gdk_error_trap_push ();
472+
display = gdk_display_get_default ();
473+
gdk_x11_display_error_trap_push (display);
472474
success = XRRGetScreenSizeRange (xdisplay, xroot,
473475
&(info->min_width),
474476
&(info->min_height),
475477
&(info->max_width),
476478
&(info->max_height));
477-
gdk_flush ();
478-
if (gdk_error_trap_pop ()) {
479+
gdk_display_flush (display);
480+
if (gdk_x11_display_error_trap_pop (display)) {
479481
g_set_error (error, MATE_RR_ERROR, MATE_RR_ERROR_UNKNOWN,
480482
_("unhandled X error while getting the range of screen sizes"));
481483
return FALSE;
@@ -497,9 +499,10 @@ fill_out_screen_info (Display *xdisplay,
497499
}
498500

499501
info->primary = None;
500-
gdk_error_trap_push ();
502+
display = gdk_display_get_default ();
503+
gdk_x11_display_error_trap_push (display);
501504
info->primary = XRRGetOutputPrimary (xdisplay, xroot);
502-
gdk_error_trap_pop_ignored ();
505+
gdk_x11_display_error_trap_pop_ignored (display);
503506

504507
return TRUE;
505508
#else
@@ -843,10 +846,13 @@ mate_rr_screen_set_size (MateRRScreen *screen,
843846
g_return_if_fail (MATE_IS_RR_SCREEN (screen));
844847

845848
#ifdef HAVE_RANDR
846-
gdk_error_trap_push ();
849+
GdkDisplay *display;
850+
851+
display = gdk_display_get_default ();
852+
gdk_x11_display_error_trap_push (display);
847853
XRRSetScreenSize (screen->priv->xdisplay, screen->priv->xroot,
848854
width, height, mm_width, mm_height);
849-
gdk_error_trap_pop_ignored ();
855+
gdk_x11_display_error_trap_pop_ignored (display);
850856
#endif
851857
}
852858

@@ -925,6 +931,7 @@ force_timestamp_update (MateRRScreen *screen)
925931
MateRRScreenPrivate *priv = screen->priv;
926932
MateRRCrtc *crtc;
927933
XRRCrtcInfo *current_info;
934+
GdkDisplay *display;
928935
Status status;
929936
gboolean timestamp_updated;
930937

@@ -940,9 +947,10 @@ force_timestamp_update (MateRRScreen *screen)
940947
crtc->id);
941948

942949
if (current_info == NULL)
943-
goto out;
950+
goto out;
944951

945-
gdk_error_trap_push ();
952+
display = gdk_display_get_default ();
953+
gdk_x11_display_error_trap_push (display);
946954
status = XRRSetCrtcConfig (priv->xdisplay,
947955
priv->info->resources,
948956
crtc->id,
@@ -956,8 +964,8 @@ force_timestamp_update (MateRRScreen *screen)
956964

957965
XRRFreeCrtcInfo (current_info);
958966

959-
gdk_flush ();
960-
if (gdk_error_trap_pop ())
967+
gdk_display_flush (display);
968+
if (gdk_x11_display_error_trap_pop (display))
961969
goto out;
962970

963971
if (status == RRSetConfigSuccess)
@@ -1716,6 +1724,7 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc,
17161724
#ifdef HAVE_RANDR
17171725
ScreenInfo *info;
17181726
GArray *output_ids;
1727+
GdkDisplay *display;
17191728
Status status;
17201729
gboolean result;
17211730
int i;
@@ -1753,7 +1762,8 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc,
17531762
g_array_append_val (output_ids, outputs[i]->id);
17541763
}
17551764

1756-
gdk_error_trap_push ();
1765+
display = gdk_display_get_default ();
1766+
gdk_x11_display_error_trap_push (display);
17571767
status = XRRSetCrtcConfig (DISPLAY (crtc), info->resources, crtc->id,
17581768
timestamp,
17591769
x, y,
@@ -1764,7 +1774,7 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc,
17641774

17651775
g_array_free (output_ids, TRUE);
17661776

1767-
if (gdk_error_trap_pop () || status != RRSetConfigSuccess) {
1777+
if (gdk_x11_display_error_trap_pop (display) || status != RRSetConfigSuccess) {
17681778
/* Translators: CRTC is a CRT Controller (this is X terminology).
17691779
* It is *very* unlikely that you'll ever get this error, so it is
17701780
* only listed for completeness. */

0 commit comments

Comments
 (0)