Re: [AD] SF.net SVN: alleg:[13184] allegro/branches/4.9

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2010-04-03, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> Trying to switch to the FULLSCREEN flag I've noticed a small issue. Putting 
> the mouse at the edges of the screen change the mouse cursor to directional 
> arrows for dragging, and sometimes I can get kwin's "expose" like feature to 
> pop up if I put the mouse in the top left corner...
> 
> It was a quick hack and didn't seem to actually work right anyhow, I'll be 
> trying again later.

I spent too much time today trying to get ex_fs_resize working
consistently across machines and WMs.  Not really successful.
Anyway..

I noticed that in ex_fs_resize the mouse cursor can move outside of the
visible screen.  But if I use the xrandr command line utility to set the
screen resolution, the mouse *is* limited to the visible screen.

Now, ex_fs_window seems quite reliable to me, and that's true even if
you use the xrandr command line utility to change the screen resolution.
Press space twice to toggle the fullscreen behaviour, and it fills the
screen correctly, just as it should it was a "proper" fullscreen.

So one way to proceed is to, for now, rely on the xrandr command line
utility to set the screen mode (with the mouse trapping behaviour).
Make ALLEGRO_FULLSCREEN work in the same way as ALLEGRO_FULLSCREEN_WINDOW,
reliably.  Then replicate whatever the xrandr tool does with library
code.

Peter
diff --git a/examples/ex_fs_window.c b/examples/ex_fs_window.c
index 09bbaf7..543cb9c 100644
--- a/examples/ex_fs_window.c
+++ b/examples/ex_fs_window.c
@@ -44,6 +44,14 @@ static void redraw(void)
    al_flip_display();
 }
 
+int res[4][2] = {
+    {640,480},
+    {800,600},
+    {1024,768},
+    {1280,1024}
+};
+int cur_res = 0;
+
 static void run(void)
 {
    ALLEGRO_EVENT event;
@@ -55,6 +63,14 @@ static void run(void)
          else if (event.type == ALLEGRO_EVENT_KEY_DOWN) {
             if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
                quit = true;
+	    else if (event.keyboard.keycode == ALLEGRO_KEY_N) {
+	       char buf[256];
+	       cur_res++;
+	       if (cur_res >= 4)
+		   cur_res = 0;
+	       sprintf(buf, "xrandr -s %dx%d", res[cur_res][0], res[cur_res][1]);
+	       system(buf);
+	    }
             else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) {
                al_toggle_display_flag(ALLEGRO_FULLSCREEN_WINDOW,
                   !(al_get_display_flags() & ALLEGRO_FULLSCREEN_WINDOW));


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/