Commit Graph

42 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
01a9f1b992 clients: Set title for all shell surface demos. 2012-10-09 23:13:01 -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
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
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
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
Ander Conselvan de Oliveira
57e0ce1d2a simple-egl: Make window moveable 2012-06-26 10:21:23 -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
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
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
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
3593f81a5d simple-egl: Add option -o to make surface opaque 2012-05-10 20:40:51 -04:00
Ander Conselvan de Oliveira
d51624f915 simple-egl: add option for running fullscreen 2012-05-02 10:04:31 -04:00
Bill Spitzak
d273e28567 weston: Don't ask for EGL depth buffer if not needed
This makes the compositor and demo clients work on the current nouveau
nvfx driver. Obviously does not fix any clients that actually want a
depth buffer, but this does allow more people to at least try wayland.
2012-03-20 22:43:56 -04:00
Kristian Høgsberg
fcfc83f6ae clients: Use wl_display_disconnect() 2012-02-28 14:34:54 -05:00
Kristian Høgsberg
8e81df4503 Use new format codes 2012-01-11 14:24:46 -05:00
Pekka Paalanen
fb850c4e0f simple clients: flush before destroying wl_display
Flush our pending destroy requests to the server before destroying the
wl_display.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen
2c2c1060e9 simple-egl: implement destructors
Destroy all wl objects and call EGL cleanup functions. Reduces leaks
reported by Valgrind considerably, though not to zero.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen
88e60fc2ba simple clients: add signal handler for clean exit
Add signal handler for SIGINT to simple-egl and simple-shm, so they can
be exited voluntarily, without killing them. Later we can add clean-up
code and destructors, and check with valgrind for leaks and errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen
9d1613eb4a wl_shell_surface adaptation
Protocol changes in Wayland core introduced a new interface
wl_shell_surface, and moved all wl_shell surface methods into it. Adapt
the compositor and its Wayland backend, shell plugin, and all clients to
the new interface.

Depends on the Wayland core commit "protocol: introduce wl_shell_surface"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:54:26 -05:00
Kristian Høgsberg
9ef9e0ecf9 simple-egl: Remove leftover wl_visual variable 2011-10-19 21:16:58 -04:00
Benjamin Franzke
91eacca38b Remove egl display type setenv hack
No longer needed with mesa 7.12-devel egl display autodetection.
2011-08-31 16:25:18 -04:00
Kristian Høgsberg
f389cacc20 Move away from visuals and just use EGLConfigs or shm format tokens 2011-08-31 16:21:38 -04:00
Kristian Høgsberg
2415990461 clients: Remove a few unused variables 2011-08-29 17:12:36 -04:00
Kristian Høgsberg
f790c79ec7 Use wl_display_bind() for binding to globals 2011-08-29 17:12:36 -04:00
Kristian Høgsberg
334182062f Use the new wl_callback interface 2011-08-29 17:12:36 -04:00
Kristian Høgsberg
2669f72e95 clients: Rename simple-client to simple-egl 2011-07-21 08:42:58 -07:00