summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2007-03-01 11:48:12 +0000
committerBastien Nocera <hadess@src.gnome.org>2007-03-01 11:48:12 +0000
commit2d6f5884655b6b525c3db18daf4754565f5245d3 (patch)
tree4f1c25b3116ceef56ad01eabf03ee649bcff8e77
parent319cbbde5c0cc9d6d7c3d9ec1912ae188635a4ee (diff)
downloadtotem-2d6f5884655b6b525c3db18daf4754565f5245d3.tar.gz
Don't assume the first modeline is the current one, fixes the resolution
2007-03-01 Bastien Nocera <hadess@hadess.net> * src/backend/bacon-resize.c: (bacon_resize_init), (bacon_resize), (bacon_restore): Don't assume the first modeline is the current one, fixes the resolution changing when not using the highest resolution (Closes: #411408) svn path=/trunk/; revision=4081
-rw-r--r--ChangeLog7
-rw-r--r--src/backend/bacon-resize.c36
2 files changed, 29 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index cf2a79039..94ecd6904 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-03-01 Bastien Nocera <hadess@hadess.net>
+
+ * src/backend/bacon-resize.c: (bacon_resize_init), (bacon_resize),
+ (bacon_restore): Don't assume the first modeline is the current one,
+ fixes the resolution changing when not using the highest resolution
+ (Closes: #411408)
+
2007-02-27 Bastien Nocera <hadess@hadess.net>
* src/totem-preferences.c: (get_stock_label),
diff --git a/src/backend/bacon-resize.c b/src/backend/bacon-resize.c
index db01f8e42..1ef13f46f 100644
--- a/src/backend/bacon-resize.c
+++ b/src/backend/bacon-resize.c
@@ -33,10 +33,6 @@
#include <X11/extensions/Xrandr.h>
#include <X11/extensions/Xrender.h>
-/* XVidMode */
-XF86VidModeModeInfo **modelines;
-int nr_modeline;
-
/* XRandR */
XRRScreenConfiguration *xr_screen_conf;
XRRScreenSize *xr_sizes;
@@ -60,8 +56,6 @@ bacon_resize_init (void)
return FALSE;
}
- res = XF86VidModeGetAllModeLines (GDK_DISPLAY(), XDefaultScreen (GDK_DISPLAY()), &nr_modeline, &modelines);
-
xr_screen_conf = XRRGetScreenInfo (GDK_DISPLAY(), GDK_ROOT_WINDOW());
XUnlockDisplay (GDK_DISPLAY());
@@ -76,18 +70,25 @@ void
bacon_resize (void)
{
#ifdef HAVE_XVIDMODE
- int width, height, i, xr_nsize;
+ int width, height, i, xr_nsize, res, dotclock;
+ XF86VidModeModeLine modeline;
XRRScreenSize *xr_sizes;
gboolean found = FALSE;
/* FIXME multihead */
XLockDisplay (GDK_DISPLAY());
+ res = XF86VidModeGetModeLine (GDK_DISPLAY(), XDefaultScreen (GDK_DISPLAY()), &dotclock, &modeline);
+ if (!res) {
+ XUnlockDisplay (GDK_DISPLAY());
+ return;
+ }
+
/* Check if there's a viewport */
width = gdk_screen_width ();
height = gdk_screen_height ();
- if (width == modelines[0]->hdisplay
- && height == modelines[0]->vdisplay) {
+ if (width > modeline.hdisplay
+ && height > modeline.vdisplay) {
XUnlockDisplay (GDK_DISPLAY());
return;
}
@@ -101,8 +102,8 @@ bacon_resize (void)
g_warning ("XRRConfigSizes or XRRConfigCurrentConfiguration failed");
for (i = 0; i < xr_nsize; i++) {
- if (modelines[0]->hdisplay == xr_sizes[i].width
- && modelines[0]->vdisplay == xr_sizes[i].height) {
+ if (modeline.hdisplay == xr_sizes[i].width
+ && modeline.vdisplay == xr_sizes[i].height) {
found = TRUE;
break;
}
@@ -131,16 +132,23 @@ void
bacon_restore (void)
{
#ifdef HAVE_XVIDMODE
- int width, height;
+ int width, height, res, dotclock;
+ XF86VidModeModeLine modeline;
/* FIXME multihead */
XLockDisplay (GDK_DISPLAY());
+ res = XF86VidModeGetModeLine (GDK_DISPLAY(), XDefaultScreen (GDK_DISPLAY()), &dotclock, &modeline);
+ if (!res) {
+ XUnlockDisplay (GDK_DISPLAY());
+ return;
+ }
+
/* Check if there's a viewport */
width = gdk_screen_width ();
height = gdk_screen_height ();
- if (width == modelines[0]->hdisplay
- && height == modelines[0]->vdisplay) {
+ if (width > modeline.hdisplay
+ && height > modeline.vdisplay) {
XUnlockDisplay (GDK_DISPLAY());
return;
}