|
|
| version 1.7, 2007/01/22 16:37:05 | version 1.8, 2007/01/24 14:09:32 |
|---|---|
| Line 96 static XF86VidModeModeInfo **modes = NUL | Line 96 static XF86VidModeModeInfo **modes = NUL |
| static int modeidx = -1; | static int modeidx = -1; |
| static XF86VidModeModeInfo *saved_modes; | static XF86VidModeModeInfo *saved_modes; |
| static XF86VidModeModeInfo orig_mode; | static XF86VidModeModeInfo orig_mode; |
| static Display *fs_xdisplay; | |
| static int fs_xscreen; | |
| static int view_x, view_y; | static int view_x, view_y; |
| static gint orig_x, orig_y; | static gint orig_x, orig_y; |
| Line 119 gtk_window_init_fullscreen(GtkWidget *wi | Line 121 gtk_window_init_fullscreen(GtkWidget *wi |
| GtkWindow *window; | GtkWindow *window; |
| GdkWindow *w; | GdkWindow *w; |
| Display *xdisplay; | Display *xdisplay; |
| XF86VidModeModeInfo mode; | |
| int xscreen; | int xscreen; |
| XF86VidModeModeInfo mode; | |
| int event_base, error_base; | int event_base, error_base; |
| int major_ver, minor_ver; | int major_ver, minor_ver; |
| int nmodes; | int nmodes; |
| Line 176 gtk_window_init_fullscreen(GtkWidget *wi | Line 178 gtk_window_init_fullscreen(GtkWidget *wi |
| modes[i]->hdisplay, modes[i]->vdisplay); | modes[i]->hdisplay, modes[i]->vdisplay); |
| } | } |
| rv = XF86VidModeValidateModeLine(xdisplay, xscreen, modes[i]); | if ((modes[i]->hdisplay == 640) |
| if (rv) { | && (modes[i]->vdisplay == 480)) { |
| if ((modes[i]->hdisplay == 640) | rv = XF86VidModeGetModeInfo(xdisplay, xscreen, |
| && (modes[i]->vdisplay == 480)) { | &orig_mode); |
| rv = XF86VidModeGetModeInfo(xdisplay, xscreen, | if (rv) { |
| &orig_mode); | if (verbose) { |
| if (rv) { | printf("found\n"); |
| if (verbose) { | |
| printf("found\n"); | |
| } | |
| modeidx = i; | |
| ret = TRUE; | |
| break; | |
| } | } |
| modeidx = i; | |
| ret = TRUE; | |
| break; | |
| } | } |
| } | } |
| } | } |
| if (!ret) { | |
| if (ret) { | |
| fs_xdisplay = xdisplay; | |
| fs_xscreen = xscreen; | |
| } else { | |
| XFree(modes); | XFree(modes); |
| modes = NULL; | modes = NULL; |
| } | } |
| Line 210 gtk_window_fullscreen_mode(GtkWidget *wi | Line 213 gtk_window_fullscreen_mode(GtkWidget *wi |
| { | { |
| #ifdef HAVE_XF86VIDMODE | #ifdef HAVE_XF86VIDMODE |
| GtkWindow *window; | GtkWindow *window; |
| GdkWindow *w; | |
| Display *xdisplay; | |
| int xscreen; | |
| g_return_if_fail(widget != NULL); | g_return_if_fail(widget != NULL); |
| g_return_if_fail(widget->window != NULL); | |
| if (modeidx < 0) | if (modes == NULL || modeidx < 0) |
| return; | return; |
| window = GTK_WINDOW(widget); | window = GTK_WINDOW(widget); |
| w = widget->window; | g_return_if_fail(window != NULL); |
| xdisplay = GDK_WINDOW_XDISPLAY(w); | |
| xscreen = XDefaultScreen(xdisplay); | |
| XLockDisplay(xdisplay); | XLockDisplay(fs_xdisplay); |
| XF86VidModeLockModeSwitch(xdisplay, xscreen, True); | XF86VidModeLockModeSwitch(fs_xdisplay, fs_xscreen, True); |
| XF86VidModeGetViewPort(xdisplay, xscreen, &view_x, &view_y); | XF86VidModeGetViewPort(fs_xdisplay, fs_xscreen, &view_x, &view_y); |
| gdk_window_get_origin(w, &orig_x, &orig_y); | gdk_window_get_origin(widget->window, &orig_x, &orig_y); |
| gtk_window_move(window, 0, 0); | gtk_window_move(window, 0, 0); |
| XF86VidModeSwitchToMode(xdisplay, xscreen, modes[modeidx]); | XF86VidModeSwitchToMode(fs_xdisplay, fs_xscreen, modes[modeidx]); |
| XUnlockDisplay(xdisplay); | XUnlockDisplay(fs_xdisplay); |
| #endif /* HAVE_XF86VIDMODE */ | #endif /* HAVE_XF86VIDMODE */ |
| } | } |
| Line 241 gtk_window_restore_mode(GtkWidget *widge | Line 240 gtk_window_restore_mode(GtkWidget *widge |
| { | { |
| #ifdef HAVE_XF86VIDMODE | #ifdef HAVE_XF86VIDMODE |
| GtkWindow *window; | GtkWindow *window; |
| GdkWindow *w; | |
| Display *xdisplay; | |
| int xscreen; | |
| XF86VidModeModeInfo mode; | XF86VidModeModeInfo mode; |
| int rv; | int rv; |
| Line 253 gtk_window_restore_mode(GtkWidget *widge | Line 249 gtk_window_restore_mode(GtkWidget *widge |
| return; | return; |
| window = GTK_WINDOW(widget); | window = GTK_WINDOW(widget); |
| w = widget->window; | |
| xdisplay = GDK_WINDOW_XDISPLAY(w); | |
| xscreen = XDefaultScreen(xdisplay); | |
| XLockDisplay(xdisplay); | XLockDisplay(fs_xdisplay); |
| rv = XF86VidModeGetModeInfo(xdisplay, xscreen, &mode); | rv = XF86VidModeGetModeInfo(fs_xdisplay, fs_xscreen, &mode); |
| if (rv) { | if (rv) { |
| if ((orig_mode.hdisplay != mode.hdisplay) | if ((orig_mode.hdisplay != mode.hdisplay) |
| || (orig_mode.vdisplay != mode.vdisplay)) { | || (orig_mode.vdisplay != mode.vdisplay)) { |
| XF86VidModeSwitchToMode(xdisplay, xscreen, &orig_mode); | XF86VidModeSwitchToMode(fs_xdisplay, fs_xscreen, |
| XF86VidModeLockModeSwitch(xdisplay, xscreen, False); | &orig_mode); |
| XF86VidModeLockModeSwitch(fs_xdisplay, fs_xscreen, | |
| False); | |
| } | } |
| if ((view_x != 0) || (view_y != 0)) { | if ((view_x != 0) || (view_y != 0)) { |
| XF86VidModeSetViewPort(xdisplay,xscreen,view_x,view_y); | XF86VidModeSetViewPort(fs_xdisplay, fs_xscreen, |
| view_x, view_y); | |
| } | } |
| } | } |
| gtk_window_move(window, orig_x, orig_y); | if (window != NULL) { |
| gtk_window_move(window, orig_x, orig_y); | |
| } | |
| XUnlockDisplay(xdisplay); | XUnlockDisplay(fs_xdisplay); |
| #endif /* HAVE_XF86VIDMODE */ | #endif /* HAVE_XF86VIDMODE */ |
| } | } |