Commit Graph

384 Commits

Author SHA1 Message Date
Kristian Høgsberg 1671e1129d window: Add getters for fullscreen and maximized state
This lets us eliminate a bit of redundancy in the clienst where they track
fullscreen state themselves.
2012-10-10 11:36:24 -04:00
Scott Moreau c6a7e4b277 toytoolkit: Don't draw shadows for maximized windows.
Add THEME_FRAME_MAXIMIZED flag so the theming system can know not to draw
shadows for maximized windows. This allows maximized surfaces' content to be
sized and placed in a more expectable fashion.
2012-10-10 11:23:41 -04:00
Jonas Ådahl f77beeb981 window: Initialize workspace state before first roundtrip
The workspace state parameters were initialized after the first
roundtrip. If a workspace manager state event was received during this
roundtrip the state parameters were cleared leaving an incorrect state.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-09 22:47:24 -04:00
U. Artie Eoff 44874d9f02 desktop-shell: destroy data before exiting.
desktop-shell never returned from display_run() since it
was essentially killed when weston exited.  To fix this,
it is necessary to watch for EPOLLHUP in window.c so that
toytoolkit clients will return from display_run() when
weston quits.  This allows for clients to clean up
as needed.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:37:40 -04:00
Tiago Vignatti 6f09338b0f toytoolkit: Process deferred tasks on fifo order instead
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-09-27 21:23:34 -04:00
Pekka Vuorela 4e363d21bb Require mouse release on top of frame button to trigger action
As common UI convention, allows action to be avoided by dragging
outside the button after mouse press.
2012-09-26 11:22:30 -04:00
Pekka Vuorela 6e1e385d51 Protect window callbacks from deleted windows
Calling window_destroy() was able to cause segfault for
callbacks triggering afterwards.
2012-09-26 10:20:32 -04:00
Philipp Brüschweiler 8c9c8fcf6e toytoolkit: supply correct widget in motion_handler callback 2012-09-04 15:56:37 -04:00
Philipp Brüschweiler 067abf67cd workspaces: don't segfault on invalid move_surface_to_workspace request
Also fixes the off-by-one in toytoolkit that exposed the issue.
2012-09-04 15:56:24 -04:00
Jonas Ådahl 14c92ff072 toytoolkit: Implement support for the workspace manager interface
Two buttons are added to the right-click menu of the window frame for
moving a surface either up or down.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-08-31 19:51:53 -04:00
Philipp Brüschweiler bd3f219344 toytoolkit: try multiple names when loading cursors
The correspondence between cursor functions and names of cursors has
never been standardized. As a consequence, each cursor function can be
represented as a cursor with one of several names. Be more robust when
loading cursor by trying all known names that correspond to a cursor.

This should fix https://bugs.freedesktop.org/show_bug.cgi?id=50487
and https://bugs.freedesktop.org/show_bug.cgi?id=52609 a bit more
thoroughly.
2012-08-29 15:06:09 -04:00
Philipp Brüschweiler 5418a904ca toytoolkit: don't ignore resizes with negative width or height
E.g. this can happen when you grab the lower right corner of a window
and move over the top of the window when resizing. In this case, the
changed width is still important and should be acted upon.

https://bugs.freedesktop.org/show_bug.cgi?id=53560
2012-08-16 10:33:56 -04:00
Philipp Brüschweiler 7e0cc54fca toytoolkit: add axis handler 2012-08-14 15:51:13 -04:00
Philipp Brüschweiler b8a8aff357 toytoolkit: remove unused actions from titlebar menu
They were introduced in b3cca0a411
but never actually implemented. Removing them should at least stop
users from wondering if weston is broken.

https://bugs.freedesktop.org/show_bug.cgi?id=52455
2012-08-14 10:17:07 -04:00
Kristian Høgsberg 86adef9d54 window.c: Handle multiple keyboard foci
Keep a count of number of wl_keyboard focus we have instead of
tracking the more recent wl_keyboard.
2012-08-13 22:28:10 -04:00
Christopher Michael ac3e5f2feb Add support in Weston for X cursor themes.
This patch, along with the wayland patch, adds the ability to specify
a cursor theme in the weston.ini file:

[cursors]
theme=THEME_NAME

If specified, than Weston can use a specific X cursor theme for the
pointer. This relies on the 0001-Add-support-for-X-cursor-themes.patch
for wayland.

[krh: edited to use shell section and key name cursor-theme]
2012-08-13 11:12:17 -04:00
Kristian Høgsberg b29798bcab window.c: Rearrange input handlers so they appear in the right order
They were all over the place before, now they appear in protocol order.
2012-08-13 10:01:46 -04:00
Kristian Høgsberg ae27737b28 window.c: Use pointer enter serial for setting cursor 2012-08-01 09:58:22 -04:00
Pekka Paalanen e288a0f415 window: warn on cursor load failure 2012-07-31 22:27:23 -04:00
Kristian Høgsberg 023be102d7 window.c: Set input region after (potentially) adjusting the surface size
Regressed in dd263e546b, spotted by Scott Moreau <oreaus@gmail.com>
2012-07-31 11:59:12 -04:00
Kristian Høgsberg 4fc1535c0a window: Handle Alt-F4 to close windows 2012-07-25 16:35:28 -04:00
Andre Heider 82b4c1bc6b window.c: Remove xkb leftovers 2012-07-25 16:24:49 -04:00
Kristian Høgsberg 67ace20f8e window.c: Add fullscreen handler to keep fullscreen state consistent 2012-07-23 21:56:31 -04:00
Kristian Høgsberg 0e696478a9 Handle new transform argument in wl_output.geometry event 2012-07-22 15:49:57 -04:00
Kristian Høgsberg d3a1965a3d clients: Implement minimum size for toy toolkit clients
We default to setting the minimum size to the initial size.  To set a
different minimum size than the initial size, set the minimum size first
then then initial size.  Good enough for a toy toolkit.

https://bugs.freedesktop.org/show_bug.cgi?id=50263
2012-07-20 11:33:02 -04:00
Ander Conselvan de Oliveira ddca49600f window: Workaround a stuck frame callback on the cursor surface
It is possible that a client loses the focus between receiving a
pointer.enter event and sending a pointer.set_cursor request. In that
case, the cursor surface might not be mapped and the frame callback
requested on it will never trigger.

Work around this by trying to remap the cursor surface whenever there
is a frame callback and the serial for the enter event is higher than
the cursor serial.
2012-07-16 13:35:25 -04:00
Scott Moreau fe89f07e33 toytoolkit: Remove obsolete function window_set_custom(). 2012-07-12 09:18:49 -04:00
Philipp Brüschweiler c547477e27 Remove dead code
window->title is always NULL inside window_create_internal
2012-07-11 15:46:37 -04:00
Kristian Høgsberg dd263e546b window.c: Only set input region when we have a decoration
https://bugs.freedesktop.org/show_bug.cgi?id=50490
2012-07-09 22:23:39 -04:00
Daniel Stone d4756b7955 toytoolkit: Remove redundant XKB free
We already unref these in fini_xkb().

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 18:03:06 -04:00
Martin Olsson 8df662ad87 clients: Silence 2x gcc 4.6.3 "warn_unused_result" compiler warnings
window.c:1173:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
desktop-shell.c:305:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
2012-07-09 17:50:46 -04:00
Martin Olsson 444799adbb clients: Don't leak "menu" on error path in clients/window.c 2012-07-09 17:50:44 -04:00
Kristian Høgsberg 8733b33f9f window.c: Don't allocate proxy manually
With the wayland change to automatically allocate the client side proxy
manually, we can now drop the code (and the FIXME) that did that and just
receive the proxy from the callback arguments.
2012-06-28 22:04:06 -04:00
Kristian Høgsberg 8150b190d6 shell: Take a wl_surface as parent for transient and popup windows 2012-06-27 10:24:22 -04:00
Kristian Høgsberg 962342cb8e shell: Don't make desktop_shell background a wl_shell_surface
We don't gain anything from taking a wl_shell_surface in
desktop_surface.set_background, except making wl_shell_surface
gratuitously dependent on wl_shell.  In shell.c we can also handle
backgrounds in their own background_configure function which simplifies
the mapping and placement logic.
2012-06-26 16:29:53 -04:00
Kristian Høgsberg 11f600d82e window.c: Always set cursor after pointer enter
If the cursor didn't change since last time we had pointer focus we just
wouldn't change it.  But whoever had pointer focus in the mean time could
have changed it, so make sure we always set the cursor after pointer enter.
2012-06-22 10:52:58 -04:00
Kristian Høgsberg f337052a5c window: Add support for the blank cursor 2012-06-20 23:04:41 -04:00
Kristian Høgsberg d3c69c279a window: Stop keyboard repeat when we lose keyboard focus 2012-06-20 22:41:59 -04:00
Kristian Høgsberg 8b19c64146 window: Create timerfd non-blocking
Otherwise we might end up blocking when we reset the timer after the
timerfd poll readable.
2012-06-20 18:00:13 -04:00
Kristian Høgsberg a1627927c7 window: Compute initial window size correctly
We didn't take decoration size into account before.
2012-06-20 17:30:03 -04:00
Kristian Høgsberg bd0cd762bc window: Only repeat key if we still have kb focus 2012-06-20 15:17:18 -04:00
Kristian Høgsberg cf4d244082 window: Add key-repeat to toy toolkit 2012-06-20 14:52:12 -04:00
Ander Conselvan de Oliveira 2a3cd287ef window: Plug leak of shm_surface_data on shm_suface_data_destroy()
This was causing a leak on every frame when using shm buffers.
2012-06-19 11:36:36 -04:00
Daniel Stone a494f1d3f0 Don't segfault clients when cursor isn't found
If we can't find a cursor for whatever reason, don't crash the client in
pointer_surface_frame_callback.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-18 15:09:40 -04:00
Ander Conselvan de Oliveira 80620076fc window: Implement animated cursors (using pointer surfaces)
Since the introduction of pointer.set_cursor(), it is possible for a
client to set the surface containing the pointer image and get frame
callbacks on it thus allowing a clear implementation of animated
cursors.

This also makes the busy cursor hack of using frame callbacks on the
busy surface unnecessary.
2012-06-15 11:03:12 -04:00
Ander Conselvan de Oliveira 37ffc3c14b compositor: Track pointer image protocol change
The request pointer.attach was replaced with pointer.set_cursor that
lets a client set the cursor surface for a given pointer.
2012-06-15 10:59:41 -04:00
Pekka Paalanen 1da1b8f3f1 Rewrite shm buffer file allocation v2
We had duplicated code in many places, using hardcoded paths for
temporary files into more than one path. Some cases did not bother with
O_CLOEXEC, and all hardcoded paths that might not exist.

Add an OS helper function for creating a unique anonymous file with
close-on-exec semantics. The helper uses $XDG_RUNTIME_DIR as the
directory for a file.

This patch unifies the buffer file creation in both Weston and the
clients.

As simple clients are better not linking to libshared, as it would
require e.g. Cairo, they pull the OS compatibility code directly.

Android does not have mkostemp(), so a configure test is added for it,
and a fallback used if it is not available.

Changes in v2:
	remove all the alternate possible directory definitions and use
	XDG_RUNTIME_DIR only, and fail is it is not set.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-06 13:26:30 -04:00
Kristian Høgsberg d56bd908bf shell: Use a busy cursor animation for unresponsive surfaces 2012-06-05 09:58:51 -04:00
Kristian Høgsberg 7cee19778a window.c: Add primitive support for animated cursors
This just adds an entry point to set a specific frame of an animated cursor.
2012-06-04 23:39:04 -04:00
Kristian Høgsberg f33984edea window.c: Set focus widget before calling enter handler
This way input_get_focus_widget() returns the right widget when
called from the enter handler.
2012-06-04 23:36:32 -04:00
Kristian Høgsberg 8591dbf8b5 window.c: Add watch cursor 2012-06-04 16:10:40 -04:00
Kristian Høgsberg 5a4e9ff51b window.c: Drop timestamp argument to input_set_pointer_image()
We need the serial to set a pointer image and we track that internally.
2012-06-04 16:04:07 -04:00
Scott Moreau 9295ce05ab Drop user input detection from text cursor position implementation. 2012-06-04 11:07:54 -04:00
Scott Moreau ae71220fc9 Convert text cursor position protocol to use fixed types. 2012-06-04 11:07:50 -04:00
Daniel Stone b7452fe313 Add support for wl_keyboard::keymap events
These keymap events communicate the keymap from the compositor to the
clients via fd passing, rather than having the clients separately
compile a map.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-01 11:14:51 -04:00
Kristian Høgsberg a4b3d0ede7 window.c: Handle losing selection data source 2012-05-31 23:30:32 -04:00
Daniel Stone 97f685449e clients: Move XKB info from display to input struct
As it does (will) vary per-seat.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:46:30 -04:00
Daniel Stone 2fce4028d6 Convert wl_pointer::axis to wl_fixed_t
To go with the matching protocol change.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:45:25 -04:00
Daniel Stone c9785eacca Use enum wl_keyboard_key_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_keyboard_key_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:43:03 -04:00
Daniel Stone 4dbadb1556 Use enum wl_pointer_button_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:42:47 -04:00
Daniel Stone 351eb61fbc Support wl_keyboard::modifiers event
This event lets the compositor inform clients of the canonical keyboard
modifier/group state.  Make sure we send it at appropriate moments from
the compositor, and listen for it in clients as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:27:47 -04:00
Pekka Paalanen 647f2bfd2a window: add wrapper for EPOLL_CLOEXEC
Android does not have EPOLL_CLOEXEC, so add a fallback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-31 13:53:51 -04:00
Scott Moreau 7a1b32a198 Implement text cursor position protocol.
Here we create a new client/compositor interface in weston to allow
clients to report their x/y cursor position to the compositor. These
values are then used to center the zoom area on this point. This
is useful for everyone, especially people who are visually impaired.
2012-05-31 13:10:22 -04:00
Ander Conselvan de Oliveira 08bcf14903 dnd: implement option for not offering data to other clients
Add option --self-only to dnd client. If this options is passed, the
drag will be started with no data source so that no drag and drop
events are sent to other clients.
2012-05-29 09:58:17 -04:00
Yan Wang a261f7e6dc Weston: Free allocated cursors array when destroying
This array is allocated in create_cursors(). It should be freed in
destroy_cursors().
2012-05-29 09:53:42 -04:00
Ander Conselvan de Oliveira 210eb9d2ba dnd: work around cairo-gl brokenness
If cairo-gl is used, display_create_surface() will create an
wl_egl_window for each surface and this will result in errors if this
surface is used as a source. Also, one can't get a wl_buffer for such
a surface wich led to crashes when trying to do so for the drag icon.

This patch works around both problems by forcing the item and drag icon
surfaces to use shm.
2012-05-25 23:28:59 -04:00
Ander Conselvan de Oliveira dc8c8fce72 window: rename enum pointer_type to cursor_type
This avoids confusion with the pointer devices (struct wl_pointer).
2012-05-25 23:28:54 -04:00
Ander Conselvan de Oliveira d8f527c845 window: track changes in libwayland-cursor api
libwayland-cursor does not provide enum wl_cursor_type anymore so this
brings back enum pointer_type.

This partially revers commit 1042dc15e0.
2012-05-25 23:09:06 -04:00
Tiago Vignatti 82db9d80e6 window: add simple text tooltip handlers
Using set_transient.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-25 22:53:59 -04:00
Kristian Høgsberg f96e6c00d9 Share code to to classify pointer location in frame 2012-05-22 16:38:53 -04:00
Ander Conselvan de Oliveira 1042dc15e0 window: use libwayland-cursor instead of libXcursor 2012-05-22 10:17:34 -04:00
Tiago Vignatti dec76580c4 window: send transient flags over the wire
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-21 12:30:50 -04:00
Daniel Stone 37816df646 Convert wl_input_device to wl_seat (and friends)
wl_input_device has been both renamed and split.  wl_seat is now a
virtual object representing a group of logically related input devices
with related focus.

It now only generates one event: to let clients know that it has new
capabilities.  It takes requests which hand back objects for the
wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all
provide the old input interface, just under different names.

This commit tracks these changes in weston and the clients, as well as
similar renames (e.g. weston_input_device -> weston_seat).  Some other
changes were necessary, e.g. renaming the name for the visible mouse
sprite from 'pointer' to 'cursor' so as to not conflict.

For simplicity, every seat is always exposed with all three interfaces,
although this will change as time goes on.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-16 15:29:06 -04:00
Kristian Høgsberg 5a315bc72d Move cairo-util to shared/ 2012-05-15 22:33:43 -04:00
Kristian Høgsberg 5adb480e60 window: Move frame rendering to cairo-util 2012-05-15 22:25:28 -04:00
Kristian Høgsberg 42abdf5c80 window: Move theme rendering code to cairo-util 2012-05-15 22:14:27 -04:00
Kristian Høgsberg 291c69cf93 window: Move all frame theme related state into new struct theme 2012-05-15 22:12:54 -04:00
Kristian Høgsberg d9931880c5 window: Compute title vertical position based on font extents
We just fudged it before.
2012-05-15 21:52:25 -04:00
Rob Bradford 7507b570c6 window: Store the outputs that the window is on
Using the surface enter/leave events track which outputs the window is on and
store those in a "window_output_list" on the window.

To create this list we define a struct window_output that is the list
relationship between the window and the output.
2012-05-15 13:29:37 -04:00
Scott Moreau f7e498cb89 toytoolkit: Recalculate input region if client has modified it's size.
If a client changes it's width/height values in it's widget resize handler,
the input region will be wrong because of the assumptions toytoolkit makes
in frame_resize_handler(). So far, gears is the only client that does this.
2012-05-14 14:30:01 -04:00
Pekka Paalanen 79b5652de6 window: fix missed xkb API adaptation
Oddly enough, this failed to build on Android, but not otherwise.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-14 10:02:12 -04:00
Kristian Høgsberg 4c3dac9c66 clients: Remove superfluous #includes
In particular window.c and many clients were including glib.h without
using it and without the right cflags.
2012-05-11 16:40:22 -04:00
Kristian Høgsberg bef52d1423 Update to new libxkbcommon API
We no longer depend on xproto, we use xkbcommon keycodes now. Yay!
2012-05-11 11:24:35 -04:00
Martin Minarik 1998b154a7 window.c: frame_button: Maximize, minimize, close, icon buttons in window frame 2012-05-10 16:19:33 -04:00
Kristian Høgsberg 80680c7b75 window.c: Just use float instead of GLfloat, remove GLES2.h include 2012-05-10 14:11:44 -04:00
Dima Ryazanov ff1c2d7914 window: Don't crash if a cursor image failed to load.
Signed-off-by: Dima Ryazanov <dima@gmail.com>
2012-05-09 11:25:11 -04:00
Rafal Mielniczuk 87e4c9354e window: fix check of cursor image load result 2012-05-08 16:22:31 -04:00
Kristian Høgsberg 7016313778 Port Wayland clients to new xkbcommon API
A little different from Daniels initial patch.  We look up the common
modifiers at xkb init time and convert the xkb serialized modifier mask
to our own modifier bitmask.
2012-05-08 15:55:39 -04:00
Daniel Stone 103db7fb56 Convert wire input co-ordinates to fixed-point
To add greater precision when working with transformed surfaces and/or
high-resolution input devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:41:01 -04:00
Daniel Stone b230a7ee58 Convert internal input co-ordinates to GLfloat
Change all client motion handlers to take GLfloat for co-ordinates,
rather than int32_t.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:40:57 -04:00
Ander Conselvan de Oliveira 001de54ea1 window: use only one shm pool for all the cursor images
Cursor images are fairly small and having one pool for each image adds
a lot of unnecessary overhead. Instead, create one large pool and
allocated all cursor images from that.

In order to do that, however, the code that creates shm surface needed
some refactoring. This patch adds a new struct shm_pool that is used
by the cursor and also changes struct window to use it.
2012-05-07 14:44:02 -04:00
Daniel Stone 5d66371743 Change button from int to uint32_t
Since you can't really have a negative button number.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 12:57:11 -04:00
Daniel Stone da5b93c8d7 Change key/button grab bindings to take unsigned state
'state' here meaning 'is it up or down?', obviously.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 12:54:14 -04:00
Ander Conselvan de Oliveira 1493d2ae1c window: use libXcursor for loading pointer images 2012-05-03 10:14:04 -04:00
Kristian Høgsberg 3e0fe5c0df window: Set window title and class 2012-05-02 09:47:55 -04:00
Kristian Høgsberg 407ef64e17 window: Only set toplevel window type if nothing else is set 2012-04-27 17:17:12 -04:00
Casey Dahlin 9074db5d62 Send surface enter/leave events
These new protocol events allow us to tell which outputs a surface is on, and
potentially update where we allocate our buffers from.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
2012-04-20 13:39:40 -04:00
Scott Moreau ff1db4a4f3 Install structuring for ping-pong protocol 2012-04-19 12:50:47 -04:00
Kristian Høgsberg a6c8b0084f window.c: Drop the toolkit grab when we start a compositor grab
We do this right for move and resize, but dnd and popups need the same
treatment.
2012-04-13 12:55:45 -04:00
Kristian Høgsberg f2eb68a921 window: Send serial number in set_popup request 2012-04-13 12:37:19 -04:00