Commit Graph

170 Commits

Author SHA1 Message Date
Kristian Høgsberg 5d12990dbe window: Allocate and flush the window surface in window.c
No need to push this to the toolkit users.
2012-01-10 12:25:32 -05:00
Kristian Høgsberg 75bc667a70 window: Drop the window widget
It was just a temporary convenience for moving things over.
2012-01-10 10:45:52 -05:00
Kristian Høgsberg 9ca2d08fb0 window: Run deferred tasks before blocking for initial iteration
The first iteration of the while loop wouldn't run the deferred tasks
before blocking in epoll_wait().  Move things around so we do.
2012-01-09 18:48:14 -05:00
Kristian Høgsberg bb901fac90 window: Return pointer type from widget enter handler 2012-01-09 11:22:32 -05:00
Kristian Høgsberg a8a0db3497 window: Move button handler to widget 2012-01-09 11:12:05 -05:00
Kristian Høgsberg 19dd1d7eb1 window: Use the window widget instead of adding a window sized widget 2012-01-09 10:42:41 -05:00
Kristian Høgsberg 87a57bbd73 window: Create a widget for the window, drop window motion handler 2012-01-09 10:34:35 -05:00
Kristian Høgsberg 5f190ef96a window: Convert a few clients to use widget motion handler 2012-01-09 09:44:45 -05:00
Kristian Høgsberg 04e98344cf window: Add a widget motion handler 2012-01-09 09:36:16 -05:00
Kristian Høgsberg ab9e79ffc2 window: Remove window enter/leave handlers 2012-01-09 09:32:07 -05:00
Kristian Høgsberg 391649b0dc window: Use widget enter/leave handlers for menu 2012-01-09 09:22:30 -05:00
Kristian Høgsberg ee143236d7 window: Replace widget focus handler with a enter/leave handler pair 2012-01-09 08:42:24 -05:00
Kristian Høgsberg 21eabf60b0 window: Use display_exit() instead of exit() in window menu 2012-01-08 15:41:52 -05:00
Kristian Høgsberg 9a13dab8a9 window: Move widget focus handler to the widget 2012-01-08 15:18:19 -05:00
Kristian Høgsberg c51f79954b window: Rename item to widget
It's a widget.
2012-01-08 15:09:53 -05:00
Kristian Høgsberg 4f7dcd6eb1 window: Add a window menu
At least this gives us a way to close the toy toolkit clients.
2012-01-06 22:03:44 -05:00
Kristian Høgsberg b3cca0a411 shell: Start implementing the popup surface type
This lands the basic behavior of the popup surface type, but there are still
a number of details to be worked out.  Mainly there's a hardcoded timeout
to handle the case of releasing the popup button outside any of the
client windows, which triggers popup_end if it happens after the timeout.
Maybe we just need to add that as an argument, or we could add a new event
that fires in this case to let the client decide whether it ends the popup
or not.
2012-01-06 11:41:55 -05:00
Kristian Høgsberg 9724b51750 More weston rename fixes 2012-01-03 14:35:49 -05:00
Kristian Høgsberg e7aaec301a x11: Bridge X11 CLIPBOARD selection to Wayland clients 2011-12-27 13:50:04 -05:00
Kristian Høgsberg e04ad57a01 window.c: Add touch event stubs
Prevent window.c clients from crashing on touch events.
2011-12-22 11:32:38 -05:00
Kristian Høgsberg 8a1d10d66c window.c: Rename input handlers to input_handle_*
They're event handlers for the input object, not the window object.
2011-12-22 11:32:34 -05:00
Pekka Paalanen 325bb60792 window: destroy surfaces on display_destroy()
Destroy the window decoration surfaces and pointer surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:51 +02:00
Pekka Paalanen e1207c708e window: destroy all inputs on display_destroy()
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:51 +02:00
Pekka Paalanen c20529846e window: destroy misc objects on display_destroy()
Windows are supposed to be destroyed by the application explicitly.

Deferred tasks are not supposed to be added after returning from
display_run().

Destroy remaining wl objects (except input related will be in a
following patch).

Close the epoll fd.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:51 +02:00
Pekka Paalanen 2c1426a72f window: destroy outputs on display_destroy()
This will also start calling the output destroy handlers, if an
application has set any.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:51 +02:00
Pekka Paalanen 5ec6585753 window: destroy window surfaces and title
Plugs leaks from struct window in window_destroy().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:51 +02:00
Pekka Paalanen 51ce95a6eb window: remove unused struct members
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen fe6079ac09 window: add display_destroy()
Add a function to destroy the 'struct display', supposedly with all
contained resources, that are not explicitly created by the application.

The implementation at this time is incomplete. It does clean up the
following:
- xkb structure is freed (needs new libxkbcommon from git)
- EGL resources are freed
- wl_display is flushed and destroyed

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen 826d795448 window: add display_exit()
Add a function, that schedules the display_run() event loop to break
out.

When display_exit() is called, processing continues as usual, until
currently waiting events and deferred tasks have been processed, and
sent requests are flushed. Then, display_run() will return.

This enables toytoolkit apps to handle their exit instead of just being
killed or call exit().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Kristian Høgsberg bbedd7e9d2 clients: Implement a toy-menu for testing the menu surface type 2011-12-19 15:40:10 -05:00
Pekka Paalanen 9015ead7d6 window: do proper Cairo device flushing
The Cairo documentation tells us to always call cairo_device_flush()
before using other rendering APIs on the cairo surface, especially where
the Cairo device shares state with us (that is, EGL and GL state in this
case).

Add a call to cairo_device_flush() into display_acquire_window_surface(),
which the toytoolkit offers for switching to native (GL) rendering.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-19 10:50:38 -05:00
Kristian Høgsberg cd9ac1da5f compositor: Remove server side cursors
We always expect the clients to set the cursor and attaching a NULL buffer
hides the cursor.  The cursor starts out hidden.
2011-12-15 09:15:08 -05:00
Pekka Paalanen 999c5b5dcb window: expose outputs to applications
Add output_configure_handler as a display property. This exposes only
configured outputs, that is the current mode info is already received,
to applications.

The handler is also called for mode changes on an existing output. This
simplifies the implementation in toytoolkit as we can defer the handler
calls from wl_output binding time to when we receive the current mode.
We do not need separate handlers for "new output" and "mode changed". A
plain "new output" handler would be problematic as the current mode is
not known yet.

Also add delete_handler hook for outputs, but that will never be called
for now, as the protocol lacks a way to signal output disconnections.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 11:17:46 +02:00
Pekka Paalanen 6b2dc9119e window: do not crash without wl_shell
Since it is the desktop-shell plugin in the compositor that offers both
wl_shell global interface and wl_shell_surface interface, those are not
available on the tablet-shell plugin.

The tablet-shell client uses the toytoolkit, so toytoolkit must work
somehow even without wl_shell.

Turn all operations in toytoolkit that would require wl_shell or
wl_shell_surface into no-ops.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:55:40 -05:00
Pekka Paalanen 068ae944db desktop-shell: update protocol and client to wl_shell_surface
Change desktop-shell protocol to use wl_shell_surface instead of
wl_surface.

Adapt the desktop-shell client and the shell plugin.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:54:34 -05: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
Pekka Paalanen a03a93c6ea window: fix segfault in window_handle_key()
When a window destroyed, if any input had the window in keyboard
focus, the keyboard focus is reset to NULL. A new keyboard focus is set
only, if the user clicks something. If the user presses a key instead of
clicking, the key press event is sent to the client which has NULL
keyboard focus, triggering a segfault in window_handle_key().

Fix the segfault by ignoring the key event, if there is no target
window.

I triggered this segfault by clicking the unlock dialog away, and then
pressing a key.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-02 06:31:08 -05:00
Kristian Høgsberg 53ff2f6672 window.c: Cache outputs 2011-11-26 17:27:37 -05:00
Kristian Høgsberg 47fe08aad5 Implement the new dnd/selection protocol
The new protocol splits dnd/selection from wl_shell and allows us to move
the implementation out of shell.c.
2011-11-23 16:20:28 -05:00
Kristian Høgsberg c5241f5b73 Never include wayland-util.h directly
And fix a missing "" to <> conversion for wayland-client.h include.
2011-11-22 09:35:14 -05:00
Pekka Paalanen 50719bce2a Fix inconsistent #include style
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-22 09:27:03 -05:00
Kristian Høgsberg 980c49e6cd window: Remove unused variable 2011-11-18 15:24:23 -05:00
Pekka Paalanen 77cbc951cb window: clean up redraw and focuses on destroy
Currently, the way to destroy a window in a response to an event (e.g.
button click), is to put a task into the deferred list with
display_defer(). The task will then call window_destroy() from outside
event handling code.

As events are handled, it is possible that the deferred list contains
also the redraw task for this window. As the execution order of these
tasks is unknown (redrawing a freed window is a bug) and redrawing
something that goes away immediately is not useful, the redraw task must
be removed on window_destroy().

'struct input' contains pointers to windows currently in focus for that
input device. These pointers must also be cleared on window_destroy().
This fixes a use-after-free bug for the unlock dialog in desktop-shell
(future commit).

As an irrelevant minor cleanup, window::grab_device member is not used
anywhere, and is removed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 16:43:24 -05:00
Rob Bradford 8bd35c7770 window: Avoid setting an invalid surface for the pointer
If we failed to load the pointer image to the surface then do not create a
buffer from a NULL surface and do not attach that to the device.
2011-10-25 12:20:51 +01:00
Rob Bradford 21223bf6d1 window: Report an error if we cannot load the pointer files 2011-10-25 12:19:36 +01:00
Kristian Høgsberg bcee9a4b25 desktop-shell: Add beginning of pop-up menu to panel 2011-10-12 00:36:16 -04:00
Benjamin Franzke 1a89f28c7d gears: Fail if compiled without cairo-egl 2011-10-07 10:06:01 +02:00
Benjamin Franzke 0c99163d9b window: Create a cairo device for each egl config 2011-10-07 10:06:01 +02:00
Benjamin Franzke 47eb8f4e91 window: Remove display_flush_cairo_device
Rather add a flush_surface utility that
flushed the cairo_device thats associated to a surface.
2011-10-07 10:05:57 +02:00
Kristian Høgsberg e4fb78de8f Handle compositors without wl_shell 2011-09-21 17:43:32 -04:00