Commit Graph

3700 Commits

Author SHA1 Message Date
Ander Conselvan de Oliveira fc63fddcee shell: Reset fullscreen and maximized state on output unplug
When a view is moved to another output because its current output was
unplugged, remove the fullscreen and maximized state.
2013-12-16 17:23:08 -08:00
Zhang, Xiong Y 31236932a1 desktop-shell: Invalidate saved position when output is destroyed
If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 17:23:08 -08:00
Ander Conselvan de Oliveira 54e90c7e1e compositor: Make pointers visible when an output is unplugged
Previously, if a pointer was inside an output that was unplugged, it
could potentialy end up outside any valid output forever. With this
patch, the pointer is moved to the "closest" output to the pointer.
2013-12-16 17:23:08 -08:00
Ander Conselvan de Oliveira e1e2352dcc compositor: Don't repaint outputs being destroyed
Set a flag when an output is being destroyed and use that to avoid
repainting. This allows functions that schedule an output repaint to
be called when the output is being destroyed without causing the
compositor to crash.
2013-12-16 17:23:01 -08:00
Zhang, Xiong Y 010d0b1695 compositor: Ensure views are visible if their output was unplugged
Use the output destroy signal to move the views in the event the output
was unplugged.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 16:46:22 -08:00
Zhang, Xiong Y f301241d1a compositor: Move views when outputs are moved
Previously, when an output was moved due to another output being
unplugged, the views on the first output would remain in the same
position.

This patch adds an output_move signal that the views listen too in
order to repostion themselves in the event of an unplug.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 16:23:11 -08:00
Ander Conselvan de Oliveira 62a9075a6b compositor-headless, compositor-rdp: Don't call weston_output_move()
The call to weston_output_move() when creating the output is
unnecessary. That is already called by wesotn_output_init().
2013-12-16 16:21:10 -08:00
Zhang, Xiong Y a4b54c0b79 compositor: Move the logic of moving outputs into the core
Instead of having the backends move the remaining outputs when one is
destroyed, let the core compositor deal with that.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2013-12-16 16:20:51 -08:00
Ander Conselvan de Oliveira f749fc3782 compositor: Remove output from list in weston_output_destroy()
When destroying ouputs, they would sometimes be removed before the call
to weston_output_destory() and sometimes after, depending on the
backend. Now the output is remove withing that function so the behavior
is standard across all backends.
2013-12-16 16:19:46 -08:00
Ander Conselvan de Oliveira f54fa4db2b compositor-x11: Only destroy one output when the close button is pressed
Instead of terminating the compositor, destroy the output whose close
button was clicked and move the other outputs, as is done in the drm
backend.
2013-12-16 16:19:23 -08:00
Kristian Høgsberg d0cb10a36b evdev: Drop joystick rejection heurstics
We now no longer add joysticks at all.  They show up as absolute motion
devices without has_button, so we don't add them as a pointer.  We may add
a keyboard for the keyboard-style keys, but that's fine.  With the previous
commit, we no longer generate spurious absolute pointer motion for the abs
axes.

https://bugs.freedesktop.org/show_bug.cgi?id=71687
2013-12-16 16:15:47 -08:00
Kristian Høgsberg cd2f46f3d2 evdev: Reject absolute motion if we're not a pointer or a touch device
Some joysticks have certain buttons that acts keyboard keys.  As such,
we'll reconize them as keyboards but not pointers.  In that case, don't
send pointer motion events when we get absolute joystick events.
2013-12-16 15:51:22 -08:00
Kristian Høgsberg c67fd1cf0e evdev: Drop obsolete accelerometer reject rule
This rule triggers for devices with an ABS_X/Y evaluators and no
keyboard or multitouch events.  There is no way we would ever add such
a device as a pointer, keyboard or touch device anyway.  A pointer
device requires has_button (in which case the !has_key condtion would
fail); a keyboard device would also mean !has_key is false and a touch
screen device implies that !device->is_mt is false.
2013-12-16 15:44:26 -08:00
Kristian Høgsberg de5f82c90d evdev: Remove EVDEV_TOUCH and with it evdev_device->caps
We now keep all the configuration intermediate results inside
evdev_configure_device() and the result is device->seat_caps.
2013-12-16 15:42:51 -08:00
Kristian Høgsberg 3d793c9053 evdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit 2013-12-16 15:42:38 -08:00
Kristian Høgsberg 77b0d23c00 evdev: Replace EVDEV_BUTTON with local has_button flag 2013-12-16 15:11:31 -08:00
Kristian Høgsberg b7c58de8f6 evdev: Replace EVDEV_MOTION_ABS with local has_abs flag 2013-12-16 15:11:30 -08:00
Kristian Høgsberg 8d31a3ae56 evdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events
We split up has_abs into plain ABS_X/Y and MT events, but this shouldn't
introduce any logic changes.
2013-12-16 15:11:30 -08:00
Kristian Høgsberg 015e73dc33 evdev: Drop EVDEV_MOTION_REL flag
This is only used inside evdev_configure_device() and we now use a local
has_rel flag instead.
2013-12-16 15:11:30 -08:00
Kristian Høgsberg d24a64ea30 evdev: Combine evdev_handle_device() and evdev_configure_device()
We split the device probing and idenfication somewhat arbitrarily between
these two functions.  This commit combines them into one.  Return of -1
indicates error, 0 success, but succesful probing can return a device
with device->caps == 0, which means we don't handle the device.
2013-12-16 15:11:30 -08:00
Giulio Camuffo 1aaf3e42e2 sdk: make C++11 plugins build again
compositor.h must not define a 'static_assert' macro, since that
conflicts with the new 'static_assert' in the standard and breaks
the build.
2013-12-09 16:20:48 -08:00
Jasper St. Pierre 80c798bdf0 Update .gitignore
Ignore the new stacking demo...
2013-12-09 12:19:40 -08:00
Jasper St. Pierre cf389f5917 Update .gitignore 2013-12-09 12:15:41 -08:00
Jasper St. Pierre 8f180d44f5 shell: Fix set_transient_for with a NULL parent 2013-12-09 11:34:09 -08:00
Kristian Høgsberg 8d344a0548 shell: Make sure the shell implementation and protocol versions match 2013-12-08 22:27:11 -08:00
Kristian Høgsberg 1e65840b61 simple-egl: Add option to allow not syncing to compositor repaint cycle
It's the GO FASTER option.
2013-12-07 22:26:23 -08:00
Kristian Høgsberg deb322237b simple-egl: Print fps for the spinning triangle
This is not a benchmark.
2013-12-07 22:26:23 -08:00
Neil Roberts 40c0c3f91e tests: Test whether a simple EGL main loop uses too many buffers
This adds a test that tries to simulate a simple game loop that would
be like this:

while (1) {
        draw_something();
        eglSwapBuffers();
}

In this case the test is relying on eglSwapBuffers to throttle to a
sensible frame rate.

The test then verifies that only 2 EGL buffers are used. This is done
via a new request and event in the wayland-test protocol.

Currently this causes 3 buffers to be created because the release
event generated by the swap buffers is not processed by Mesa until it
blocks for the frame complete event in the next swap buffers call, but
that is too late.

This can be fixed in Mesa by issuing a sync request after the swap
buffers and blocking on it before deciding whether to allocate a new
buffer.
2013-12-07 22:26:23 -08:00
Giulio Camuffo 65a07f8aef input: make sure the devices get the resource destruction signal
The device may not have a resource for the client yet, but install
the listeners nevertheless.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=65726
2013-12-06 11:19:38 -08:00
Kristian Høgsberg c8f8dd894e desktop-shell: Drop next_type from shell_surface
The surface type now no longer changes and we track pending state changes in
next_state.  Instead of testing type != next_type to detect changes in
state, we just look at state_changed.
2013-12-05 23:20:44 -08:00
Kristian Høgsberg 4804a301db shell: Put xwayland surface at the top of the fullscreen layer
An xwayland surface corresponds to a override-redirect window under X,
which is typically a menu or a popup window.  They typically appear
with a keyboard and mouse grab and by nature of being override-redirect
these window can appear anywhere on screen and in the stack.

We need to resort to heuristics to decide where to place the
override-redirect in our surface stack, and for now we'll just put it on
top of everything.  That's going to be correct for almost all cases of
clicking to open a menu, but we can revisit and refine if we run into
a case that needs better handling.
2013-12-05 22:43:03 -08:00
Kristian Høgsberg 41fbf6f7fd desktop-shell: Make set_toplevel() clear surface states
This is used from wl_shell and xwayland and we need to make sure
xwayland also gets this behavior.
2013-12-05 22:31:25 -08:00
Kristian Høgsberg e960b3f012 desktop-shell: Set fullscreen flags in common code path
Just as for set_maximized() we can move the setting of the fullscreen and
state_changed flags into the common set_fullscreen() function.  This
function is also used from the xwayland wm to set fullscreen windows, and
with this change that now works again.
2013-12-05 22:04:42 -08:00
Kristian Høgsberg c2745b14f0 desktop-shell: Set maximized flags in common code path
We can set the maximized and state_changed flags in set_maximized(),
which is shared between shell_surface_set_maximized() and
xdg_surface_set_maximized().
2013-12-05 22:00:40 -08:00
Kristian Høgsberg acdae2e641 stacking: Set a keyboard focus handler so we can repaint the frame
Yes, perhaps this should be more automatic...
2013-12-05 15:37:29 -08:00
Rafael Antognolli 5031cbe7b4 shell: Don't try to switch to a NULL shell surface.
Fixes the crash from alt+tab when there's a fullscreen surface.
2013-12-05 15:37:29 -08:00
Rafael Antognolli db59f9a53f shell: Set a surface as TOPLEVEL instead of the old surface types.
Since internally there's no more SHELL_SURFACE_FULLSCREEN and
SHELL_SURFACE_MAXIMIZED, the surface must be set to
SHELL_SURFACE_TOPLEVEL on the respective functions.

This fixes the bug when clients start already in fullscreen mode. In
that case, they aren't set first to toplevel, and then change to
fullscreen. They are set as fullscreen directly, not receiving the
SHELL_SURFACE_TOPLEVEL type on the set_fullscreen function.
2013-12-05 15:15:11 -08:00
Kristian Høgsberg a98c2e17fd compositor-x11: Damage output when we receive expose events for the window
The gl renderer typically repaints everything since we don't have
EGL_buffer_age under X, but the pixman renderer carefully only repaints
damaged regions.  So to actually repaint anything with the pixman
renderer, we need to damage the output.

https://bugs.freedesktop.org/show_bug.cgi?id=72351
2013-12-05 12:30:39 -08:00
Rafael Antognolli 44a3162eea shell: Add missing break to a case statement inside set_surface_type.
This should fix the surface not going back to its original position
after unsetting fullscreen or maximized states.

https://bugs.freedesktop.org/show_bug.cgi?id=72321
2013-12-05 12:02:36 -08:00
Neil Roberts a5059eb187 nested: Add an option to disable subsurfaces
This adds a -b option to force the nested compositor example to use
the old blit renderer even if the appropriate extensions are
available.
2013-12-04 16:34:08 -08:00
Neil Roberts 1f020a1fdb nested: Add a renderer using subsurfaces
Adds a second renderer implementation to the nested compositor example
that creates a subsurface for each of the client's surfaces. The
client buffers are directly attached to the subsurface using the
EGL_WL_create_wayland_buffer_from_image extension instead of blitting
them in the redraw_handler.

The new renderer is always used if the parent compositor supports the
wl_subcompositor protocol and the EGL extension is available.
Otherwise it will fall back to the blit renderer.
2013-12-04 16:34:07 -08:00
Neil Roberts 5e10a04481 clients: Add a widget_get_wl_subsurface
Adds a simple accessor for the wl_subsurface for widgets created with
window_add_subsurface.
2013-12-04 16:34:07 -08:00
Neil Roberts 47b87d5ec0 nested: Add a ‘renderer’ mechanism with a vtable
Eventually the nested compositor example will want to be able to cope
with either rendering as it does now with a blit to an intermediate
surface or by attaching the client buffers directly to a subsurface
without copying. This patch moves the code that is specific to the
blitting mechanism into a separate set of functions with a vtable to
make it easier to add the second way of rendering in a later patch.
2013-12-04 16:34:07 -08:00
Neil Roberts f9b2541df1 nested: Move the frame callback list to the surface
Previously the frame callback list was tracked as part of the global
compositor state. This patch moves the list to be part of the surface
state like it is in Weston. The frame callback now iterates the list
of surfaces to flush all of the callbacks. This change will be useful
when the example is converted to use subsurfaces so that it can have a
separate frame callback for the subsurface and flush the list for an
individual client surface rather than flushing globally.
2013-12-04 16:34:07 -08:00
Neil Roberts 2855766333 nested: Add damage tracking to the nested compositor example
The nested compositor example now responds to damage requests and
tracks them in the pending buffer state. This isn't currently used for
anything and it is immediately discarded when the surface is commited
but it will be used later when the example is converted to use
subsurfaces.
2013-12-04 16:34:07 -08:00
Neil Roberts 15a8d340fd nested: Add double-buffered state semantics to the nested example
The buffer and frame callback state on the surfaces in the nested
compositor example are now double-buffered so that they only take
effect when the commit request is received. This doesn't really make
much difference for the current state that the example has but it will
be useful when more state is added in later patches.
2013-12-04 16:34:07 -08:00
Neil Roberts 6bf23879e9 nested: Add the buffer reference semantics from Weston
This copies the buffer reference busy count implementation from Weston
to the nested compositor example and adds an internal nested_buffer
struct that we could eventually use to attach data. This will be
useful to adapt the example to use subsurfaces so that we can attach
our compositor-side buffer to the resource.
2013-12-04 16:34:07 -08:00
Neil Roberts 8fbe3a68d4 nested: Remove the surface from the surface list when destroyed
Otherwise if the surface is destroyed then it will crash when it later
tries to render all of the surfaces. You can replicate this by doing
killall weston-nested-client while the example is running.
2013-12-04 16:34:07 -08:00
Kristian Høgsberg b7fd89192f build: Fix out-of-tree build for desktop-shell 2013-12-04 12:57:02 -08:00
Rafael Antognolli ba5d2d76af shell: Fix activate logic on surface map.
It should activate the newly mapped surface if not locked.
2013-12-04 11:55:03 -08:00