Commit Graph

1104 Commits

Author SHA1 Message Date
Jan Arne Petersen
4653531e7a text: add pre-edit styling support to protocol
Also add a separate preedit-cursor event and add a commit argument to
preedit-string to allow to support commit on reset. Fix editor and
keyboard example to adapt to the protocol changes.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 16:55:27 -05:00
Kristian Høgsberg
e994eddafc window.c: Don't allow moving a maximized window
Ideally the shell would send an unmaximize event to the client when
we try to move a maximized window, but for now, let's just prevent
moving maximized windows.

https://bugs.freedesktop.org/show_bug.cgi?id=56296
2013-02-14 16:31:42 -05:00
Pekka Paalanen
0c4445ba57 window: create Cairo surfaces on demand for redraw
This introduces the function widget_cairo_create().

Instead of directly referencing surface->cairo_surface, use the function
widget_cairo_create(), which will create the cairo_surface as necessary,
and just returns a Cairo drawing context. Also fix window_get_surface()
similarly.

Now we can go through idle_redraw() without always creating Cairo
surfaces and committing them. This will be useful with sub-surfaces,
where repainting one sub-surface does not need to force the repaint of
all surfaces of a window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:35:14 -05:00
Pekka Paalanen
0a9686f51c window: let menu and tooltip redraw use widget size
Menu and tooltip redraw functions were using the surface size directly.
For consistency, make them use the widget size instead, it is the same.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:45 -05:00
Pekka Paalanen
61e028c953 window: remove the transparent flag as unused
This flag was always true, and never false.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:31 -05:00
Pekka Paalanen
89dee00e5e window: move cairo_surface into struct surface
Widgets should be rendering to a cairo_surface for a particular
wl_surface, just like buffers are per surface.

window_flush() has a change in behaviour: it will now send
wl_shell_surface.set_toplevel also without a cairo_surface to be
attached. This shouldn't change anything in practice.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:22 -05:00
Pekka Paalanen
2d8a32a9e4 window: add surface pointer to widget
So that given a widget, we can access the surface specific data, like
buffers, and input and opaque regions.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:03 -05:00
Pekka Paalanen
b1cd9b17bf window: move input and opaque regions into struct surface
They are per wl_surface state.

The frame widget is always on the main surface, since it can be created
only for the window. That is why frame_resize_handler() can simply
assume that the surface is the main_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:33:48 -05:00
Pekka Paalanen
ac95f3ee9d window: move 'widget' member into struct surface
Repaint and resizing widget recursions must start from the root widget
of each (sub-)surface, so that buffers and regions get initialized
correctly. Make it easier by moving the widget field from struct window
to struct surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:33:30 -05:00
Pekka Paalanen
7bcfeade53 window: assimilate window_get_resize_dx_dy() into the call site
Not used elsewhere, just cleanup.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:33:11 -05:00
Pekka Paalanen
02bba7ceb0 window: move buffer type and transform into struct surface
These are surface specifics, since buffers are surface specific.

SURFACE_HINT_RESIZE is moved together to the other SURFACE_* flags, so
that surface_create_surface() would not need two flags arguments.
struct toysurface::prepare vfunc checks for SURFACE_HINT_RESIZE, and
egl_window_surface_create() and shm_surface_create() check for the
non-HINT flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:32:49 -05:00
Pekka Paalanen
811ec4ff31 window: move toysurface and allocation to struct surface
Fields 'allocation' and 'server_allocation' are surface specific. Fields
'saved_allocation', 'min_allocation', and 'pending_allocation' are
window specific, and will not be moved.

Field 'toysurface' is naturally surface specific, since it provides the
backing storage for the wl_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:30:27 -05:00
Pekka Paalanen
4e37374875 window: create new struct surface with wl_surface
Struct window has many fields that are directly related to the
wl_surface, more than to the window as a whole. When we start composing
a window from several wl_surfaces, these fields need to be per
wl_surface, not per window.

Start separating such fields from struct window into struct surface by
moving the wl_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:30:04 -05:00
Pekka Paalanen
550d66bcb1 window: destroy the 2nd shm buffer, if both released
Handle the case when we the compositor somehow migrates from requiring
double buffering into working on single buffering, so we release the
extra shm buffer.

Currently, I do not think this can happen in practice, but in the future
it may happen with sub-surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:28:42 -05:00
Pekka Paalanen
33a68eaaf4 window: check the initial wl_display_dispatch()
Check for errors in the first wl_display_dispatch() call. Otherwise
doing something silly like
  $ WAYLAND_SOCKET=999 ./clickdot
will segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:25:30 -05:00
Pekka Paalanen
4e1065491b window: improve EGL-related error messages
Make them explicitly mention EGL, otherwise one can easily think that
"failed to initialize display" refers to Wayland display.

Also explicitly mention falling back to wl_shm. I tested this with a
LD_PRELOAD trick that overrides eglBindAPI and makes it fail.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:16:20 -05:00
Kristian Høgsberg
c4a42ca6b5 screenshot: Print warning if we're not launched from weston
weston-screenshooter is a helper binary that weston launches to write the
screenshot to disk.  If somebody tries to launch it by hand, print a
warning and mention the screenshot keybinding.
2013-02-13 13:41:07 -05:00
Kristian Høgsberg
15336e8b5c toytoolkit: Remove left-over pixman dependency
toytoolkit doesn't use pixman.  Remove the pixman.h include and the
LDADD.

https://bugs.freedesktop.org/show_bug.cgi?id=57812
2013-01-28 16:05:06 -05:00
Kristian Høgsberg
78fd32b7a2 clients: Make libtoytoolkit a libtool library
This way libtool will remember the libtoytoolkit LIBADD libraries.
We can drop the toolkit_libs hack and just link to libtoytoolkit.la and
libtool will add the dependencies.
2013-01-28 16:02:04 -05:00
Dima Ryazanov
d20fd4db60 terminal: Handle the window close event
There may be multiple windows open, so destroy the terminal instead of exiting.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2013-01-28 12:26:54 -05:00
Pekka Paalanen
0eab05d2a7 clients: add global_remove handler stubs
All the clients here were missing the global_remove handler. Because
window.c did not have it, weston-desktop-shell and weston-keyboard
segfaulted on compositor exit, as they received some
wl_registry.global_remove events.

Add more or less stub global_remove handlers, so that clients do not
crash on such events. Toytoolkit and all applications would need a lot
more code to properly handle the global object removal.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-01-24 16:42:38 -05:00
Rob Bradford
409f79a2c7 image: Free allocated memory on error path 2013-01-10 16:07:23 -05:00
Rob Bradford
f0a1af9f02 window: Free allocated memory on error path 2013-01-10 16:07:18 -05:00
Kristian Høgsberg
4e51b44c53 window: Fall back to cairo image when cairo EGL isn't available 2013-01-07 15:47:47 -05:00
Ander Conselvan de Oliveira
b77aa062c9 transformed: Add options for using debuging driver fullscreen method
Add options for setting width, height and using the driver fullscreen
method.
2012-12-14 11:27:38 -05:00
Ander Conselvan de Oliveira
5403f5274d window: Allow clients to choose the fullscreen method 2012-12-14 11:27:34 -05:00
Kristian Høgsberg
038b9dc8ec clients: Add screenshooter-client-protocol.h to screenshooter sources 2012-12-14 10:18:39 -05:00
Pekka Paalanen
c660821918 update git ignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:38:45 -05:00
Kristian Høgsberg
bc2312c7c6 simple-egl: Remove old obsolete fbo and color_rbo fields
Finally a commit that actually makes simple-egl simpler.
2012-12-11 15:23:22 -05:00
Kristian Høgsberg
3a8d3f2e98 Link matrix.c into weston again
We want to make sure that the matrix symbols are exported from weston and
that modules get them from there.  To do that, we pull matrix.[ch] out of
libshared and back into weston.  calibrator now also links to matrix.[ch]
and we add a IN_WESTON define to enable the WL_EXPORT macro when compiled
inside weston.
2012-12-07 15:00:36 -05:00
Pekka Paalanen
4dd0c412db window: add a note about freeing shm buffers
After a client has been double-buffering, and then switches to
single-buffering, it should release the 2nd buffer. That never happens
in practice here, so just add a comment and a check in case it ever
occurs in the future.

If we implemented the releasing now, it would be difficult to test.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 17:02:13 -05:00
Pekka Paalanen
aac1c13332 clients: destroy wl_registry on exit
Plug an insignificant memory leak in demo programs that bother to clean
up at all.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 17:02:00 -05:00
Rob Bradford
bf33b1cced clients: Add a touchscreen calibration tool
This a basic calibration tool designed for "in factory" calibration of a touch
screen. The constants for the calibration functions:

x' = Ax + By + C and
y' = Dx + Ey + F

Are printed on stdout when the calibration is completed.
2012-12-06 15:53:08 -05:00
Kristian Høgsberg
bf74d5242a window: Add a widget default cursor convenience helper
In a few cases, we set a motion handler just to be able to set a fixed
cursor.  This adds a default cursor helper that can be used in those cases.
In case of the 'transformed' test case, we also avoid a brief flicker
of the pointer cursor, which is set on enter when the move grab is lifted.
2012-11-30 14:54:35 -05:00
Pekka Paalanen
ec07669a08 window: change boolean to flags in toysurface::prepare()
Change the boolean parameter 'resize_hint' into a bitmask 'flags'.

Note, that this flags is very different to the other flags used in
creating the toysurface implementations. They do not make sense to mix
one way or the other. Prepare() cannot change the surface type, and
surface constructors do not care for dynamic hint flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-30 14:25:18 -05:00
Ander Conselvan de Oliveira
a06a86066d clients: Replace transformed with a toytoolkit implementation 2012-11-30 14:24:18 -05:00
Ander Conselvan de Oliveira
15256f66ab window: Add a way to retrieve a window's output transform
Add the output_get_transform() entry point and an output handler hook.
2012-11-30 14:24:08 -05:00
Ander Conselvan de Oliveira
6d4cb4e8c4 window: Let clients set buffer transformations
When a window's buffer transformation is set, its buffers are
reallocated with the appropriate size (i.e., with width and height
swapped in case of 90 or 270 degree rotation).
2012-11-30 14:24:04 -05:00
Ander Conselvan de Oliveira
ddd3e27ab8 window: Honour opaque field for windows without a frame
Since the opaque region was set in frame_resize_handler(), if a client
created a frameless window setting the toplevel widget as opaque would
have no effect.

This patch fixes this by moving the call wl_surface_set_opaque_region()
to idle_resize(), and changing the latter function to set the whole
window as opaque if its toplevel widget has the opaque flag set.
2012-11-30 14:24:00 -05:00
Dima Ryazanov
a85292e73c Fix a crash when opening two terminal windows and closing the first one.
To reproduce, launch the terminal, open a second window using Ctrl-Shift-N,
go back to the first window, and press Ctrl-D. The terminal's master FD gets
events even after being closed, causing terminal_destroy to be called twice
on the same object.

To fix this, I'm adding a function to stop watching an FD.
2012-11-30 14:11:41 -05:00
Kristian Høgsberg
6006ecb497 configure.ac: Don't link weston to cairo or image libraries
We were pulling in cairo and the image loading libraries through libshared.
Split out libshared into a core libshared and a libshared-cairo that
pulls in the extra libraries.
2012-11-29 13:32:11 -05:00
Pekka Paalanen
a4eda73607 window: honour wl_buffer.release
Listen for wl_buffer.release events in the shm path, and if a previously
posted buffer is still held by the server, allocate another one. The
maximum of two should be enough, since there is no point for a server to
hold more than one buffer at a time.

Buffer allocation happens as needed instead of window creation time.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:57:54 -05:00
Pekka Paalanen
3cbb08944b window: fix tooltip text extents
After the toysurface rewrite, windows do not have a valid Cairo surface
outside their repaint cycle, so tooltips are not getting their size
right.

Create a dummy Cairo surface only for querying text extents, so we do
not rely on any window surfaces of parent windows or otherwise.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:50:53 -05:00
Pekka Paalanen
b362736bb2 window: simplify window_create_surface
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:50:26 -05:00
Pekka Paalanen
9943686be3 window: convert shm path to toysurface
Implement shm_surface as a sub-class of toysurface, and unify the
toysurface call sites removing most buffer type specific branching.

Do not destroy and create a surface, if the size does not change.

The resizing optimization of shm surfaces is retained, but the pool is
moved from struct window to struct shm_surface, since it does not apply
to egl_window_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:49:37 -05:00
Pekka Paalanen
03fc316000 window: add toysurface abstraction and port EGL path
We need more structure to the way we handle the backing storage in
toytoolkit, to make it possible to double-buffer the shm case properly.
The existing buffer handling is very complex with the three
different cases:
- EGLSurface backed Cairo surface with a window associated
- wl_shm backed Cairo surface with a window associated
- wl_shm backed Cairo surface without a window, as used by dnd.c

Introduce the toysurface abstraction, which defines the interface for
the both buffer handling cases that have a window associated. It also
means, that windows will not have a valid Cairo surface outside of their
repaint cycle.

Convert the EGLsurface case into toysurface for starters. For EGL-based
Cairo surfaces, the private data is no longer needed. Destroying
egl_window_surface will trigger the destruction of the cairo_surface_t,
not vice versa. This is possible because display_create_surface() is
shm-only.

The shm cases are left untouched.

As a side-effect, display_acquire_window_surface() and
display_release_window_surface() will no longer use the 'display'
argument. Instead, display will be the one inherited from the window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:49:34 -05:00
Kristian Høgsberg
b88b68fa42 weston-simple-im: Add a few more compose sequences 2012-11-27 15:11:04 -05:00
Kristian Høgsberg
504e8f109a weston-simple-im: Fold struct keyboard_input into struct simple_im 2012-11-27 14:28:19 -05:00
Kristian Høgsberg
aec12b806c weston-simple-im: Fold keyboard_input_handle_keymap() into event handler 2012-11-27 14:21:34 -05:00
Kristian Høgsberg
6aae61483b weston-simple-im: Fold keyboard_input_handle_key() into event handler 2012-11-27 14:20:31 -05:00
Kristian Høgsberg
3a3704db20 weston-simple-im: Fold keyboard_input_handle_modifiers into event handler 2012-11-27 14:18:54 -05:00
Kristian Høgsberg
de318ab25f weston-simple-im: Stop using toytoolkit
Toytoolkit doesn't buy us anything in this case, we're not rendering or
handling regular input events.  Just talk directly to wl_display and
look up the 'input_method' global directly.
2012-11-27 14:18:54 -05:00
Kristian Høgsberg
79bfde20bd weston-simple-im: Use serial number from incoming events
The key events we pass through to the input_method_context has to have
a serial number that corresponds to the key event we got.  The struct display
serial is updated on pointer enter/leave and keyboard events, but not the
input method keyboard events.  So the display serial will never correspond
to the key event we're dealing with and we have to pass through the
serial we get from the key event.
2012-11-27 13:57:27 -05:00
Kristian Høgsberg
8c03616c39 weston-simple-im: Create our own xkb_context
There's no need to use the struct display xkb_context, we can just create
out ow.  This reverts c31288daf1.
2012-11-27 13:48:09 -05:00
Kristian Høgsberg
1199b16f02 clients: Move keyboard-utils.[ch] into weston-simple-im
This is the only user of this code, so just include it in the simple im
source.
2012-11-27 13:42:04 -05:00
Jan Arne Petersen
e9fba2b737 text: Add simple compose input method
Add an input method listening to hardware keyboard input and generating
compose text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:19:39 -05:00
Rob Bradford
9d1d32bdd0 editor: Add support for editing text using the keyboard
This simple change allows you to drive the editor using the keyboard
(supporting backspace and delete and left and right arrow keys.) The idea
behind this change is to allow the testing of the interoperation between a
virtual keyboard and real one.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:19:38 -05:00
Jan Arne Petersen
c31288daf1 window: Allow to get xkb context from display
Add display_get_xkb_context to get the xkb context from the display.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:19:38 -05:00
Jan Arne Petersen
257201d2cc window: Add utils for xkb keyboard input
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:14:08 -05:00
Jan Arne Petersen
cd99706b61 text: Send more information with keysym events
Send state and modifier from the demo keyboard with the keysym event and
take them into account in the editor example.

Add some helper functions to write and read a modifiers_map array.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:06:21 -05:00
Jan Arne Petersen
d9be93b964 text: Rename and extend text_model key event
Rename the key event in text_model to keysym and add serial, time and
modifiers arguments. Add a modifiers_map event to transfer an array of
0-terminated modifier names, so that a mapping of modifiers to the
modifier bit mask is possible.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:02:26 -05:00
Ander Conselvan de Oliveira
1b4312d326 clients: Add a client that renders transformed buffers
This new client, called transformed, renders a cross with the top part
red and the right green, with the same transform as the output the
surface is in.

This is based on simple-egl.
2012-11-27 11:30:09 -05:00
Scott Moreau
6655e00e03 simple-egl: Reset opaque region if not fullscreen.
If simple-egl is toggled fullscreen, the opqaue region is set for the surface
but never removed after exiting fullscreen. This patch resets the opaque region
to 0 if the surface is not fullscreen and -o was not passed. This fixes the
problem introduced sometime since d7f282b84e, when this was last fixed.
2012-11-19 17:23:59 -05:00
Pekka Paalanen
768117f90b window: make display_create_surface() shm-only
Nothing uses it to create EGL-surfaces outside of window.c. This makes
refactoring the EGL-based code easier, since we do not need to support
EGL-based Cairo surfaces without an associated struct window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 16:00:01 -05:00
Pekka Paalanen
32127ca86d window: use different keys for different cairo privates
cairo_surface_t objects have a private set, either struct
shm_surface_data, or struct egl_window_surface_data. Use separate
private keys for each type to avoid mismatch.

This makes display_get_buffer_for_surface() safe, in that it won't
return garbage for an EGL-based cairo surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:28 -05:00
Pekka Paalanen
0c6a34378a window: merge struct surface_data into shm_surface_data
Struct surface_data was not really useful, and it definitely was not
used with EGL-based windows.

This also fixes a semantic mistake, where struct shm_surface_data was
put into cairo_surface_t private, but got out as struct surface_data
instead. Due to struct layout, however, this did not cause a real bug.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:26 -05:00
Pekka Paalanen
f86504c881 window: remove unused MULT macro
Leftovers from

commit f02a649a3c
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Mon Mar 12 01:05:25 2012 -0400

    Consolidate image loading code and move to shared/

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:24 -05:00
Pekka Paalanen
a8d4c84693 window: make window_flush() private
Not called from any client.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:17 -05:00
Pekka Paalanen
ce36f6dff4 window: make window_{create,set}_surface private
I do not think these are meant to be called by the applications
directly. Applications certainly do not have to call them.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:12 -05:00
Pekka Paalanen
99b705bb17 simple-shm: honour wl_buffer.release
Change simple-shm to properly process the wl_buffer.release event, and
not reuse a buffer until it is released by the server, as specified in
the protocol.

In case the server has not released the buffer, but signals that it has
been shown (frame callback), allocate a second buffer. Simple-shm will
now automatically do double-buffering if needed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:09 -05:00
Ander Conselvan de Oliveira
edce9c295c simple-egl: Set the right size for the opaque region when fullscreen
window.window_size holds the size of the window in windowed mode. Use
window.geometry for setting the opaque region since that holds the
current size.
2012-11-16 19:24:09 -05:00
Jan Arne Petersen
1f1b39792b keyboard: Rename keyboard to weston-keyboard
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:27:37 -05:00
Jan Arne Petersen
5ec05fb251 keyboard: commit preedit before sending key events
Commit the current preedit text before sending control key events.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:27:26 -05:00
Jan Arne Petersen
8083e019cd editor: Remove preedit text on startup
There should not be preedit text when a text entry does not have focus.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:26:43 -05:00
Jan Arne Petersen
25f6db51f0 editor: Initalize editor struct with 0
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:26:30 -05:00
Jan Arne Petersen
6345faa39a editor: Fix handling of UTF-8 text
Fix display, cursor movement and text deletion for UTF-8 text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:26:21 -05:00
Daniel Stone
a84687174c Terminal: Handle keypad symbols
XKB provides keypad symbols in a separate namespace.  We don't care
about the distinction, so map them to normal symbols before starting
processing.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-11-08 14:08:53 -05:00
Daniel Stone
4eb445abba smoke: Remove unused offset member
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-11-08 14:08:53 -05:00
Daniel Stone
8097274ce6 Clients: Don't set the cursor when we have no pointer
Avoids a segfault whenever we get a key event, and try to set the
cursor, dereferencing a NULL input->pointer.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-11-08 11:31:37 -05:00
Kristian Høgsberg
0f7a285fe1 window.c: Move misplaced break to where it belongs
The break statement wasn't copy and pasted along with the rest of the code
causing menu item before it ("Move to workspace below") to fall through to
the fullscreen case.
2012-11-05 20:24:32 -05:00
Kristian Høgsberg
e77d7577a2 window: Fix use-after-free in menu button handler
Commit d2fbb3870c introduced a use-after-free
error in the case where we destroy the menu.
2012-10-30 18:10:32 -04:00
Kristian Høgsberg
efb948846f window: Only advertise fullscreen menu item if client supports it
If the client doesn't set a fullscreen handler, we can't go fullscreen
and shouldn't advertise that in the window menu.  The menu implementation is
a little simplistic, so we just move the "Fullscreen" entry to the end of
the list and don't count it if we don't want it in the menu.

https://bugs.freedesktop.org/show_bug.cgi?id=47751
https://bugs.freedesktop.org/show_bug.cgi?id=48106
2012-10-30 18:07:02 -04:00
Kristian Høgsberg
9468708f70 image: Set dragging pointer on button press, not first motion
We want feedback that we're starting to drag when we press the button
not when we later start dragging the image.
2012-10-30 15:50:37 -04:00
Kristian Høgsberg
d3bf6766ab image: Combine clamp_view() and center_view ()
We need to clamp or center on a per axis basis.  If the window is wider
but the image is taller, we need to center horizontally but
clamp vertically.  We can only do that if by combining the two
functions.
2012-10-30 15:46:39 -04:00
Kristian Høgsberg
719b2158e7 image: Add keyhandler to handle keyboard zoom 2012-10-30 15:42:20 -04:00
Kristian Høgsberg
a369ff5273 image: Set resize handler and center view on resize/fullscreen 2012-10-30 15:09:49 -04:00
Scott Moreau
1bdb477522 toytoolkit: Don't destroy window cairo surface on shm attach.
https://bugs.freedesktop.org/show_bug.cgi?id=52454
2012-10-30 14:18:49 -04:00
Kristian Høgsberg
d2fbb3870c window: Make press-drag-release menu selection mode work
The intended behavior is that a quick click (press and then release
within 500ms) just pops up the menu and doesn't select anything.  Then
we can mouse around and and click to select an item.  Alternatively, a
click and hold (ie press and release after 500ms) lets you press right
button, mouse down on the menu item you want and release to select it.
This is how menus work in most toolkits.

The handling in weston is fine, it's there to handle the case where
the button release happens outside any client window, since the client
doesn't get those events.  If such a release happens late or we get a
second release outside the popup window we shut down the popup.

The problem is in toytoolkit, where we need to select the item if we
get a release within 500ms or if we get a second release.  A second
release is the case where the first release came after 500ms and
didn't pop down the menu, and the second release event is from a click
on a menu item.

https://bugs.freedesktop.org/show_bug.cgi?id=52456
2012-10-30 13:45:31 -04:00
Kristian Høgsberg
191e0eee77 simple-egl: Add a default cursor
If clients don't set a cursor, they get whatever the last cursor was
before the pointer entered their window.  That's a little confusing, so
set a pointer on enter to avoid that.  The down-side is that simple EGL
isn't very simple anymore.

https://bugs.freedesktop.org/show_bug.cgi?id=52452
2012-10-29 17:41:46 -04:00
Kristian Høgsberg
6326c5de82 clients: Remove $(toolkit_libs) from weston_screensaver_CFLAGS
The typo that broke the build.
2012-10-29 17:15:54 -04:00
Kristian Høgsberg
e530a0a240 window: Ignore input_set_pointer_image() if we don't have a pointer
https://bugs.freedesktop.org/show_bug.cgi?id=55782
2012-10-29 16:42:26 -04:00
Damien Lespiau
4df7e27055 dnd: Use %zd in the format string for size_t types
len i size_t, so is the result of the sizeof operator.
2012-10-29 16:28:19 -04:00
Kristian Høgsberg
b98905e810 configure.ac: Check for libGLU for screensaver
https://bugs.freedesktop.org/show_bug.cgi?id=56376
2012-10-29 13:44:33 -04:00
Pekka Paalanen
9564c75163 desktop-shell: background should be opaque
Toytoolkit does not support setting opaqueness for anything else than
the immediate child widget of the frame widget. Backgrounds do not have
frames, so we need to poke it in manually.

This should allow Weston to paint the background without blending.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-25 14:59:23 -04:00
Pekka Paalanen
fedc527723 window: remove window_set_transparent() declaration
The function is not implemented.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-25 14:59:08 -04:00
Kristian Høgsberg
8c31a4c025 Define our own container_of as well
Don't rely on libwayland-client/server to define this for us.
2012-10-19 23:05:37 -04:00
Kristian Høgsberg
5717b6dbf1 Stop relying on ARRAY_LENGTH being defined in wayland-util.h
Time to break a bad habit.
2012-10-19 17:12:38 -04:00
Jonas Ådahl
f461eee2b0 window: Always pass focused widget to widget motion handlers
Grabbed widgets should always receive motion events as if it was the
widget that would receive it if no grab was active. This means that the
focused widget should always be passed as the widget argument to widget
motion handlers.

This reverts commit 8c9c8fcf6e.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-19 16:56:08 -04:00
Jonas Ådahl
f82eda5247 window: Don't set pointer image when requesting to move a surface
Since it's the server who moves the surface it's the server who sets the
pointer image.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-19 16:54:42 -04:00
Ander Conselvan de Oliveira
d0f24cf6ec simple-shm: Don't use ret variable in main() uninitialized 2012-10-17 16:51:07 -04:00
Kristian Høgsberg
3146756adf clients: Don't ask for EGL_PIXMAP_BIT when choosing configs 2012-10-16 15:31:31 -04:00
Kristian Høgsberg
a17f7a13fd clients: Check return value of wl_display_dispatch()
The simple clients all just call wl_display_dispatch() in a while loop
without checking the return value.  Now, if the server dies or other
error occurs, we get a -1 return value instead and need to break the loop.
2012-10-16 13:17:16 -04:00
John Kåre Alsaker
011a1ce350 Remove some dead code. 2012-10-16 11:29:10 -04:00
Pekka Paalanen
379d3d140d configure: build tablet-shell client conditionally
Do not build the tablet-shell client if --disable-tablet-shell is given.

Change --enable-tablet-shell to --disable-tablet-shell in ./configure
--help output, since it is enabled by default. Add a description.

Use proper quoting in the conditional.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:49:08 -04:00
Pekka Paalanen
392c5f275d simple-touch: do not include GL headers
since it doesn't use any of them. Fixes a build failure on systems,
where (E)GL headers are in non-standard path.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:48:55 -04:00
Pekka Paalanen
5f8a67cce8 configure: separate simple EGL clients from others
Separate simple EGL clients from other simple clients. This allows to
build either simple-shm or simple-egl, whichever you want. We avoid
linking libEGL and GLESv2 into simple-shm, and we can build simple-shm
even if nothing provides EGL, GLESv2, or wayland-egl APIs.

Change the options in configure --help from --enable to --disable, since
these are enabled by default, and you would normally only ever give the
--disable flavor. Add descriptions.

Remove the #define BUILD_SIMPLE_CLIENTS since it is not used.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:48:19 -04:00
Pekka Paalanen
fb39d8d23c toytoolkit: make all EGL code dependant on cairo-egl
configure.ac: The toytoolkit clients used to get libEGL linked to them
even if there was no cairo-egl. This is useless, and actually harmful on
platforms, where libEGL absolutely requires one of the GL ES libraries
to be linked in, too.

Look for EGL-related packages only for cairo-egl with toytoolkit.

window.c: protect all GL header includes with HAVE_CAIRO_EGL, since that
is the only case we can support EGL, GL, or GLESv2 at all. In the case
we do not have cairo-egl, add enough definitions to let us build the
stubs for EGL-related functions.

Remove some #ifdefs that were inside of the same #ifdef already.

These changes allow to build sorfware rendering toytoolkit clients
without any bits of EGL libs or headers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:47:22 -04:00
Pekka Paalanen
53e58485a5 window: remove dead EGL code
- remove unimplemented function from header
- remove the egl function pointers that were not used

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:46:15 -04:00
Kristian Høgsberg
3fb613effe window: Set input region also when we go fullscreen
We used to rely on the compositor resetting this as a side effect of
changing size, but it doesn't work like that any more.
2012-10-15 20:54:43 -04:00
Jonas Ådahl
972d506de3 clients: image: Add support for panning and zooming
Support for zooming by using ctrl + the vertical axis (scrolling upwards
zooms in) and panning by both the horizontal and vertical axis as well
as click and drag was added to demonstrate how axis should work.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-15 20:54:43 -04:00
Jonas Ådahl
d9f6b078b6 window: Update modifier state directly after receiving a modifier event
If the keyboard modifier event was received after the key event the
modifier state would end up incorrect.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-15 20:54:43 -04:00
Pekka Paalanen
b2f957a9f1 window: don't call output configure uninitialised
Callbacks registered via display_set_output_configure_handler() are
promised to be called when we know the current mode for the output. If
the following order of events happens:
1. toytoolkit binds to a wl_output global
2. application registers an output configure handler
3. the wl_output.mode events are received

Then in step 2 we would call the callback with uninitialised output
informations, giving it a 0x0 size.

To avoid such race, do not call the callback from
display_set_output_configure_handler() if the output has 0x0 size.

The wl_output.mode event will be received later, and that will trigger
the right call to the callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-15 20:54:43 -04:00
Kristian Høgsberg
feb3c1d33b clients: Use wl_display_dispatch_pending() 2012-10-15 20:54:43 -04:00
Pekka Paalanen
bc10638cd9 compositor, clients: apply wl_surface.frame on commit
Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.

This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.

Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.

compositor-wayland assumes renderer->repaint_output does a commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:39:11 -04:00
Pekka Paalanen
0cbd3b5059 compositor, clients: double-buffer input region
Make input region double-buffered as specified in the new protocol.

While doing it, get rid of the undef region code, and instead use a
maximum sized real pixman region. This avoids special-casing regions
that might sometimes be undef.

As the input region is now usable by default instead of undef,
weston_surface_update_transform() does not need to reset the input
region anymore.

weston_surface_attach() no longer resets the input region on surface
size change. Therefore, also weston_seat_update_drag_surface() does not
need to reset it.

Update toytoolkit to set input region before calling wl_surface_commit()
or swapBuffers (which does commit).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:44 -04:00
Pekka Paalanen
512dde8ce9 compositor, clients: double-buffer opaque region
Make wl_surface.set_opaque_region double-buffered as required by the new
protocol. Also, do not reset the opaque region on surface size changes
anymore. Only explicit requests from the client will change the region
now.

In clients, make sure commit happens after setting the opaque region.

Mesa does not need a fix, as it never touches the opaque region.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:40 -04:00
Pekka Paalanen
8e159180cc compositor, clients: make damage double-buffered
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".

Implement double-buffering of damage in the compositor as required by
the new protocol.

Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().

Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:31 -04:00
Pekka Paalanen
c9e00c06e9 clients: use wl_surface_commit
Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.

NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.

simple-shm and simple-touch OTOH will work now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:17 -04:00
Kristian Høgsberg
fa80e11c84 Update to new fd and wl_registry APIs
This commit updates the clients and the wayland compositor backend to
use the new wl_registry mechanism and the thread safe fd API.
2012-10-10 21:34:38 -04:00
Scott Moreau
4e07236e87 toytoolkit: Take into account transform when sending output allocation. 2012-10-10 13:02:11 -04:00
Kristian Høgsberg
b36f7ef99e terminal: Don't snap resize if we're maximized
We allow fullscreen to fill the requested size, do the same for maximize.
2012-10-10 11:41:21 -04:00
Kristian Høgsberg
b7ed4cbbc7 terminal: Use window_get_fullscreen() instead of tracking that state manually 2012-10-10 11:37:46 -04:00
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
Scott Moreau
01a9f1b992 clients: Set title for all shell surface demos. 2012-10-09 23:13:01 -04:00
Rob Bradford
053fe7652b keyboard: Avoid access beyond end off buffer
If the for loop does not match on a button it will fall through and try and
dereference into the array using the terminating value of the loop. This
terminating value of the loop is the dimension of the array and thus beyond
its bounds.

Cc: Jan Arne Petersen <jpetersen@openismus.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-10-09 22:56:46 -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
Rob Bradford
371805f76e simple-shm: Draw the test motif surrounded by a white border
We can then use a wl_surface_damage to just trigger the compositor to update
just a selected region of the buffer and thus test damaging a sub region.
2012-10-04 11:34:09 -04:00
Rob Bradford
fecf332e19 simple-shm: Don't attach the buffer to the surface for every redraw
This will allow us to change just a sub region of the buffer.
2012-10-04 11:34:05 -04:00
Philipp Brüschweiler
70f83679ee editor: more intuitive cursor positioning
Compute the nearest glyph edge instead of taking the one to the
left of the cursor.

Also fixes a segfault when trying to compute the position for an empty
buffer.
2012-10-04 11:31:21 -04:00
Philipp Brüschweiler
9f897c7a5f editor: take text offset into account when computing cursor position 2012-10-04 11:31:19 -04:00
Philipp Brüschweiler
b8911dcdd7 editor: make selection a lighter shade of blue, much easier to read 2012-10-04 11:31:17 -04:00
Philipp Brüschweiler
237358be93 editor: fix assert to take preedit string into account 2012-10-04 11:31:14 -04:00
Martin Olsson
3b132e358f Fix spelling errors 2012-10-04 11:24:50 -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
Jan Arne Petersen
680275fbf1 text: Rename de/activate to enter/leave
Also add a surface argument to the enter event.
2012-09-25 11:24:49 -04:00
Pekka Vuorela
64988feb13 PDF viewer to run until and only when it has existing windows
I.e. not to close whole application when one of the windows
is closed.
2012-09-25 11:24:49 -04:00
Pekka Vuorela
2dbe4c632e Fix memory leak in PDF viewer 2012-09-25 11:24:49 -04:00
Pekka Vuorela
2bd429b734 Fix PDF viewer not to produce garbage windows for nonexistent files
Was calling window_flush() on redraw handler which already happens on
window redrawing.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
80ad1a943d editor: Fix selection anchor on text deletion
When text is deleted adjust selection anchor.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
e386dd22c4 editor: Delete selected text before adding new
When inserting new text, delete selected text first.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
633c83de2c keyboard: Allow backspace for pre-edit text
When there is a pre-edit text delete the last character of the pre-edit
text with the backspace key.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
8aba11d057 editor, keyboard: Add support for arrow keys
Add support for arrow keys on the virtual keyboard and make it possible
to move around the cursor in the editor example.
2012-09-25 11:24:49 -04:00
Ander Conselvan de Oliveira
d7f282b84e simple-egl: Set the opaque region if windowed and -o is passed
Since commit 6a615d2621 [1], the opaque
region would be set only when running fullscreen. Having it set
properly for the windowed case is helpful to test the overlay path in
compositor-drm.

What this patch does is:

 - reverts the above commit;
 - remove the "if fullscreen make the window opaque" conditional, that
   should have been removed when -o was introduced and was actually the
   cause for the bug solved in [1];
 - sets the opaque region when running fullscreen, regardless of the -o
   switch.

[1] commit 6a615d2621
    Author: Scott Moreau <oreaus@gmail.com>
    Date:   Thu Aug 30 14:44:16 2012 -0600

        simple-egl: Only set alpha_size=0 when -o is passed.

v2: - Clarify in the commit message that this does not regress the bug
      solved in [1].
    - Use the correct sha1 for the reverted commit.
2012-09-14 13:54:28 -04:00
Jan Arne Petersen
c1e481efb1 text: Add reset requets to protocol
Add a reset request to the text_model interface and a reset event to the
input_method_context interface. Use it to reset the pre-edit buffers in
the example keyboard when the cursor is moved in the example editor
client.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:52:53 -04:00
Jan Arne Petersen
ce8a4433f5 text: Add support for control keys to the protocol
Add key event to the text_model interface and a key request to the
input_method_context interface. Implement it in the example editor
client and the example keyboard.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:52:41 -04:00
Jan Arne Petersen
e202bae9d3 text: Add delete_surrounding_text to protocol
Add delete_surrounding_text event in the text_model interface and the
request in the input_method_context interface. Implement it in the
example editor client and in the example keyboard so that the backspace
key works with it.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:51:08 -04:00
Jan Arne Petersen
43f4aa8cab text: Add support for pre-edit string
Add support of preedit-string to the example editor client. Also add a
preedit_string request to the input_method_context interface and use
that in the example weston keyboard to first create a pre-edit string
when entering keys and commit it on space.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:50:44 -04:00
Jan Arne Petersen
892f1c3975 keyboard: Use a qwerty virtual keyboard layout
Add support for a proper qwerty virtual keyboard layout with lowercase
and uppercase state, space and enter button.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:49:43 -04:00
Jan Arne Petersen
30b66ef1fd text: Split text and input-method protocols
It makes sense to split the interfaces in a text and a input-method
protocol for now (only the text protocol needs to be used in toolkits).

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:48:59 -04:00
Jan Arne Petersen
cb08f4d844 text: Fix set_surrounding_text request
Add cursor and anchor positions as arguments to the set_surrounding_text
request. The cursor and anchor positions are relative to the surrounded
text, so it does not make sense to have that separate. Remove the
separate set_cursor_index and set_selected_text requests. Also update
the corresponding event in input-method-context and add support for it
in the weston example keyboard.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:38:00 -04:00
Jan Arne Petersen
c1fbcb7c38 editor: Add support for setting a preedit
Add support for setting a preedit text to the editor example.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:36:04 -04:00
Jan Arne Petersen
0e5bd45100 editor: Add support for selection
Make it possible to select text and render the selection to the editor
example.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:56 -04:00
Jan Arne Petersen
09e7c96574 editor: Insert commit-string at cursor
Instead of appending at the end, insert the commit-string at the cursor
position.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:49 -04:00
Jan Arne Petersen
7e634a0ea7 editor: Add support for cursor
Add support for setting, moving and rendering a cursor.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:42 -04:00
Jan Arne Petersen
b9eb02c46f editor: Extract text handling into text_layout
Create a text_layout struct and functions for handling simple text
layouts.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:37 -04:00
Jan Arne Petersen
f80bc06a8e editor: Make text_entry a widget
Simplify the example client by making text_entry a widget.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:20 -04:00
Jan Arne Petersen
620cd62cbd text: Introduce input_method_context interface
Add an input_method_context interface which is the representation of a
text_model on input_method side.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:34:59 -04:00
Jan Arne Petersen
4c26518ad1 text: Remove surface arg in create_text_model
Remove the wl_surface argument from create_text_model request. The
wl_surface is specified as an argument in the activate request instead.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:28:04 -04:00
Pekka Paalanen
0d64a0fa29 compositor: new intersection algorithm
The existing algorithm had some corner cases (pun!), where it failed to
produce correct vertices in the right order. This appeared only when the
surface was transformed (rotated). It also produced degenerate polygons
(3 or more vertices with zero polygon area) for non-transformed cases
where the clipping and surface rectangles were adjacent but not
overlapping.

Introduce a new algorithm for finding the boundary vertices of the
intersection of a coordinate axis aligned rectangle and an arbitrary
polygon (here a quadrilateral). The code is based on the
Sutherland-Hodgman algorithm, where a polygon is clipped by infinite
lines one at a time.

This new algorithm should always produce the correct vertices in the
clockwise winding order, and discard duplicate vertices and degenerate
polygons. It retains the fast paths of the existing algorithm for the
no-hit and non-transformed cases.

Benchmarking with earlier versions showed that the new algorithm is
a little slower (56 vs. 68 us/call) than the existing algorithm, for
the transformed case.  The 'cliptest f' command before and after this
commit can be used to compare the speed of the transformed case only.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Rob Clark <rob.clark@linaro.org>
2012-09-12 12:27:35 -04:00
Pekka Paalanen
8c492b1293 clients: add cliptest program
Cliptest is for controlled testing of the calculate_edges() function in
compositor.c. The function is copied verbatim into cliptest.c.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-12 12:24:40 -04:00
Pekka Paalanen
84ec19a758 update .gitignores
Add workspaces-protocol.c, workspaces-server-protocol.h,
workspaces-client-protocol.h.

Remove wscreensaver.

Alphabetaize clients/.gitignore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-12 12:24:23 -04:00
Philipp Brüschweiler
774c34a381 screensaver: fix decoding of transparency in xpm files
Use 0 as transparent pixel. This is needed when using premultiplied
alpha.
2012-09-06 21:08:12 -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
Scott Moreau
7e300dbc58 simple-egl: Avoid race condition.
After explaining the problem on irc, Pekka dictated this solution which works.
The problem is that simple-egl can hang when toggling fullscreen because of a
race where (quoting Pekka) "if it dispatches the frame callback simple-egl
itself requested before the Mesa's own frame callback came, simple-egl will go
to its redraw routing and call eglSwapBuffers so you end up effectively calling
eglSwapBuffers from within eglSwapBuffers, and deadlock". This patch avoids
redrawing (which calls eglSwapBuffers) when there is a pending frame callback.
2012-08-31 19:49:08 -04:00
Scott Moreau
6a615d2621 simple-egl: Only set alpha_size=0 when -o is passed.
When starting simple-egl with -f for fullscreen and toggling to 'windowed' mode with F11,
the surface is opaque instead of semi-trnasparent as it is when starting without -f. We
only want to create the surface with alpha_size=0 when the user explicitly passes -o
because otherwise it will never have the ability to use alpha.
2012-08-31 19:43:08 -04:00
Scott Moreau
1ee53e78db simple-egl: Remove unused variable. 2012-08-31 19:40:09 -04:00
Philipp Brüschweiler
467668c9a4 desktop-shell: don't segfault on invalid icon path
Instead draw a fallback icon and proceed as normal.

https://bugs.freedesktop.org/show_bug.cgi?id=53860

v2: coding style fixes
v3: memory leak, draw icon instead of relying on external files
2012-08-29 15:31:25 -04:00
Philipp Brüschweiler
16d59d7780 desktop-shell: respect CURSOR_NONE as grab cursor 2012-08-29 15:12:57 -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
Scott Moreau
bb5898341c screenshot: Use correct buffer size for transformed outputs.
This is a workaround for screenshots with transformed outputs. It reorders
the output positions so the correct buffer size is determined for the final
image. This assumes the outputs are in succession on the x axis. The outputs
are rendered in their transformed state.
2012-08-29 14:47:30 -04:00
Philipp Brüschweiler
fdb4b02501 terminal: support entering non-ascii characters
Unless the alt modifier is active and the MODE_ALT_SENDS_ESC mode is not
set, any value over 127 is converted to a UTF8 sequence.

Part of https://bugs.freedesktop.org/show_bug.cgi?id=53648 should be
fixed with this.

Part of https://bugs.freedesktop.org/show_bug.cgi?id=52419 is fixed, but
interestingly it depends on the activated keymap (i.e. it works with
dvorak, but not with ch).
2012-08-29 14:47:07 -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
97cb62afb7 weston-info: an output can have multiple modes 2012-08-15 16:06:46 -04:00
Philipp Brüschweiler
bb0d4b9218 weston-info: remove timerfd termination hack
Use wl_display_roundtrip to listen exactly as long as necessary.
2012-08-15 16:04:44 -04:00
Kristian Høgsberg
70fc4a4cd6 clients: Move weston-info to bin_PROGRAMS
It's properly prefixed and pretty useful; let's install it.
2012-08-15 12:12:33 -04:00
Philipp Brüschweiler
585acb0013 weston-info: client that print out information about the running compositor
This includes seat capabilities, shm formats and output information.
2012-08-15 11:40:42 -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
Philipp Brüschweiler
70cc73b8d8 eventdemo: add axis logging
https://bugs.freedesktop.org/show_bug.cgi?id=52453
2012-08-14 10:17:06 -04:00
Philipp Brüschweiler
a306a2691a eventdemo: fix --no-border
This was broken by commit 29af3ebce6
2012-08-14 10:17:06 -04:00
Philipp Brüschweiler
850f504aa2 eventdemo: fix incorrect comments 2012-08-14 10:17:06 -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
Philipp Brüschweiler
1f54f17ef8 image: handle multiple images correctly
Don't stop the application when only one window is closed. Don't stall
indefinitely if no valid image file is given as input.
2012-08-13 16:30:55 -04:00
Philipp Brüschweiler
f22d0ecd97 dnd: fix segfault on grabbing
Some cursor themes don't include a "grabbing" icon, causing a segfault.
This patch fixes this by just reverting to the stardard cursor instead.

https://bugs.freedesktop.org/show_bug.cgi?id=50487
2012-08-13 14:39:41 -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
Jan Arne Petersen
e829adc514 text: Assign text_model to a wl_seat
Add a wl_seat argument to the activate and deactivate requests of
text_method.

On activation a text_model gets assigned to the input_method of the
wl_seat specified in the activate request.
2012-08-10 13:00:52 -04:00
Jan Arne Petersen
de3b6a15c0 text: Add activate/deactivate events
Let the client know when a text model gets activated or deactiavted.
2012-08-10 13:00:52 -04:00
Jan Arne Petersen
5196374218 text: Rename text_model_manager to factory
The text_model_manager interface is just used to create text_model
instances. It is more a factory than a manager so rename it to
text_model_factory.
2012-08-10 13:00:52 -04:00
Jan Arne Petersen
72f6082313 text: Add missing callbacks for text_model events
Add all required callbacks for the text_model_listener in the editor
example.
2012-08-10 13:00:52 -04:00
Juan Zhao
19a4c2db26 image: Don't segfault when the file doesn't exist
Don't create a window when the file doesn't exist.

https://bugs.freedesktop.org/show_bug.cgi?id=52450
2012-08-09 10:55:40 -04:00
Kristian Høgsberg
bcf4864bb7 simple-egl: Add help message 2012-08-03 16:32:55 -04:00
Kristian Høgsberg
45ce98829b simple-egl: Set opaque region when running opaque 2012-08-03 16:32:52 -04:00
Pekka Paalanen
b6df4f7de4 desktop-shell: use the standard 'environ' variable
The variable '__environ' seems to be libc implementation specific, and
not avaible on Android.

Use the POSIX standard variable 'environ', which also luckily happens to
be available on Android, which is not POSIX.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:36 -04:00
Andre Heider
552d12b10e terminal: Don't crash on non-ascii chars
isalpha() and isdigit() don't like huge values.
Noticed with ascii-art in the shell prompt.
2012-08-03 12:54:06 -04:00
Kristian Høgsberg
2a1aa4efce terminal: Don't output @ for ASCII NUL
Fixes visual bell in screen.
2012-08-03 09:37:05 -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
76fc57e75c simple-touch: use proper damage in touch_paint()
Should reduce update overhead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
0768419393 simple-touch: fix off-by-one in position checks
Fix the off by one error in checking whether we can draw the marker
without exceeding buffer dimensions.

Fixes a segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
55b7cb24e0 simple-touch: more colors and thicker marks
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
7e94a98e07 simple-touch: respond to ping protocol
Without this, it won't get any input anymore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -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
321e8b7fd3 gears: Exit on ESC 2012-07-30 15:40:57 -04:00
Ander Conselvan de Oliveira
69f9840bed simple-egl: Add keyboard fullscreen toggle
Make simple-egl toggle the fullscreen state whenever the key F11 is
pressed. A sync callback is used to stop drawing while the surface has
not received the configure event, to prevent a buffer with the windowed
size to be attached to the surface after the set_fullscreen request.
2012-07-27 16:11:40 -04:00
Kristian Høgsberg
2995c517c5 gears: Keep gears inside screen in fullscreen mode 2012-07-26 23:53:05 -04:00
Olivier Blin
7679d9a62e gears: add a warning about refresh rate limitation 2012-07-26 22:03:41 -04:00
Olivier Blin
a1d0cf5d69 gears: show FPS count (as in glxgears from mesa/demos) 2012-07-26 22:03:21 -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
Olivier Blin
fa820efaf0 gears: add fullscreen support 2012-07-25 16:21:13 -04:00
Kristian Høgsberg
d1936b9e2b desktop-shell: Break command lines into env vars, executable and arguments
We now support specifying environment variables and arguments in launchers
by saying

  path=GDK_BACKEND=wayland gnome-terminal --full-screen

for example.

https://bugs.freedesktop.org/show_bug.cgi?id=47920
2012-07-23 22:59:33 -04:00
Kristian Høgsberg
df0faf7983 image: Add fullscreen support 2012-07-23 22:00:21 -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
0fd49aa886 dnd: Clip flowers to window content area
https://bugs.freedesktop.org/show_bug.cgi?id=52420
2012-07-23 21:32:46 -04:00
Scott Moreau
ec116022ec desktop-shell: Declare grab_cursor as enum cursor_type. 2012-07-23 10:48:45 -04:00
Kristian Høgsberg
0e696478a9 Handle new transform argument in wl_output.geometry event 2012-07-22 15:49:57 -04:00
Philipp Brüschweiler
f25602bdc0 Extract the text_model_manager interface from input_method
This is necessary because all clients need a way to create
text_models, but only one client at a time can be bound to
the input_method global (else we don't know to whom we are
supposed to send events).
2012-07-22 12:06:10 -04:00
Philipp Brüschweiler
591cfca4e8 editor: deactivate old text model before activating the new one 2012-07-22 11:47:31 -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
07a91cd9fd desktop-shell: Don't get a shell surface for the grab surface
The grab surface does not depend on any of the shell surface
functionality, so don't allocated one.
2012-07-16 13:35:26 -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
Scott Moreau
a6e24d3104 wscreensaver: Fix --demo mode. 2012-07-12 09:18:45 -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
c663b22c20 clients: Free resources on exit in eventdemo 2012-07-09 17:50:57 -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
Martin Olsson
ff52193ee8 clients: Add clients/weston-screensaver to clients/.gitignore 2012-07-09 17:41:26 -04:00
Kristian Høgsberg
0fe782bdb5 terminal: Extend selection to end of line when selecting past last char 2012-07-01 23:59:08 -04:00
Kristian Høgsberg
0dee6475bd terminal: Insert newlines when copying multiple lines 2012-07-01 21:25:41 -04:00
Kristian Høgsberg
8268d41410 terminal: Handle selection for pointer positions outside widget correctly
That is, don't crash and select entire first/last line when the pointer
is above or below widget.
2012-06-29 12:28:41 -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
29784402e1 terminal: Add a terminal enter handler for setting I-beam cursor
Now that the mod+click shortcuts change the cursor, this was suddenly obvious.
2012-06-28 14:27:02 -04:00
Ander Conselvan de Oliveira
b9d2a0fc0a shell: Show approprite cursors during move and resize grabs
This patch expands the busy cursor mechanism so that it is possible for
the desktop-shell client to show the appropriate cursor during grabs.
2012-06-28 14:13:57 -04:00
Kristian Høgsberg
18e928dfb8 terminal: Scroll selection with terminal contents 2012-06-27 19:29:41 -04:00
Kristian Høgsberg
38912df847 terminal: Make font size configurable 2012-06-27 17:52:23 -04:00
Kristian Høgsberg
333db0a17e terminal: Implement word and line based selection
Double-click to select by word, triple click to select by line.
2012-06-27 17:43:10 -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
0636ac307e shell: Make input_panel just a regular wl_surface 2012-06-27 10:24:21 -04:00
Kristian Høgsberg
1a73a6335d shell: Make screensaver just a wl_surface 2012-06-27 10:24:21 -04:00
Kristian Høgsberg
730c94d62e shell: Make the lock surface just a plain wl_surface too 2012-06-27 10:24:21 -04:00
Kristian Høgsberg
af7b1ffaf4 shell: Make panel just a wl_surface too 2012-06-27 10:24:21 -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
129decbdf7 terminal: Tab should not output spaces, just move cursor
Emacs uses tab and backspace to move the cursor as well as the regular
cursor movement escape codes.  When it's less bytes than the escape code,
emacs will use a tab or tab + backspace to move the cursor forward.  The
effect is that as you're  moving around in the buffer, emacs will
(seemingly) randomly insert spaces and overwrite what's in the terminal.
Making tab just move the cursor as it should fixes this.
2012-06-26 13:22:03 -04:00
Ander Conselvan de Oliveira
57e0ce1d2a simple-egl: Make window moveable 2012-06-26 10:21:23 -04:00
Kristian Høgsberg
6a78a9730a Install screensaver by default 2012-06-25 14:06:45 -04:00
Kristian Høgsberg
22fbcf7183 terminal: Ignore more modifier keys
Don't want these to leak into the terminal.
2012-06-22 12:18:56 -04:00
Kristian Høgsberg
b24ab806bf terminal: Only hide cursor for keypresses that generate data for the process 2012-06-22 12:18:20 -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
Jan Arne Petersen
cba9e470ba text: Add example clients for text protocol 2012-06-21 16:41:12 -04:00
Juan Zhao
8634f51b63 tablet-shell client:fix one seg-fault error
When the icon provided in weston.ini is not available, it will report a segfault error.
Check the icon at first.
backtrace:
*INT_cairo_surface_status (surface=0x0) at cairo-surface.c:259
259     {
(gdb) bt
 #0  *INT_cairo_surface_status (surface=0x0) at cairo-surface.c:259
 #1  0x0804baca in tablet_shell_add_launcher (data=0xbfb800ec)
     at tablet-shell.c:404
 #2  launcher_section_done (data=0xbfb800ec) at tablet-shell.c:434
 #3  0x08051121 in parse_config_file (
     path=0x8b96c10 "/root/.config/weston.ini", sections=0x8053c80,
     num_sections=2, data=0xbfb800ec) at config-parser.c:113
 #4  0x0804c0f9 in main (argc=1, argv=0xbfb801d4) at tablet-shell.c:480

Signed-off-by: Juan Zhao <juan.j.zhao@linux.intel.com>
2012-06-21 16:11:10 -04:00
Kristian Høgsberg
88fd40815a terminal: Only hide cursor on first key-press in a repeat sequence
Otherwise moving the pointer while holding a key down will flicker.
2012-06-21 15:55:03 -04:00
Kristian Høgsberg
ae9e073ac5 terminal: Support both Alt and Control modifiers for regular keys 2012-06-21 12:32:23 -04:00
Kristian Høgsberg
b7f94bff3d terminal: Handle Alt-Backspace 2012-06-21 12:32:23 -04:00
Kristian Høgsberg
63b298f3c7 terminal: Set blank cursor on keyboard press
This way we can better see the contents of the terminal.  Show cursor again
on pointer motion.
2012-06-20 23:04: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
b21fb9f61e terminal: Add Ctrl-Shift-N keyboard binding to open new window 2012-06-20 22:44:03 -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
de845cfcc0 terminal: Default terminal type to xterm
We add an option to configure the terminal type so it's still possible to
get xterm-256color.
2012-06-20 22:14:35 -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
71a4cf4374 terminal: Send ASCII DEL on for backspace 2012-06-20 17:57:56 -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
e828e904b5 terminal: Track down remaining unhandled xterm-256color escape codes 2012-06-20 16:59:17 -04:00
Kristian Høgsberg
cca3c2f9da terminal: Fix tab expansion 2012-06-20 15:56:13 -04:00
Kristian Høgsberg
82cd36bfff terminal: Make terminal font configurable from command line and weston.ini 2012-06-20 15:29:07 -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
Alexander Preisinger
e2b88c093a Add minimum size for terminal
At the moment the terminal can a negativ size and resizing it can create
some artifacts.
2012-06-18 15:14:29 -04:00
Daniel Stone
6d4a3c1a39 tablet-shell: Fix compilation warnings
Include unistd.h to get fork and execl prototypes, and remove
declarations of two unused variables.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-18 15:09:45 -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
Alex Wu
5b72a4d21d tablet-shell: Add actual actions for launcher.
The launcher before in tablet-shell just draw the icon and will
not activate a client. This patch makes the launcher as sub-widget
of homescreen, and implements enter/leave/button/redraw hanler to
do the actual client launching action.
2012-06-18 11:06:56 -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
Scott Moreau
3ea23d0767 simple-egl: Minor fix ups.
1) Fix typo when initializing variables
2) Remove gratuitous glFlush() call
3) Localize shader program variable
2012-06-15 10:20:36 -04:00
Pekka Paalanen
01b1725ba0 clients: don't crash weston-desktop-shell without the clock
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-12 12:29:17 -04:00
Pekka Paalanen
b79b635312 simple-egl: move function call out of assert()
On Android, we have NDEBUG defined by the build system.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-12 12:28:16 -04:00
Kristian Høgsberg
e9f68f66dc clock: Default to not show seconds
We can make it configurable, but for now, default to not showing seconds.
2012-06-11 12:24:12 -04:00
Kristian Høgsberg
ed2aae7ab3 clock: Drop transparent background
Too hard to read.
2012-06-11 11:23:31 -04:00
Kristian Høgsberg
92a984a37b clock: Just always do strftime in redraw handler 2012-06-11 11:10:57 -04:00
Kristian Høgsberg
bb262cf45c desktop-shell: Fix broken clock indentation 2012-06-11 11:03:03 -04:00
Rafal Mielniczuk
b9e513c678 desktop-shell: move panel_add_clock call to panel_create function
Putting panel_add_clock in launcher_section_done handler
will cause clock to be created multiple times with every launcher.
Fix is to move the call to panel_create function.
2012-06-11 09:37:46 -04:00
Kristian Høgsberg
70226bbda6 clock: Read fd to avoid 100% cpu usage
In clock_func() it is necessary to read the timer fd, or
it will stay readable, and the event loop will call the function again.
That causes an endless loop.
2012-06-08 16:54:52 -04:00
Martin Minarik
1e51a87f13 desktop-shell: Add panel clock
A panel clock.
2012-06-08 12:52:06 -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
Kristian Høgsberg
fee91be586 terminal: Use serial, not timestamp for setting the selection 2012-06-02 21:21:41 -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
David Herrmann
a6128d6183 terminal: add glyphs to character list
This adds the actual glyphs/utf-8 characters to the comments of CS_SPECIAL
(DEC special graphics set). They all work on my system with "Monospace" or
"Bitstream" font. But keep the mnemonics so if the UTF8 characters are not
displayed correctly, the comments are still readable.

I don't know if gcc actually reads data as UTF-8 or if C code actually
allows all UTF8 characters. However, unless it reads as "*/" in ASCII, it
shouldn't matter inside of comments.

Anyway, it compiles fine with gcc-4.7.0/amd64 here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 09:56:27 -04:00
David Herrmann
516b9e1753 terminal: fix up horizontal scan-line characters
The DEC special graphics set defines entries 0x6f to 0x73 to be:
  Horizontal Scan Line 1
  Horizontal Scan Line 3
  Horizontal Scan Line 5
  Horizontal Scan Line 7
  Horizontal Scan Line 9
However, the first Unicode drafts included only Scan-Line 5. Since
Unicode-3.2 the other Scan-Lines were added and are available in most
Unicode fonts now.

The codes are listed here:
  http://www.fileformat.info/info/unicode/block/miscellaneous_technical/images.htm?start=9089
Or more precisely:
  Scan 1: http://www.fileformat.info/info/unicode/char/23ba/index.htm
  Scan 3: http://www.fileformat.info/info/unicode/char/23bb/index.htm
  Scan 7: http://www.fileformat.info/info/unicode/char/23bc/index.htm
  Scan 9: http://www.fileformat.info/info/unicode/char/23bd/index.htm
Scan 5 is kept the same as before as it wasn't added separately and was
already correct before.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 09:54:50 -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
6150072283 clients: desktop-shell: show tooltip for panel items
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-25 22:54:13 -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
Kristian Høgsberg
b84108d72a simple-egl: Fix crash and simplify
pointer_handle_enter() expects the struct display as the user data, so
just move wl_seat and wl_pointer into struct display.
2012-05-16 16:16:19 -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
20d0028a56 Rename libconfig-parser to libshared
Still a bad name.
2012-05-15 22:37:26 -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
Scott Moreau
7c8b116065 simple-shm: Handle ping event.
Since simple-shm does not use toytoolkit, it needs to respond to ping events so it is not deemed unresponsive.
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
Kristian Høgsberg
d174521b56 resizor: More resizing
Interacts better with interactive resizing, left/right keys now
changes window width.
2012-05-10 23:10:54 -04:00
Kristian Høgsberg
3593f81a5d simple-egl: Add option -o to make surface opaque 2012-05-10 20:40:51 -04:00
Jonas Ådahl
df211839dd clients: Add motion event trails to clickdot
Useful for testing pointer device.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-05-10 19:06:04 -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