Commit Graph

25 Commits

Author SHA1 Message Date
Hans de Goede
86e62813b3 spicec-x11: Fix modifier keys getting stuck (rhbz#655048)
Currently modifier keys (ctrl, alt) can get stuck when using the x11 client.
To reproduce under gnome:
-focus the client window without causing it to grab the keyborad (click on
 the title bar not the window)
-press crlt + alt + right arrow to switch virtual desktop
-press crlt + alt + left arrow to switch back
-notice ctrl + alt are stuck pressed

What is happening here is:
-We get a focus out event, caused by the hotkey combi key grab, focus event
 notify mode == NotifyGrab, and release all keys -> good
-We get another focus out event, as we really loose the focus.
 notify mode == NotifyWhileGrabbed, which we ignore as we already lost
 focus before
-We get a focus in event, as the focus is returning to us, but we don't
 really have the focus yet, as the hotkey combi key grab is still active
 (ie ctrl + alt are still pressed).
 We now sync the vm's modifier key state with the current X-server state,
 telling the vm ctrl + alt are pressed. Note we do this by directly reading
 the X-server keyboard status, we are not getting any key press events from the
 X-server -> bad
-We get another focus in event, as we really get the focus back,
 notify mode == NotifyUngrab. We ignore this one as already have gained the
 focus before. If we were to sync the vm modifier state here, all would be
 well we would no longer see the modifier keys pressed, or if we would we
 would get a release event when they get released (testing has shown both).

The solution here is to ignore the first focus in event, and do the modifier
sync on the second focus in event, or more in general to ignore focus events
where notify mode == NotifyWhileGrabbed.
2010-11-22 16:09:15 +01:00
Hans de Goede
e0911d1c92 spicec-x11: Add a few missing XLockDisplay calls (rhbz#654265)
The XIM functions end up waiting for a reply from the server, so they
need locking around them. Idem for the XLookupString call.
2010-11-17 12:31:53 +01:00
Hans de Goede
18e6edb93a spicec-x11: Do not set _NET_WM_USER_TIME to 0 on startup
Setting _NET_WM_USER_TIME to 0 means we do not want focus, not good.
2010-10-25 11:36:34 +02:00
Hans de Goede
fa2e125ec4 client: Interpret the title control message as utf8 instead of unicode16
The activex browser plugin is sending unicode16 text, where as the
xpi one is sending utf8 text. After discussing this on irc we've decided
that utf8 is what we want to use. So the client (this patch), and the
activex will be changed to expect resp. send utf8 text as the title.
2010-10-21 13:19:51 +02:00
Hans de Goede
d08b8120d6 spicec-x11: Fix window management under KDE
There were 2 issues with window management under KDE
1) When an app does its own focus management like we do, kwin expects
   an explicit raise for the app to get to the top, so we did have focus,
   but would have other windows (partially) covering the client window
   -> do a raise after setting focus to ourselves
2) When switching from fullscreen <-> window, we unmap and remap our
   window, then set focus to ourselves. kwin thinks this means we're trying
   to steal the focus without the user asking for it. This patch makes us
   set the _NET_WM_USER_TIME property on our window, this helps kwin's
   focus stealing code to see that we are really not stealing the focus,
   just responding to a user event.
2010-10-18 10:40:51 +02:00
Hans de Goede
0b07ca2775 spicec-x11: Change WmSizeHints in fullscreen mode
Some window managers will ignore the fullscreen hint, unless WmSizeHints
allow them to resize the window so that they can give it the size of
the roo-window. This fixes fullscreen mode in compiz.
2010-10-18 10:40:51 +02:00
Hans de Goede
f8c6e1c42a spicec-x11: Put locks around xlib calls which wait for a reply
Since libX11-1.3.4 the multi-threading handling code of libX11 has been
changed, see:
http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=933aee1d5c53b0cc7d608011a29188b594c8d70b

This causes several issues. One of them is the display inside the
client not getting updated when there are no XEvents being generated,
this is caused by the following part of the referenced commit message:

Caveats:
- If one thread is waiting for events and another thread tries to read a reply,
  both will hang until an event arrives. Previously, if this happened it might
  work sometimes, but otherwise would trigger either an assertion failure or
  a permanent hang.

We were depending on the otherwise behavior and apparently were lucky.
This can be seen by starting F14 in runlevel 3 and then doing startx
and not touching the mouse / keyb afterwards. Once you move the mouse
(generate an event you see the UI contents being updated but not before.

Another thing both I and Alon (iirc) have seen are hangs where 2
threads are stuck in XSync waiting for a reply simultaneously. This might
be related to libxcb version, according to the libX11 commit a libxcb
newer then 1.6 was needed, and my system had 1.5 at the time I saw this
after updating to libxcb 1.7 I can no longer reproduce.

This patch tackles both problems (and is needed for the 1st one
indepently of the 2nd one possibly being fixed) by adding XLockDisplay
calls around all libX11 calls which wait for a reply or an event.
2010-10-11 22:36:42 +02:00
Alexander Larsson
cfc1e95bda Make opengl optional, disabled by default
The OpenGL renderer isn't really useful right now, its not quite up
to date, its not really faster than software and it only supports a limited
subset of drivers. So, lets disable it for now.

Long term opengl rendering of the 2d part of spice is important if we want
to combine 2d and 3d rendering (say if spice adds opengl support in the
protocol). But until then this is isn't useful for normal use.
2010-06-21 14:50:18 +02:00
Alexander Larsson
012bd25779 Fix spelling errors in comments and strings 2010-05-21 10:51:28 +02:00
Alexander Larsson
774e5bd36f Client: Support pixmap format conversion in copy_pixels
In order to be able to support 16bit canvases on 32bit screens and 32bit
canvases on 16bit screens we need to handle format conversion when drawing
RedPixmaps.

The way this works now for X11 is that we only have one PIXELS_SOURCE_TYPE
for pixmaps, which always has a pixman_image_t for the data, but additionally
it has an XImage (shared mem or not) if the screen the pixmap was created
for (i.e. an explicit one or the default screen) has the same format as
the pixmap.

When we draw a pixmap on a drawable we have two variants. If the pixmap
has a XImage and it matches the format of the target drawable then we
just X(Shm)PutImage it to the drawable. If the formats differ, then we
create a temporary XImage and convert into that before drawing it to
the screen.

Right now this is a bit inefficient, because we always allocate a new
temporary image when converting. We want to add some caching here, but
at least this lets things work again.
2010-04-23 16:39:13 +02:00
Alexander Larsson
5c2d9a3e32 Add RedDrawable::Format get_format()
This is useful because we can e.g. create pixmaps in the same format as
a window.
2010-04-23 16:36:35 +02:00
Alexander Larsson
9c02d15396 Client: Don't die if XIM not availible 2010-04-23 16:36:31 +02:00
Alexander Larsson
c97116aeb9 Relicense everything from GPL to LGPL 2.1+ 2010-04-13 22:22:15 +02:00
Yonit Halperin
6f40c593e9 client: x11: fix a crash caused by a call to a destroyed window.
Happens when a focused window is destroyed without a focus out event,
and a focus-in event occurs on another window.
2010-04-03 05:55:00 +03:00
Alexander Larsson
0230541af5 Define GL_GLEXT_PROTOTYPES in CFLAGS not in random places in the source 2010-03-10 21:28:47 +01:00
Alexander Larsson
98dde80ed3 Replace custom region implementation with pixman_region32_t
pixman_region32_t is an efficient well tested region implementation (its
the one used in X) that we already depend on via pixman and use in
some places. No need to have a custom region implementation.
2010-02-23 22:52:06 +01:00
Alexander Larsson
16540e9953 Use the new header names
I just ran:
 find -name "*.[ch]" | xargs sed -i -f ../spice-protocol/includes.sed
 find -name "*.cpp" | xargs sed -i -f ../spice-protocol/includes.sed
2010-02-04 18:49:05 +01:00
Alexander Larsson
1f51697852 Rename symbols that were changed in spice-protocol
This is an automatic change using:
$ find -name "*.[ch]" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
$ find -name "*.cpp" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
2010-02-04 18:49:00 +01:00
Arnon Gilboa
ea9af22e62 spice: position mouse in primary monitor center after full screen toggle
-move _focused & _pointer_in_window from RedWindow to RedWindow_p's
-move shadow focus & cursor handling to sync()
-add reset_cursor_pos() to Platform
-Monitor set_mode()/restore() use virtual do_set_mode()/do_restore()
2009-12-30 22:15:02 +02:00
Arnon Gilboa
02a07b2c06 spice: on_activate_screen generates on_key_down for any modifier pressed
-call SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc...) only once, in RedWindow::init()
-add Application::cleanup_globals() & RedWindow::cleanup()
-cleanup LowLevelKeyboardProc()
2009-12-30 22:09:25 +02:00
Yaniv Kamay
6c5966d8ed client: KeyHandler now receive unicode char event in addition to RedKey events 2009-11-30 18:22:13 +02:00
Yaniv Kamay
3b51087b36 client: interactive screen layer 2009-11-30 18:03:35 +02:00
Yonit Halperin
a461f0655f spice client: sticky Alt activation when holding an Alt key: bug #505912.
Additional changes that were required for the feature:
    1) focusing on the pointed window in full screen mode
    2) In X11 - handling events that occur during keyboard ungrabbing
    3) In X11 - handling Leave/Enter Notify events that occur during keyboard grabbing/ungrabbing
    4) In X11 - fix for focus events that are handled in the wrong order (happens when
       focus events occur during grabbing the keyboard)
    5) In X11 - ignoring key release events during key holding
    6) In Windows - synchronizing keyboard release events that occured during a modal loop
2009-11-15 13:41:10 +02:00
Izik Eidus
54cf04beed client: fix colormap handling.
Signed-off-by: Izik Eidus <ieidus@redhat.com>
2009-11-09 22:34:05 +02:00
Yaniv Kamay
c1b79eb035 fresh start 2009-10-14 15:06:41 +02:00