Re: [AD] SF.net SVN: alleg:[13184] allegro/branches/4.9 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] SF.net SVN: alleg:[13184] allegro/branches/4.9
- From: Peter Wang <novalazy@xxxxxxxxxx>
- Date: Sun, 4 Apr 2010 21:58:47 +1000
On 2010-04-04, Milan Mimica <milan.mimica@xxxxxxxxxx> wrote:
> Thomas Fjellstrom wrote:
> >
> > I can only assume thats due to not setting the virtual size, since the
> > desktop isn't. What happens if you run krandrtray in 3.5? (yeah, there was a
> > version for 3.5) I'll see about setting the virtual size as well.
>
> Some sizes work fine, some dont. But I never get scolling.
The following patch (using xrandr command line tool for mode setting)
works consistently here. These configurations succeeded:
- xfwm/kwin/icewm/fluxbox with fglrx driver
- icewm with nvidia driver
- xfwm with radeon driver (BadWindow or something on exit)
This configuration fails (can't focus the window):
- awesome with radeon driver
Peter
diff --git a/include/allegro5/internal/aintern_xglx.h b/include/allegro5/internal/aintern_xglx.h
index 857a88a..1ae0448 100644
--- a/include/allegro5/internal/aintern_xglx.h
+++ b/include/allegro5/internal/aintern_xglx.h
@@ -180,7 +180,7 @@ void _al_xglx_store_video_mode(ALLEGRO_SYSTEM_XGLX *s);
void _al_xglx_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter);
void _al_xglx_fullscreen_to_display(ALLEGRO_SYSTEM_XGLX *s,
ALLEGRO_DISPLAY_XGLX *d);
-void _al_xglx_toggle_fullscreen_window(ALLEGRO_DISPLAY *display);
+void _al_xglx_toggle_fullscreen_window(ALLEGRO_DISPLAY *display, bool await_resize);
void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d);
void _al_xglx_set_above(ALLEGRO_DISPLAY *display);
void _al_xglx_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y);
diff --git a/src/x/xdisplay.c b/src/x/xdisplay.c
index 5e97bd9..4dba889 100644
--- a/src/x/xdisplay.c
+++ b/src/x/xdisplay.c
@@ -217,7 +217,7 @@ static bool xdpy_toggle_display_flag(ALLEGRO_DISPLAY *display, int flag,
case ALLEGRO_FULLSCREEN_WINDOW:
if (onoff == !(display->flags & ALLEGRO_FULLSCREEN_WINDOW)) {
reset_size_hints(display);
- _al_xglx_toggle_fullscreen_window(display);
+ _al_xglx_toggle_fullscreen_window(display, true);
display->flags ^= ALLEGRO_FULLSCREEN_WINDOW;
set_size_hints(display);
}
@@ -387,16 +387,21 @@ static ALLEGRO_DISPLAY *xdpy_create_display(int w, int h)
_al_cond_wait(&d->mapped, &system->lock);
}
+#if 0
if (display->flags & ALLEGRO_FULLSCREEN) {
_al_xglx_set_above(display);
}
+#endif
/* We can do this at any time, but if we already have a mapped
* window when switching to fullscreen it will use the same
* monitor (with the MetaCity version I'm using here right now).
*/
- if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) {
- _al_xglx_toggle_fullscreen_window(display);
+ if (display->flags & ALLEGRO_FULLSCREEN) {
+ _al_xglx_toggle_fullscreen_window(display, false);
+ }
+ else if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) {
+ _al_xglx_toggle_fullscreen_window(display, true);
/* Wait for the resize event so we can create the initial
* OpenGL view already with the full size.
@@ -709,6 +714,15 @@ void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d)
_al_cond_wait(&system->resized, &system->lock);
}
+ /* XXX: This hack makes the second and subsequent toggles of
+ * ALLEGRO_FULLSCREEN_WINDOW work in ex_fs_window on my machine,
+ * with IceWM and Fluxbox. xfwm and kwin were okay without.
+ *
+ * XXX Needed about 0.5s for ex_fs_resize with kwin, using xrandr
+ * command line tool.
+ */
+ al_rest(0.5);
+
/* TODO: Right now, we still generate a resize event (from the events
* thread, in response to the Configure event) which is X11
* specific though - if there's a simple way to prevent it we
@@ -726,17 +740,20 @@ static bool xdpy_resize_display(ALLEGRO_DISPLAY *d, int w, int h)
_al_mutex_lock(&system->lock);
- reset_size_hints(d);
- XResizeWindow(system->x11display, glx->window, w, h);
-
- _al_display_xglx_await_resize(d);
-
- // XXX is this even a valid action?
if (d->flags & ALLEGRO_FULLSCREEN) {
+ /* xfwm likes this before the mode set */
+ reset_size_hints(d);
+
+ _al_xglx_toggle_fullscreen_window(d, false);
_al_xglx_fullscreen_set_mode(system, glx, w, h, 0, 0);
_al_xglx_fullscreen_to_display(system, glx);
+ _al_xglx_toggle_fullscreen_window(d, false);
}
-
+
+ /* kwin likes the resize after the mode set */
+ reset_size_hints(d);
+ XResizeWindow(system->x11display, glx->window, w, h);
+ _al_display_xglx_await_resize(d);
set_size_hints(d);
_al_mutex_unlock(&system->lock);
diff --git a/src/x/xfullscreen.c b/src/x/xfullscreen.c
index caf869a..093f0b5 100644
--- a/src/x/xfullscreen.c
+++ b/src/x/xfullscreen.c
@@ -230,11 +230,20 @@ static ALLEGRO_DISPLAY_MODE *_al_xsys_xrandr_get_mode(ALLEGRO_SYSTEM_XGLX *s, in
return mode;
}
-static bool _al_xsys_xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int w, int h, int format, int refresh)
+static bool _al_xsys_xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s,
+ ALLEGRO_DISPLAY_XGLX *d, int w, int h, int format, int refresh)
{
int mode_idx = -1;
XRRModeInfo *mi = NULL;
+ /* XXX hack */
+ {
+ char buf[256];
+ sprintf(buf, "xrandr -s %dx%d", w, h);
+ system(buf);
+ return true;
+ }
+
if (d->xscreen < 0 || d->xscreen >= s->xrandr_output_count)
return false;
@@ -907,7 +916,7 @@ static Atom _NET_WM_STATE_FULLSCREEN;
static Atom _NET_WM_STATE_ABOVE;
#define X11_ATOM_STRING(x) x = XInternAtom(x11, #x, False);
-void _al_xglx_toggle_fullscreen_window(ALLEGRO_DISPLAY *display)
+void _al_xglx_toggle_fullscreen_window(ALLEGRO_DISPLAY *display, bool await_resize)
{
ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver();
ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display;
@@ -941,8 +950,10 @@ void _al_xglx_toggle_fullscreen_window(ALLEGRO_DISPLAY *display)
XSendEvent(x11, DefaultRootWindow(x11), False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev);
-
- _al_display_xglx_await_resize(display);
+
+ if (await_resize) {
+ _al_display_xglx_await_resize(display);
+ }
_al_mutex_unlock(&system->lock);
}