Re: [AD] RFC - Linux WM Fullscreen Patch

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


Attached xwmfullscreen.c. With this version KDE, Unity and XFCE all work except for alt-tabbing. Need to find out what SDL does to allow that.

On 14-08-07 10:03 AM, Trent Gamblin wrote:
I'm going to see if I can fix those problems first by checking out SDL a
little closer...

----- Original Message -----
From: "Trent Gamblin" <trent@xxxxxxxxxx>
To: "Allegro Development" <alleg-developers@xxxxxxxxxx>
Sent: Thursday, August 07, 2014 9:43 AM
Subject: Re: [AD] RFC - Linux WM Fullscreen Patch


Virtual fullscreen is supposed to create the display using the window
manager to create a fullscreen window in a different way than "fullscreen
window". If we could figure out why KDE shifts the window up and XFCE the
window doesn't cover the panel, then it would be the best option (of
course
we'd then have to add a properly scaled buffer as you said.)

----- Original Message -----
From: "SiegeLordEx" <slabode@xxxxxxxxxx>
To: <alleg-developers@xxxxxxxxxx>
Sent: Thursday, August 07, 2014 9:35 AM
Subject: Re: [AD] RFC - Linux WM Fullscreen Patch


Apologies if this is obvious from the patch (I still only glanced at
it), but I was under the impression that 'virtual fullscreen' was merely
'fullscreen window' with some letter-boxing transformations? If so, why
is there a difference between the two?

If there is a difference, does the 'virtual fullscreen' work all the
time without compositing too?

-SL

On 08/07/2014 11:25 AM, Trent Gamblin wrote:
Ok. I've already decided yesterday I'll probably abandon this patch
anyway,
but if it's possible and worthwhile to fix who knows.

The problem is with all three fullscreen types there are problems on
Linux.

1) Real fullscreen
KDE: shifted to top left corner
Unity: Needs CCSM installed and switch toggled
XFCE: works

2) Fullscreen window
KDE: Hangs the entire system
Unity: Can't alt-tab out
XFCE: works

3) Virtual fullscreen
KDE: shifted up about 20 pixels
Unity: works
XFCE: works sometimes depending on panel positions

It's freaking disgusting. The only thing that actually works is if you
disable compositing, then fullscreen window basically works.

----- Original Message -----
From: "SiegeLordEx" <slabode@xxxxxxxxxx>
To: <alleg-developers@xxxxxxxxxx>
Sent: Thursday, August 07, 2014 9:19 AM
Subject: Re: [AD] RFC - Linux WM Fullscreen Patch


On 08/07/2014 11:12 AM, SiegeLordEx wrote:
On 08/07/2014 10:52 AM, Trent Gamblin wrote:
Primitives and transforms have always been different for me. Paul,
what's the reason behind this? For example scaling everything up
still
results in crisp lines etc?
Of course it does, primitives are drawn using polygons and they are
going to use screen pixels (i.e. the actual resolution). It's
impossible
to emulate a scaled mode setting with transformations with respect to
how the primitives are drawn.

That's why you always use an intermediate bitmap that you then scale
up
if you want large pixels with your primitives. If you really want a
virtual mode in Allegro, that is the method you need to use.

-SL

I should note that this is not unique to primitives, since bitmaps are
drawn using polygons as well. E.g. drawing a bitmap at fractional
coordinates will look different on a virtual fullscreen and a real
mode.
This is even more easily seen with rotated bitmaps.

-SL

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk

#include <X11/Xlib.h>

#include "allegro5/allegro.h"
#include "allegro5/internal/aintern_x.h"
#include "allegro5/internal/aintern_xdisplay.h"
#include "allegro5/internal/aintern_xfullscreen.h"
#include "allegro5/internal/aintern_xsystem.h"

#include <X11/Xatom.h>

ALLEGRO_DEBUG_CHANNEL("display")

#define _NET_WM_STATE_REMOVE    0l
#define _NET_WM_STATE_ADD       1l
#define _NET_WM_STATE_TOGGLE    2l

#define GET_ATOM(X) XInternAtom(display, #X, False)

bool x_set_fullscreen_via_net_wm(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d)
{
   Display *display = s->x11display;

   Atom _NET_WM_STATE = GET_ATOM(_NET_WM_STATE);
   Atom _NET_WM_STATE_FOCUSED = GET_ATOM(_NET_WM_STATE_FOCUSED);
   Atom _NET_WM_STATE_MAXIMIZED_VERT = GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT);
   Atom _NET_WM_STATE_MAXIMIZED_HORZ = GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ);
   Atom _NET_WM_STATE_FULLSCREEN = GET_ATOM(_NET_WM_STATE_FULLSCREEN);

   Atom atoms[4];

   atoms[0] = _NET_WM_STATE_FOCUSED;
   atoms[1] = _NET_WM_STATE_MAXIMIZED_VERT;
   atoms[2] = _NET_WM_STATE_MAXIMIZED_HORZ;
   atoms[3] = _NET_WM_STATE_FULLSCREEN;

   XChangeProperty(display, d->window, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *)atoms, 4);

   XFlush(display);

   return true;
}

bool x_have_net_supporting_wm(Display *display)
{
   Atom _NET_SUPPORTING_WM_CHECK;
   int status, real_format;
   Atom real_type;
   unsigned long items_read = 0, items_left = 0;
   unsigned char *propdata = NULL;
   Window wm_window = 0;

   XSync(display, False);

   _NET_SUPPORTING_WM_CHECK = XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", False);
   status = XGetWindowProperty(display, DefaultRootWindow(display), _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
   if (status == Success) {
      if (items_read) {
         wm_window = ((Window*)propdata)[0];
      }
      if (propdata) {
         XFree(propdata);
         propdata = NULL;
      }
   }

   if (wm_window) {
      status = XGetWindowProperty(display, wm_window, _NET_SUPPORTING_WM_CHECK, 0L, 1L, False, XA_WINDOW, &real_type, &real_format, &items_read, &items_left, &propdata);
      if (status != Success || !items_read || wm_window != ((Window*)propdata)[0]) {
         wm_window = None;
      }
      if (status == Success && propdata) {
         XFree(propdata);
         propdata = NULL;
      }
   }

   XSync(display, False);

   if (!wm_window) {
      return false;
   }

   return true;
}



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