Skip to content
This repository

Dropsdl #1175

Closed
wants to merge 25 commits into from

6 participants

Joakim Plate Cory Fields Matthias Kortstiege Rainer Hochecker Memphiz Martijn Kaijser
Joakim Plate
Collaborator
elupus commented July 17, 2012

This pull request rids us of SDL for events and window system.

I'm a bit hesitant to the fix for separate screen's. It get a bit messy with extending resolution structure for this. Wasn't sure what the call the value also it's still broken since it need a skin refresh since we apparently have not implemented OnDeviceReset() callbacks on GLX systems.

This tries to replace #848, but it isn't fully complete. So @FernetMenta may have to re-add anything that i've missed.

It clearly need testing.

Cory Fields
Owner
theuni commented July 17, 2012

Nice! Drop it from the tallest building... :)

(Only glanced through it, not qualified to comment on the X stuff)

Matthias Kortstiege
Collaborator
vdrfan commented July 18, 2012

There's a problem with the title and icon here. Within the task-switcher (alt-tab) the title is "unkown" and no icon is shown. Maybe its a gnome-shell issue, not sure yet.

Joakim Plate
Collaborator
elupus commented July 18, 2012
Matthias Kortstiege
Collaborator
vdrfan commented July 18, 2012

That's odd :)

Rainer Hochecker
Collaborator

There's a couple of things obviously got broken. e.g.

  • toggle full screen, can't size window in horizontal direction
  • XBMC icon broken: caused by a change in CTexture
  • minimize window: alt-tab: XBMC stays in background instead of getting minimized

A couple of others which I had already fixed:

  • listen to external xrandr events and take action: consider a user who starts XBMC, then turns on an av receiver or projector. This version does not update resolutions and can't switch to the new output
  • gui corruption on AMD is back. The correct sequence is to first change resolution, then refresh window on xrandr event. There was a reason why I re-created the window on this event.
  • It must be distinguished between systems running a window manager and systems which do not. If no WM is present the redirect_override flag has to be set instead of dealing with NET_WM*. Not doing this can decrease performance on NVdias ystems running vdpau.
  • I don't see the patch for the screensaver, If the scrren has switched off due to inactivity XBMC won't be able to activate the screen again.

I'm a bit hesitant to the fix for separate screen's.

This is the use case which is even more likely than having a single screen. On NVidia systems you get tearing when having two monitors connected to a single screen.

It get a bit messy with extending resolution structure for this

Why? No need to load resolutions of a screen where XBMC is not displayed.

Joakim Plate
Collaborator
elupus commented July 18, 2012
Rainer Hochecker
Collaborator

Don't have time to answer the other points, but this I know for sure as it was tested and proved. Weird but this is like it works in reality. (There are a couple of hundred users tested this already and I collected feedback)

A tester:

Finally:
"swa.override_redirect = False;" gives many drops, how describes above.

"swa.override_redirect = fullscreen ? True : False;" gives smooth picture in fullscreen.

I tested twice.

Joakim Plate
Collaborator
elupus commented July 18, 2012
Rainer Hochecker
Collaborator

Right. He is using a windowmanager, which is redirecting even fullscreen windows. (many do). So we might have to go that route for all situation. I was just saying that it would not make sense to only do it for the non windowmanager case. It's the with windowmanager case that is problematic.

No, he was no WM (OpenElec). I have solved it by detecting the presents of a WM with this function:
FernetMenta@02289bb

BTW: setting the overrive_redirect flag when a WM is present (like KDE), then it kills performance in that case.

Rainer Hochecker
Collaborator

Testing on Ubuntu 12.04 with Unity and Fluxbox:

1)
toggle full-screen:
Unity:
When switching to windowed mode XBMC is horizontally stretched, docked at the menu bar and to the right border of the screen. I can resize and move the window only in vertical direction.
Fluxbox:
The origin of XBMC is outside the visible area of the screen, somewhere behind the upper left. I can resize the window in both direction but not move because the title bar is outside the screen.

2)
alt-tab
This is not working when XBMC is full-screen. When hitting alt-tab XBMC becomes the wall paper in the background. Same behavior on Unity and Fluxbox.

Because that is not how all other arches work. I don't mind changing it, but it must be done for all arches. I don't want a bunch of special cases for X11.

Different architectures have different functions and terminology. Why confusing the user with naming an output a screen just for the sake it is called a screen on a different platform.

xbmc/windowing/WinEventsX11.cpp
((447 lines not shown))
  447
+            {
  448
+              break;
  449
+            }
  450
+
  451
+            for (unsigned int i = 0; i < keys.length() - 1; i++)
  452
+            {
  453
+              newEvent.key.keysym.sym = XBMCK_UNKNOWN;
  454
+              newEvent.key.keysym.unicode = keys[i];
  455
+              newEvent.key.state = xevent.xkey.state;
  456
+              newEvent.key.type = xevent.xkey.type;
  457
+              ret |= ProcessKey(newEvent, 500);
  458
+            }
  459
+            if (keys.length() > 0)
  460
+            {
  461
+              newEvent.key.keysym.scancode = xevent.xkey.keycode;
  462
+              xkeysym = XLookupKeysym(&xevent.xkey, 0);
6
Joakim Plate Collaborator
elupus added a note July 19, 2012

@FernetMenta Could you explain this? Shouldn't Xutf8LookupString should have filled this in earilier?

Rainer Hochecker Collaborator
FernetMenta added a note July 19, 2012

That's what I have expected too in the first iteration but it broke behavior to what we had with SDL. SDL calls a depreciated function at this place: XKeycodeToKeysym. So I replaced this with XLookupKeysym.
The problem was key combinations like ctrl-s or ctrt-S. Without XLookupKeysym the character was always recognized as lower case (or upper case, don't remember exactly. So user defined keycodes in keyboard.xml were broken.

Joakim Plate Collaborator
elupus added a note July 19, 2012

So we never want to use what Xutf8... has returned then? Ie i can move that call to right after with a comment?

Rainer Hochecker Collaborator
FernetMenta added a note July 19, 2012

We want to use the string we get from Xutf8... but not the keysym

Joakim Plate Collaborator
elupus added a note July 19, 2012
Rainer Hochecker Collaborator
FernetMenta added a note July 19, 2012

Sorry, didn't get this right. Sounds like a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Joakim Plate
Collaborator
elupus commented July 22, 2012

some further along. i've hooked up running xbmc with override_redirect when run as standalone. it's really messy to use since you have to handle input focus yourself.

It should be possible to only use override_redirect in fullscreen only, like was done before. That might be for the best since so many window manager are slow otherwise.

Rainer Hochecker
Collaborator

Not sure if the issues mentioned above are supposed to be fixed. alt-tab and toggle fullscreen do still not work.

Joakim Plate
Collaborator
elupus commented July 26, 2012

I assume you where not running standalone? (that is broken in this anyway). What window manager where you using? cause i don't even get that keypress when running under unity. it swallows it and handles it itself.

Rainer Hochecker
Collaborator

I tested on Ubuntu 12.04 with Unity 2D and Fluxbox. Still the same behavior as described above.

Matthias Kortstiege
Collaborator

What's the status here? Are we going to drop SDL before frodo?

Joakim Plate
Collaborator
and others added some commits May 20, 2012
Rainer Hochecker X11: add SDL joystick until we have a better solution 9aef2c8
Rainer Hochecker X11: Add xbmc icon
This does not take icon transparancy into account, so
could look weird.
0a51b45
Joakim Plate X11: factor out code that reset device after lost 5b6caeb
Joakim Plate X11: move handling of xrandr events 18311d8
Joakim Plate X11: support multiple xserver screens c7c6cb2
Joakim Plate X11: support multiple xrandr displays 0b80d65
Joakim Plate X11: replace SDL window and event handling with native xlib 25decc3
Joakim Plate X11: simplify set and reset of locale 886280b
Joakim Plate X11: XWMHints must be allocated by XAllocVMHints since it can be exte…
…nded
d33967f
Rainer Hochecker add missing keys to xbmc keytable a9f2e95
Joakim Plate X11: support rotated screens. fd0e37a
Joakim Plate [win32] move m_nScreen windowing variable to only system using it. 4988dbd
Joakim Plate X11: re-evaluate vsync method after having modified window
It could have moved between outputs on different hardware
bfef61d
Joakim Plate x11: refactor WinEventsX11 to be a singleton class
Also
X11: fix mixup of what XBMC_KeyboardEvent state/type should contain
X11: allow fallback to XLookupString to also support long strings
b87b5ff
Joakim Plate X11 (squash): don't resize window after (full)screen switch if we hav…
…e wm

Resizing can trigger VM to set window as maximized or other.
5dee1c7
Joakim Plate X11: use override_redirect if window manager doesn't support full scr…
…een or standalone
daa9d27
Joakim Plate X11: make sure we set resolution before we create window
Unity messes up on resolution switches and fails to re-fullscreen
937edd9
Joakim Plate debug stuff 99e7201
Joakim Plate squash into drop sdl 9aa3f92
Joakim Plate
Collaborator

So rebased, not all squashed together yet. I'm not fully happy with it yet, but @FernetMenta would be nice with some testing and feedback on what works and what doesn't.

It should now detect if we have a window manager that support fullscreen. If not it uses override_redirect. It will also switch to that if you run it with --standalone switch.

Joakim Plate
Collaborator

Some known things I've not resolved yet.
1. Alt+tab when override redirect is used (we must handle Window switches ourselves)
2. Switching between x11 screen lead to loss of textures. I wonder if one can avoid the texture loss by moving the Window without recreating it. It aught to work for when both are in same gfx at least.

Cory Fields
Owner

@elupus worth mentioning that i'm in the middle of a complete rewrite for egl, which will be followed by a rewrite of rendering. The goal is to get a clean abstraction where everything is dynamic as possible, meaning that you could run the same binary on X, wayland, fbdev, etc, and switch between gl/gles/directfb/etc all on the fly.

I'm getting reasonably far along, I'll push it up somewhere once it runs on a few platforms.

I don't think it's directly relevant here (except for the egl+X case), but I figured I'd throw it out there.

Cory Fields
Owner

Whew, I wrote my comment, then like a genius hit the green 'merge pull request' button. Thanks for making me verify, Github!

Rainer Hochecker
Collaborator

Toggle full screen and minimize do not work on my system. Will investigate ...

Joakim Plate
Collaborator
Rainer Hochecker
Collaborator

I had to fix a compile error in WinEventsX11: CApplicationMessenger.

When started in windowed mode togglefullscreen works, it does not the other way round. It becomes windowed but with size of full screen. No chance to resize then.

Joakim Plate
Collaborator

Hehe, i thought you actually did merge it :)

Joakim Plate
Collaborator

Right.. that would mean that our resolution setup for windowed is getting b0rk some where. it should be respecting that.

xbmc/windowing/WinEventsX11.cpp
((734 lines not shown))
  734
+        return true;
  735
+
  736
+      default:
  737
+        return false;
  738
+    }
  739
+  }
  740
+  return false;
  741
+}
  742
+
  743
+bool CWinEventsX11::ProcessKeyRepeat()
  744
+{
  745
+  if (WinEvents && (m_lastKey.type == XBMC_KEYDOWN))
  746
+  {
  747
+    if (m_repeatKeyTimeout.IsTimePast())
  748
+    {
  749
+      return ProcessKey(m_lastKey, 10);
3
Rainer Hochecker Collaborator

Should we set this to 100ms and/or make it configurable by advancedsettings? I see no reason why this is 10ms. MCE remotes registered as keyboards don't work that well.

Joakim Plate Collaborator
elupus added a note September 23, 2012

I have found some code that actually uses the X11 key-repeats instead of generating them ourselves. I think that is much better.

Joakim Plate Collaborator
elupus added a note September 23, 2012

Check the ProcessKeyRelease. That will ignore keyup's that are actually key repeats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Memphiz
Owner

The problem is not the green button - its the blue one afterwards ;)

Rainer Hochecker
Collaborator

Right.. that would mean that our resolution setup for windowed is getting b0rk some where. it should be respecting that.

resolution is ok, it just gets not set. SetFullScreen just resets NET_WM_STATE_FULLSCREEN without doing a ResizeWindow.

added some commits September 23, 2012
Joakim Plate X11: real XConfigureEvents have position relative parent 0ac9a81
Joakim Plate squash fix compile error 2e2db91
Joakim Plate squash somewhere
Don't re-write left/top in fullscreen since that is only way of
knowing normal window size.
8b33140
Joakim Plate X11: create _NET_WM_STATE_FULLSCREEN windows with windowed size
Window manager uses created size to store original size before going
fullscreen. This makes it possible to restore size after fullscreen
again.
f51b37d
Joakim Plate
Collaborator

The problem was that the WM uses the XCreateWindow size when it restores from fullscreen. So we must create the window with a windowed size, and let the WM do it fullscreening job

Joakim Plate
Collaborator

Could you try with mce remotes now and see if it works allright?

Rainer Hochecker
Collaborator

ToggleFullScreen still does not work on my system. Ubuntu 12.04 with Ubuntu 2D. Window width/height is always 1855x1056 when switching from fullscreen to windowed (starting xbmc fullscreen).
The window attributes seem to be unreliable. Why not explicitly resize the window when entering windowed mode?

Rainer Hochecker
Collaborator

MCE remote seems to work fine.

Joakim Plate
Collaborator
Rainer Hochecker
Collaborator

I remember I had trouble with that too. Once fullscreen I found no reliable way to get back in windowed mode and ended up in recreating the window. SDL used 3 windows, mapped/unmapped the fullscreen and wm window, and reparented the gl window. I preferred to have a single window.

Martijn Kaijser

see #3505

Martijn Kaijser MartijnKaijser closed this October 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 25 unique commits by 2 authors.

Sep 22, 2012
Rainer Hochecker X11: add SDL joystick until we have a better solution 9aef2c8
Rainer Hochecker X11: Add xbmc icon
This does not take icon transparancy into account, so
could look weird.
0a51b45
Joakim Plate X11: factor out code that reset device after lost 5b6caeb
Joakim Plate X11: move handling of xrandr events 18311d8
Joakim Plate X11: support multiple xserver screens c7c6cb2
Joakim Plate X11: support multiple xrandr displays 0b80d65
Joakim Plate X11: replace SDL window and event handling with native xlib 25decc3
Joakim Plate X11: simplify set and reset of locale 886280b
Joakim Plate X11: XWMHints must be allocated by XAllocVMHints since it can be exte…
…nded
d33967f
Rainer Hochecker add missing keys to xbmc keytable a9f2e95
Joakim Plate X11: support rotated screens. fd0e37a
Joakim Plate [win32] move m_nScreen windowing variable to only system using it. 4988dbd
Joakim Plate X11: re-evaluate vsync method after having modified window
It could have moved between outputs on different hardware
bfef61d
Joakim Plate x11: refactor WinEventsX11 to be a singleton class
Also
X11: fix mixup of what XBMC_KeyboardEvent state/type should contain
X11: allow fallback to XLookupString to also support long strings
b87b5ff
Joakim Plate X11 (squash): don't resize window after (full)screen switch if we hav…
…e wm

Resizing can trigger VM to set window as maximized or other.
5dee1c7
Joakim Plate X11: use override_redirect if window manager doesn't support full scr…
…een or standalone
daa9d27
Joakim Plate X11: make sure we set resolution before we create window
Unity messes up on resolution switches and fails to re-fullscreen
937edd9
Joakim Plate debug stuff 99e7201
Joakim Plate squash into drop sdl 9aa3f92
Sep 23, 2012
Joakim Plate X11: real XConfigureEvents have position relative parent 0ac9a81
Joakim Plate squash fix compile error 2e2db91
Joakim Plate squash somewhere
Don't re-write left/top in fullscreen since that is only way of
knowing normal window size.
8b33140
Joakim Plate X11: create _NET_WM_STATE_FULLSCREEN windows with windowed size
Window manager uses created size to store original size before going
fullscreen. This makes it possible to restore size after fullscreen
again.
f51b37d
Joakim Plate X11: use xserver defined key repeat instead of internal 58fd64b
Joakim Plate squash: must do refresh window after setting fullscreen flag 9e6bcd0
Something went wrong with that request. Please try again.