Commit Graph

5242 Commits

Author SHA1 Message Date
Matthias Clasen
acf56b6cb3 wayland: Fix gdk_keymap_translate_keyboard_state
I was confusing indices and masks here, which made the modifier
translation go wrong. With this commit, accelerators work.
2013-04-06 17:03:27 -04:00
Matthias Clasen
1b2711cde2 wayland: Implement gdk_keymap_translate_keyboard_state 2013-04-06 10:48:57 -04:00
Matthias Clasen
eb9ab7aad4 wayland: Fix up key event translation
The is_modifier field is supposed to be set if the key
would act as a modifier, not if any modifiers are currently
active. To fix this, introduce a private
_gdk_wayland_keymap_key_is_modifier function.

At the same time, make the hardware_keycode field in key
events actually contain the hardware keycode, not a copy
of the keyval.
2013-04-06 10:48:57 -04:00
Matthias Clasen
c659f892ff trivial whitespace fix 2013-04-06 10:48:56 -04:00
Matthias Clasen
720ca63c5d wayland: Return NULL as the keyval name for 0
This is what the X11 backend does, and it makes the "NoSymbol"
disappear from menuitems that don't have an accelerator.
2013-04-06 10:48:56 -04:00
Benjamin Otte
ae2208cd5d gdk: Deprecate gdk_display_get_n_screens() 2013-04-06 10:47:55 +02:00
Benjamin Otte
f8b017faa8 x11: Simplify code for single-screen case 2013-04-06 10:47:55 +02:00
Tristan Van Berkom
6a90c48ea6 GdkOffscreenWindow: Implement gdk_window_get_frame_extents()
This avoids crashes in gtk_window_get_position() whenever the GdkWindow
is offscreen.
2013-04-06 17:16:09 +09:00
Alexander Larsson
9a79c3d643 broadway: Unsure we clear the grab on window hide 2013-04-05 17:07:04 +02:00
Alexander Larsson
a6a768437d broadway: Fix warning
Don't pass NULL source_device in grab/ungrab events
2013-04-05 17:07:03 +02:00
Matthias Clasen
cdcc804730 wayland: Implement more keymap functions
This commit implements gdk_keymap_get_entries_for_keyval
and gdk_keymap_lookup_key.
2013-04-05 07:23:00 -04:00
Matthias Clasen
be1e57db1f wayland: Implement gdk_keymap_get_entries_for_keycode 2013-04-05 07:23:00 -04:00
Matthias Clasen
086789d015 wayland: Always initialize directions
I forgot to initialize directionm in gdk_wayland_keymap_new,
leading to crash.
2013-04-04 21:14:53 -04:00
Matthias Clasen
246f32a58d wayland: Emit ::direction-changed when appropriate
We always emit direction-changed when we get a new keymap, but
for state changes, we compare old and new direction and only
emit the signal when the direction actually changes.
2013-04-03 23:52:52 -04:00
Matthias Clasen
2f8f1ef485 wayland: Implement keymap direction
This is very similar to the X11 implementation.
2013-04-03 23:45:54 -04:00
Pavel Vasin
5d9c07a061 wayland: display: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=696767
2013-04-03 19:20:57 -04:00
Alexander Larsson
8084e6e468 broadway: Ensure we allocate shm surface space early
This is nicer then getting random sigbus later
2013-04-03 15:58:42 +02:00
Alexander Larsson
c340dfeaf8 Broadway: Fix shm names
We were sometimes getting zero chars in the name, making them
shorter, due to an off-by-zero in the size.
2013-04-03 15:58:41 +02:00
Alexander Larsson
b7a1561fef broadway: destroy old surface before creating new one
We were not using the old one anyway, and this may in some cases
use less memory (although in most cases the server has a ref to the
surface anyway).
2013-04-03 15:58:40 +02:00
Rob Bradford
000ed99f3d gdkdisplay: Warn if asked for a non-zero screen not a zero screen
Following on from a6b29d73 this commit correctly warn if you try and use
deprecated multiple screen behaviour.
2013-04-02 12:04:22 +01:00
Benjamin Otte
a55f1f4e95 broadway: Mark deprecated function call
... to avoid gcc warning us. Ideally, we'd not call a deprecated
function here, but I'm lazy.
2013-04-02 11:45:44 +02:00
Benjamin Otte
dc132a9895 broadway: Don't use deprecated API 2013-04-02 11:45:44 +02:00
Benjamin Otte
a6b29d73d7 gdkdisplay: Remove get_screen() and get_n_screens() vfuncs 2013-04-02 11:45:44 +02:00
Alexander Larsson
40c3062d33 broadway: Use wss: on https: uris 2013-04-01 17:44:33 +02:00
Benjamin Otte
f73bf26df0 Deprecate gdk_get_display() 2013-04-01 14:20:47 +02:00
Benjamin Otte
cb2c47597e gdk: Shuffle code around
Make implementation, header and documentation be at the correct place.
2013-04-01 14:20:46 +02:00
Benjamin Otte
47a8c2f733 x11: Make display:screen relation 1:1
Only ever open the default screen.

If apps need support for multiple screens, they need to
gdk_display_open() them manually.
2013-04-01 14:20:46 +02:00
Benjamin Otte
e76cb9daca wayland: Remove unused variable 2013-04-01 14:20:46 +02:00
Matthias Clasen
28fab2eea2 Remove an unused filed in GdkWindowImplWayland
The unused toplevel_window_type field was copied over from
the X backend.
2013-03-31 22:46:31 -04:00
Matthias Clasen
cb4cf67a95 Remove an unused field in GdkWindowX11
The toplevel_window_type field was only ever set to -1, and
never used. The actual, used toplevel_window_type field lives
in GdkWindow.
2013-03-31 22:44:59 -04:00
Kristian Høgsberg
4252ac6d6c wayland: Set a wayland-client log handler to print errors we get 2013-03-30 14:20:00 -04:00
Kristian Høgsberg
8886c63a4e wayland: Don't error out on G_IO_HUP until we've read G_IO_IN data
We can get G_IO_HUP and G_IO_IN at the same time, if the compositor writes
data to us and then closes our connection.  Make sure that we dispatch events
always if we have G_IO_IN and then error out if we get G_IO_HUP after that.
2013-03-30 14:20:00 -04:00
Alexander Larsson
e9b8b5c1f0 broadway: Reuse surfaces passed to server
This way we don't have to reopen all the time for pure updates,
and we can immediately unlink the shm file to avoid "leaking" them
on improper shutdown.
2013-03-29 14:09:47 +01:00
Alexander Larsson
c6baa9bc25 broadway: Move surface open to server
This way we can cache the last opened surface
2013-03-29 14:09:47 +01:00
Alexander Larsson
6ef8589a51 broadway: Make chrome work again 2013-03-29 14:09:47 +01:00
Alexander Larsson
8289f4cdc9 broadway: Add support for password authentication 2013-03-29 14:09:47 +01:00
Alexander Larsson
1148a375e5 broadway: Limit window resize based on window geometry 2013-03-29 14:09:47 +01:00
Alexander Larsson
71b4557210 broadway: Sync surface updates with paint clock
We now only update surface data after we have painted. Before we painted
in an idle, which meant we might send black data some times if we e.g.
resized the window and had not painted yet. Also, it means we're updating
less often to the daemon, saving resources.

We still have to queue a flush in the idle for non-draw operations,
otherwise e.g. resize of a toplevel will never be flushed if the clock
is frozen (e.g. during toplevel resize).
2013-03-29 14:09:47 +01:00
Alexander Larsson
a20cb3dd25 broadway: Ensure window sizes are synched right
We don't want to update the window size on configure event, only
the position, as the size is client side controlled. We were
updating to an old size during resizes which causes us to send
surfaces of the wrong size to the daemon.
2013-03-29 14:09:46 +01:00
Alexander Larsson
19e683e62a broadway: Clean up moveresize code 2013-03-29 14:09:46 +01:00
Alexander Larsson
0129876ed3 broadway: Remove leftover cruft that caused resize to fail
getTransientToplevel() doesn't exist anymore so this broke.
2013-03-29 14:09:46 +01:00
Alexander Larsson
e9906138e5 broadway: Fix mouse position typo 2013-03-29 14:09:46 +01:00
Chris Cummins
b8ed3e9ef5 wayland: Implement animatable cursors
Cursor animations are handled on a per-device basis, with
GdkWaylandDevice updating the pointer surface for each frame.

https://bugzilla.gnome.org/show_bug.cgi?id=696429
2013-03-28 10:33:57 -04:00
Chris Cummins
4801977d80 wayland: Do not free wayland cursor buffers
The cursor buffer is only non-null when a cursor is created from pixbuf,
so it is not necessary to keep track of whether to free this buffer on
finalize.
2013-03-28 10:33:57 -04:00
Chris Cummins
c022cbae0d wayland: Differentiate wayland and pixbuf cursors
By keeping a pointer to the wl_cursor struct in GdkWaylandCursor, it is
no longer necessary to duplicate cursor data (width, height, hotspots,
etc.) between wl_cursor and GdkWaylandCursor.
2013-03-28 10:33:57 -04:00
Kristian Rietveld
6f607fc8b4 quartz: move atom/pasteboard type conversions functions to GDK
(cherry picked from commit a269c2f8d2)
2013-03-28 13:10:38 +01:00
Jan Arne Petersen
40c5d37340 docs: Add wayland documentation to Gdk reference 2013-03-27 21:04:05 +01:00
Kristian Høgsberg
abfa4bf0aa wayland: Use the wl_display_sync() request to track pending init roundtrips
Instead of maintaining the init refcount in regular event handlers that can
fire in case of hotplug or mode changes, use a dedicated sync callback
to wait for roundtrips.
2013-03-27 13:44:33 -04:00
Kristian Høgsberg
fc713dffb3 wayland: Pass most recent button press serial to set_popup_surface 2013-03-27 13:39:58 -04:00
Alexander Larsson
9cc64579c2 gdkwindow: Apply layered areas to the shape for native windows
If a window is overlapped by a layered (i.e. partially transparent)
window then that region will not disappear from the native window clip
region. This lets us handle compositing multiple layers of windows.

For native subwindows this doesn't really work. For them we apply the
clip region as a shape to the native window which lets us have client
side windows overlapping the native window. However, with the addition
of the layered stuff the "overlapped-by-alpha-csw" part got broken, as
this area is not removed from the clip region of the native window.

We fix this by also removing the layered area when applying the shape.
This means alpha and alpha backgrounds don't work over native windows,
but there is not much to do about that.

https://bugzilla.gnome.org/show_bug.cgi?id=696370
2013-03-27 12:02:27 +01:00
Alexander Larsson
6374873dcb gdkwindow: Add alpha_bg to window debug print 2013-03-27 12:02:25 +01:00
Matthias Clasen
4987728d7a wayland: Handle seat removal
Also, emit ::device-added and ::device-removed signals
as devices appear and disappear.
2013-03-26 22:57:46 -04:00
Matthias Clasen
28c865b4e2 wayland: Make monitor removal work
The global_removal argument is the _name_ of the object.
We were comparing it to the _object id_ of the object.
To fix this, store the name at the time the object is bound.
2013-03-26 22:16:15 -04:00
Matthias Clasen
ca09a600c3 wayland: Also emit monitors-changed when monitors are unplugged 2013-03-26 21:53:41 -04:00
Matthias Clasen
27e517a445 wayland: Also emit size-changed when appropriate
We need to be a bit more careful when updating the screen
size - the code that was there would not do the right thing
if e.g. the width of one monitor was reduced.
2013-03-26 21:47:49 -04:00
Matthias Clasen
0489fcffbe wayland: Emit monitors-changed when monitors change 2013-03-26 21:37:21 -04:00
Matthias Clasen
93e5d83a9d Don't decrement the init_ref_count towards -infinity
Once we are at zero, initialization is done.
2013-03-26 21:27:21 -04:00
Kristian Høgsberg
abe7dc6bb4 wayland: Set screen size to bounding box of all outputs
Don't hardcode 8192x8192.  We don't get this info from wayland, so we
compute it as we receive information about the available wl_outputs.

https://bugzilla.gnome.org/show_bug.cgi?id=692871
2013-03-26 17:32:15 -04:00
Kristian Høgsberg
a9e980e578 wayland: Roundtrip until we've receive initial input and output configuration
We use a ref-count mechanism to track whether parts of the init sequence
still needs round trips to receive remaining initial state.  Typically
we need a couple of roundtrips total to get the global list, then the
input and output configurations, but with the ref-count we avoid making
global assumptions like that.

https://bugzilla.gnome.org/show_bug.cgi?id=696340
2013-03-26 14:42:16 -04:00
Matthias Clasen
920ee770ea wayland: Add toolbar settings 2013-03-24 20:21:50 -04:00
Jan Arne Petersen
8d884bb4fb wayland: Add support for custom surfaces
Allow to set a GdkWindow to use a custom surface instead of a
wl_shell_surface. It allows to register the surface as a custom type
with some Wayland interface.

https://bugzilla.gnome.org/show_bug.cgi?id=695861
2013-03-24 14:31:51 -04:00
Matthias Clasen
38eab78904 broadway: Don't use deprecated gdk_cursor_ref 2013-03-24 14:22:38 -04:00
Matthias Clasen
48d8af85d0 Make gdk_display_open_default_libgtk_only more robust
Make this function return NULL if GDK could not be
initialized. We check this by seeing if there is a
display manager singleton.
2013-03-23 19:40:16 -04:00
Matthias Clasen
c5d7871eda Add gdk_display_manager_peek
Instead of failing with an error if no GDK backend is found like
gdk_display_manager_get(), the new peek function silently returns
NULL.
2013-03-23 19:39:58 -04:00
Matthias Clasen
97ebaee0e2 wayland: Remove a few unused variables 2013-03-23 18:31:20 -04:00
Matthias Clasen
9182eacadf wayland: Don't recreated keymaps on layout change
The GDK model for keymaps expects the keymap object to stay
around and emit a ::keys-changed signal. So, do that. This
should make layout changes work, but it remains untested since
weston does not support layout changes at runtime.

At the same time, plug a memory leak where GdkWaylandKeymap
forgot to free its xkb objects in finalize.
https://bugzilla.gnome.org/show_bug.cgi?id=696339
2013-03-23 18:04:15 -04:00
Matthias Clasen
c6d95a7bdc wayland: remove an unused variable 2013-03-23 17:29:28 -04:00
Matthias Clasen
a70acc03c5 wayland: Respect keymap repeat information
xkb has a function to tell us whether a key should be repeated
or not. Lets use that information.
2013-03-23 17:29:28 -04:00
Colin Walters
d6b4e84957 gdkkeys: Avoid instantiating a display manager if none exists
For introspection scanning which ends up calling class_init() which in
turn calls into the keybindings code, we can just use the fallback
keyval conversion code.

https://bugzilla.gnome.org/show_bug.cgi?id=696457
2013-03-23 17:07:15 -04:00
Marc-André Lureau
564b4e667a win32: do not crash on invalid utf8 conversion
g_utf8_to_utf16() is not guaranteed to succeed. Check the error
and return if it failed.

https://bugzilla.gnome.org/show_bug.cgi?id=696232
2013-03-23 15:50:09 -04:00
Matthias Clasen
d2c8b65fd9 wayland: Pick up more settings
With this commit, we pick up xft settings from GSettings
as well. Among other things, this makes the Large Text
setting work. Still to do: pick up fontconfig changes without
having all clients use up inotify watches for all font
directories.
2013-03-23 13:02:09 -04:00
Matthias Clasen
ce7c6d58c2 Add gdk_set_allowed_backends
This new function allows programmatic control over the
GDK backends that will be used at runtime.
2013-03-23 00:48:26 -04:00
Matthias Clasen
832c698776 Implement GInitable in GdkBroadwayDisplayManager
Add GInitable implementation and fail the initialisation if it is not
possible to set up a broadway server.
2013-03-23 00:48:25 -04:00
Matthias Clasen
bfcf9e471d Implement GInitable in GdkX11DisplayManager
Add GInitable implementation and fail the initialisation if it is not
possible to connect to the display server.
2013-03-23 00:48:25 -04:00
Thomas Wood
09d0d32af0 wayland: implement GInitable and check the connection to the display server
Add GInitable implementation and fail the initialisation if it is not
possible to connect to the display server.

https://bugzilla.gnome.org/show_bug.cgi?id=694465
2013-03-22 22:25:32 -04:00
Thomas Wood
3a9de35a6c gdk: Implement GInitable on GdkDisplayManager
Add GInitable interface with a default implementation that always
succeeds. This allows backends to override the GInitable implementation
and add their own checks to determine if the backend can be loaded.  If
a backend cannot be loaded, GDK can attempt to load the next available
backend.

Since backends may need to read any relevant options (such as the
display flag) to determine if they can be created successfully, this
patch also removes calls that attempt to create the display manager
before the options have been parsed.

https://bugzilla.gnome.org/show_bug.cgi?id=694465
2013-03-22 22:23:39 -04:00
Matthias Clasen
c61956c592 wayland: Implement cursor theme changing
Add gdk_wayland_display_set_cursor_theme and implement it.
2013-03-22 20:30:51 -04:00
Matthias Clasen
8caf1ae7fd wayland: Respect cursor size setting
Respect the cursor size setting when loading the cursor theme.
2013-03-22 19:32:39 -04:00
Matthias Clasen
3278fb9990 wayland: Add cursor-size setting
This will be picked up by cursor themes soon.
2013-03-22 19:27:36 -04:00
Matthias Clasen
37843faea9 wayland: Avoid segfault when cursors are freed
The check for GDK_CURSOR_IS_PIXMAP was ineffective, since _all_
cursors have this type, from the looks of it. Instead, store
buffer ownership information separately.
2013-03-22 19:09:20 -04:00
Matthias Clasen
cc70ac104d wayland: Emit GdkKeymap::state-changed when appropriate
This makes the caps lock warning in password entries work.
2013-03-22 18:34:44 -04:00
Matthias Clasen
1ea760fbc9 wayland: Make key repeat configurable
These might be candidates for a future settings interface; until
then, we use GSettings directly. Note again that we are careful
to avoid a dependency on GNOME schemas.
2013-03-22 18:26:33 -04:00
Matthias Clasen
659ae5172f wayland: Factor out key repeat parameters
This is in preparation for picking these values up from
existing configuration.
2013-03-22 18:09:23 -04:00
Matthias Clasen
9846a37ee3 wayland: Drop an unused variable
The keymap member in GdkWaylandDisplay is not used at all,
so drop it.
2013-03-22 17:53:28 -04:00
Matthias Clasen
6c191b939d wayland: Fix key repeat
Key repeat under X is not affected by modifiers. And on some systems
(e.g my Thinkpad), NumLock is permanently on, rendering key repeat
nonfunctional. This commit changes the Wayland backend to do
key repeat regardless of modifiers.
http://bugzilla.gnome.org/show_bug.cgi?id=695497
2013-03-22 17:43:50 -04:00
Thomas Hindoe Paaboel Andersen
c5145421af wayland: complete cursor_for_pixbuf
Finishes the implementation for loading cursors from pixbufs.

Gnome bug #696223
2013-03-21 18:00:23 -04:00
Kristian Høgsberg
a80998127c wayland: Clear current cusor on leave so we always set it on enter
Commit 0d9d808217 fixed the hotspot issue,
but commit f2cc52fddd then optimized away
cursor changes a little too aggressively.  We always need to set the
cursor on enter.  Make sure we clear the current cursor on leave so we
don't think it's already set on the next enter.

https://bugzilla.gnome.org/show_bug.cgi?id=695512
2013-03-21 08:54:42 -04:00
Matthias Clasen
5f48934943 Wayland: Read settings out of GSettings directly
Until we figure out where we want to go with settings under
Wayland, this makes GTK+ applications a lot easier to deal
with under Wayland.

Note that we are careful to deal with the absence of schemas,
so this does not introduce a dependency on GNOME settings.
2013-03-21 07:15:59 -04:00
Kristian Høgsberg
f2cc52fddd wayland: Only set cursor when it changes 2013-03-20 22:59:06 -04:00
Kristian Høgsberg
62eb5d0358 wayland: Add a cursor cache
We avoid creating a new GdkCursor object every time
_gdk_wayland_display_get_cursor_for_name/type() is called.
2013-03-20 22:56:50 -04:00
Kristian Høgsberg
0d9d808217 wayland: Use the pointer enter serial when setting cursor surface
wl_pointer.set_cursor is rejected if the serial number doesn't match
the enter serial number for the wl_pointer.  We passed the right serial
number when setting the cursor surface in response to the enter event.
Later set_cursor requests fail, but we can still attach new buffers to
our cursor surface, which is why the cursor changed, but the hotspot
didn't update.  Clicking in the decoration results in a leave/enter pair
which triggers wl_pointer.set_cursor with the right serial. That's why
clicking the decoration sets the right cursor.

https://bugzilla.gnome.org/show_bug.cgi?id=695512
2013-03-20 22:56:43 -04:00
Matthias Clasen
26d3fc311b wayland: Keep hotspot when changing cursors
We need to pass the delta between the old and new hotspot
when attaching the new cursor surface, to keep the hotspot
at the same position. We can't deal with this in the compositor,
since the set_cursor call already overwrites the old hotspot,
so the information is lost by the time the attach happens.
Unfortunately, we can't query the initial hotspot from
the compositor, so the first cursor change will make the
hotspot jump.
https://bugzilla.gnome.org/show_bug.cgi?id=695512
2013-03-20 22:21:15 -04:00
Rob Bradford
1b15b9e1bc wayland: Preserve dimensions separately for fullscreen / maximised case
Use separate fields for saving the window dimensions prior to fullscreening
and maximisation. Then use those fields to restore the window dimensions from.
2013-03-19 19:52:49 +00:00
Scott Moreau
1be7f3dee9 wayland: Implement gdk_window_[un]maximize
This allows the buttons in the decorations to maximise the window.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=695945

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-03-18 15:51:39 +00:00
Alexander Larsson
8fb60cda19 broadway: Fix assert failure
Requests are not limited in size by BroadwayRequest, as
BroadwayRequestTranslation can be of variable size. No need
to copy the request anymore though, because requests are aligned
now.
2013-03-18 16:41:05 +01:00
Alexander Larsson
99cc5758b1 broadway: Ensure broadway request members are 32bit aligned 2013-03-18 16:41:02 +01:00
Scott Moreau
0d2c461720 wayland: Always attach buffer before committing
With recent changes in attach semantics, we always need to attach before
committing. Without this changes to the window contents to not get reflected
in the content of the surface.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-03-18 12:01:55 +00:00
Scott Moreau
50cde3658a wayland: Remove unneeded semicolons
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-03-18 12:01:55 +00:00
Scott Moreau
d8507a3a83 wayland: Remove unused wayland-egl header
This was left over from the work done in commit: d4a9863

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-03-18 12:01:55 +00:00
Scott Moreau
89b1947631 wayland: Set title on shell surfaces to window title
We currently use this information to display the title
string in the window list of the desktop shell.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-03-18 12:01:55 +00:00