Commit graph

300 commits

Author SHA1 Message Date
Kristian Høgsberg 3c17933de8 Use #define WL_HIDE_DEPRECATED to avoid deprecated warnings for wl_buffer 2013-08-06 19:27:04 -07:00
Kristian Høgsberg 9e5d7d17a7 shell: Remove redundant weston_pointer field from shell_grab
This is already in weston_grab.
2013-07-25 09:50:34 -07:00
Rob Bradford bdeb5d224d shell: Respect output transformation for input panel surface
Rather than using the dimensions in the mode we can use the recently
added output width and height members which are updated to reflect any
output rotation.

https://bugs.freedesktop.org/show_bug.cgi?id=66798
2013-07-12 23:56:18 -04:00
Kristian Høgsberg 919cddb0ab Convert to wl_global_create/destroy() 2013-07-09 02:02:11 -04:00
Kristian Høgsberg 6780073d78 shell: Always go through end_busy_cursor when ending the busy cursor grab 2013-07-04 01:12:17 -04:00
Kristian Høgsberg c9974a0796 shell: Dont set grab cursor if desktop-shell client died
If we don't have a desktop-shell helper client, don't try to send events
to it.

https://bugs.freedesktop.org/show_bug.cgi?id=65961
2013-07-03 19:26:04 -04:00
Rob Bradford dfe310512b shell: Allow ending of popup grabs from within the starting of the grab
Calling weston_pointer_start_grab can lead to a code path (in this case
when the shell surface is unresponsive) that can try and remove the
popup grab to setup a shell grab.

Ending the popup grab requires removing the surface from the grab's
surfaces list - however the grab had not yet been fully setup so the
grabbed surface was not yet in this list.

With this change we ensure we add the surface to the list before setting
up the pointer grab.

https://bugs.freedesktop.org/show_bug.cgi?id=66167
2013-07-03 19:06:25 -04:00
Louis-Francis Ratté-Boulianne 9a4f10f6bc shell: Fix calculation of center point in surface rotation
Make sure the center point of a rotation is not rounded to an
integer. It makes the calculation consistent with others in the
shell. It also ensures surfaces rotated 180 degrees are at the
exact same place.
2013-07-03 17:09:03 -04:00
Jason Ekstrand a85118c1b8 Use wl_resource_create() for creating resources
This commit sets the version numbers for all added/created objects.  The
wl_compositor.create_surface implementation was altered to create a surface
with the same version as the underlying wl_compositor.  Since no other
"child interfaces" have version greater than 1, they were all hard-coded to
version 1.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-07-03 14:52:06 -04:00
Kristian Høgsberg f00460771e compositor: Fix remaining double free()s
Previous commit didn't catch all double free()s, hopefully this one does.
2013-06-25 11:19:31 -04:00
Quentin Glidic 8418c298af shell: Free temporary strings
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2013-06-20 15:22:35 -04:00
Kristian Høgsberg 1cfd406f9d shell: Tweak spring animation for zoom animation type 2013-06-17 11:08:11 -04:00
Kristian Høgsberg 8eb0f4f830 shell: Fix warning and indentation in shell_surface_configure() 2013-06-17 10:33:22 -04:00
Kristian Høgsberg 5281fb1500 spring: Tweak the window fade-in spring to not overshoot
The fade animation overshoots and rings for a bit dipping back into
slightly transparent.  Bug 61675 was right.

https://bugs.freedesktop.org/show_bug.cgi?id=61675
2013-06-17 10:32:09 -04:00
Jason Ekstrand a0d2dde6cd output: Use wl_resource_get accessors for weston_output resources
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 16:51:20 -04:00
Jason Ekstrand 44a3863a17 input: Use wl_resource_get accessor functions for resources
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 16:49:11 -04:00
Jason Ekstrand 51e5b14952 input_panel_surface: Change resource to a wl_resource pointer
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 16:49:11 -04:00
Jason Ekstrand 651f00e94a shell: Convert resources to pointers
This commit converts shell_surface.resource to a pointers and updates
shell.c to use wl_resource_get accessors for shell_surface, desktop_shell,
screensaver, and workspace_manager related resources.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 16:49:10 -04:00
Jason Ekstrand 0f2ef7ebd3 Use wl_resource_get_user_data for weston_surface resources
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 15:58:29 -04:00
Tiago Vignatti fb2adba3da xwayland: Forward global position to X
xeyes works as expected now. subwindows are popped also as expected. This
patch should fix the following:

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

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2013-06-14 15:29:02 -04:00
Jason Ekstrand 26ed73cee8 Change weston_surface.resource to a wl_resource pointer.
This is the first in what will be a series of weston patches to convert
instances of wl_resource to pointers so we can make wl_resource opaque.
This patch handles weston_surface and should be the most invasive of the
entire series.  I am sending this one out ahead of the rest for review.

Specifically, my machine is not set up to build XWayland so I have no
ability to test it fully.  Could someone please test with XWayland and let
me know if this causes problems?

Because a surface may be created from XWayland, the resource may not always
exist.  Therefore, a destroy signal was added to weston_surface and
everything used to listen to surface->resource.destroy_signal now listens
to surface->destroy_signal.
2013-06-12 15:04:49 -04:00
Daniel Stone c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Alexander Larsson 690f718834 shell: Position DRIVER fullscreen surfaces at origin
When a window is fullscreened with DRIVER method and we succeeded
in changing mode we need to actually move the surface to the
origin of the output, or it won't be used for scanout.
2013-05-29 10:18:15 -04:00
Alexander Larsson d622ed3fbf shell: Center window in fullscreen if needed
If modeset fails With DRIVER method, and always with FILL method
we want to center the window.
2013-05-28 17:22:04 -04:00
Alexander Larsson f82b6cac5e shell: Always go to original mode when focused window not fullscreen
Right now we only switch mode on activating a fullscreened window.
This has several problems:

* Once you're in fullscreen its hard to switch to a non-fullscreened
  window with alt-tab as you stay in the small resolution.
* If you switch from a fullscreened window to a non-fullscreened
  window and the fullscreened window is destroyed we will not
  restore the original mode (since the window is not
  shell_surface_is_top_fullscreen()
* Its hard to reach a different output on the right with the mouse
  when the mode is smaller that the original, as there is a "gap"
  between the two outputs. So, if you alt-tab to another window
  you can not always reach it.

This is somewhat of a sledge hammer, as it means you can't e.g.
focus a non-fullscreen on one output and have a window fullscreened
on another output. However, trying to restore only the outputs
the new window is on is problematic:

* It may later change output
* We want to see all windows anyway during alt-tab
* Can't reach the other windows with the mouse anyway

So, this seems like an ok solution.
2013-05-28 17:22:01 -04:00
Alexander Larsson 355748e3b5 shell: Use buffer_scale as output scale on fullscreen DRIVER
It may happen that you e.g. fullscreen a 800x600 surface with
buffer_scale 1 (e.g. a 800x600 buffer) on an output that is
otherwise scale 2. In this case we want to temporarily set
the output scale to 1, as we're really scanning out of a
scale 1 buffer. This causes us to e.g. report the input
positions in the right place, etc.

When we restore the original mode we also restore the original
scale.

Note that the scale change is a purely compositor internal change,
to clients it still looks like the output is scale 2.
2013-05-28 17:18:56 -04:00
Kristian Høgsberg 14e438c8a2 compositor: Parse config file in main(), only keep weston config object
Now that all backends and modules have been converted to the new
config parser API, we don't have to keep the fd around.
2013-05-26 21:48:14 -04:00
Kristian Høgsberg fc10cc0c65 shell: Remove input panel debug fprintf 2013-05-23 21:47:37 -04:00
Kristian Høgsberg 673a889fd8 shell: Use new config parser 2013-05-23 21:42:04 -04:00
Pekka Paalanen 79346ab3a5 shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.

To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.

If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.

shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 18:07:30 -04:00
Pekka Paalanen 7bb6510748 compositor: add capability flag for arbitrary surface rotation
The upcoming rpi-renderer cannot handle arbitrary rotations. Introduce
Weston capability bits, and add a bit for arbitrary rotation. GL and
Pixman renderers support it.

Shell or any other module must not produce surface transformations with
rotation, if the capability bit is not set. Do not register the surface
rotation binding in desktop shell, if arbitary rotation is not
supported.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 16:46:43 -04:00
Rob Bradford 2f8d9aacfa shell: End grab if the grabbed shell surface has been destroyed
The shell_grab_start function sets up a destroy notification on the
shell surface such that when the shell surface is destroyed the pointer
on the grab to the shell surface is set to NULL.

We must therefore check whether the shell surface is NULL and end the
grab if it is.

https://bugs.freedesktop.org/show_bug.cgi?id=64689
2013-05-20 16:53:49 -04:00
Hardening eb1e13044f Fix surface_pong when a seat doesn't have a pointer
This patch fixes a crash with the surface_pong when one of the
seats doesn't have a pointer. This was the case with the RDP compositor
that use a fake seat with no mouse or keyboard.
2013-05-17 16:30:39 -04:00
Kristian Høgsberg b9f1c5248b lock-surface: Set geometry width and height before centering
The subsurface patches changed the center_on_output() behavior a bit.
Instead of using the buffer width and height, it now looks at surface
geometry.  In lock_surface_configure() we haven't set up the geometry
when we call center_on_output() so the lock surface would never show
up.
2013-05-14 20:59:07 -04:00
Ossama Othman a50e6e4c50 config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config.  This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.

To avoid a TOCTOU race the config file is actually open()ed during the
search.  Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
2013-05-14 14:36:37 -04:00
Giulio Camuffo b836664c42 shell: account for the subsurfaces when going fullscreen or maximizing
We must calculate the bounding box of the surface + subsurfaces set and use
that when maximizing the window or going fullscreen.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-05-10 14:35:33 -04:00
Giulio Camuffo 61da3fc948 shell: enable moving and resizing of a surface when clicking on a subsurface
[pq: changed to weston_surface_get_main_surface(), and used a temporary
variable to clean up the expressions.]

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-05-10 14:35:25 -04:00
Pekka Paalanen 01388e253e shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:

- Move, resize, and rotate bindings always target the parent surface.

- Opacity (full-surface alpha) binding targets the parent surface. This
  is broken, because it should change the opacity of the whole compound
  window, which is difficult to implement in the renderer.

- click_to_activate_binding() needs to check the shell surface type from
  the main surface, because sub-surface would produce SHELL_SURFACE_NONE
  and prevent activation.

- Also activate() needs to check the type from the main surface, and
  restack the main surface. Keyboard focus is assigned to the original
  (sub-)surface.

- focus_state_surface_destroy() needs to handle sub-surfaces: only the
  main surface will be in a layer list. If the destroyed surface is
  indeed a sub-surface, activate the main surface next. This way a
  client that destroys a focused sub-surface still retains focus in the
  same window.

- The workspace_manager.move_surface request can accept also
  sub-surfaces, and it will move the corresponding main surface.

Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
  sub-surfaces in shell, fix focus_state_surface_destroy()

Changes in v3:
- Renamed weston_surface_get_parent() to
  weston_surface_get_main_surface() to be more explicit that this is
  about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
  sub-surface.
- Used a temporary variable in several places to clarify code, instead
  of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-05-10 14:34:54 -04:00
Kristian Høgsberg 6848c25677 input: Move surface picking into the pointer grab focus callback
Currently the core input code does surface picking before calling into
the focus callback of the current grab.  Not all grabs need to pick a
surface however, so we're doing work we don't have to in those cases.

For example, the shell move and resize grabs don't need to pick and the
default grab in implicit grab mode doesn't either.

With this change, the pointer grab mechanism is now very simple:
the focus callback is called whenever the pointer may have a new focus,
the motion callback is called whenever the pointer moves and
the button callback whenever a button is pressed or released.
2013-05-08 22:03:45 -04:00
Kristian Høgsberg be6403ed5c input: Get rid of grab focus concept
This was another complication that we had to have to support the
split between libwayland-server and weston.  Different grabs want to send
events relative to different surfaces at different times.  The default
grab switches between sending coordinates relative to the 'current' surface,
that is the surface the pointer is currently above, or the 'clicked'
surface, in case of an implicit grab.

The grab focus was set by the grab implementation and the core input code
would transform the pointer position to surface relative coordinates for the
grab focus and store in grab->x/y.

Now we can just let the grab implementation transform the pointer
coordinates itself, leaving the implementation free to transform
according to whichever surface it wants.  Or not transform at all if
it doesn't need surface relative coordinates (like the shell move and resize
grabs).
2013-05-08 21:03:23 -04:00
Kristian Høgsberg e122b7ba58 input: Remove 'current' and related fields from weston_pointer
The current surface field was used to track the surface the pointer was
currently over along with pointer position relative to that surface,
regardless of implicit or explicit grabs.  The main purpose was to restore
the default grab when another grab terminated.  We can now just repick in
that case and avoid keeping that state around, with the destroy listener
overhead that involves.

There was one other use case - we used to optimize out calls to
weston_pointer_set_focus() if the focus didn't actually change.  We can
still do that, but we have to do that in the default_grab_focus() handler
and compare against weston_pointer->focus instead.
2013-05-08 16:47:06 -04:00
Kristian Høgsberg fe7aa90ed4 compositor: Adapt to wl_surface going away
struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course).  A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.
2013-05-08 09:54:37 -04:00
Kristian Høgsberg 2bf876282f input: Eliminate weston_seat::has_pointer/keyboard/touch
We can just look at weston_seat::pointer/keyboard/touch now.
2013-05-07 23:40:26 -04:00
Kristian Høgsberg 8799d41b1e compositor: Move fan_debug to gl-renderer
With the debug binding infrastructure, we can do this all inside
gl-renderer.c.
2013-05-07 10:50:09 -04:00
Kristian Høgsberg e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Kristian Høgsberg 4912454ba4 input: Remove wl_seat destroy signal
We already have one on weston_seat.
2013-05-06 22:27:40 -04:00
Kristian Høgsberg 02bbabbd56 input: Rename wl_pointer to weston_pointer
This is now a weston object.
2013-05-06 22:15:05 -04:00
Kristian Høgsberg 29139d4a45 fold wl_keyboard into weston_keyboard 2013-05-06 21:40:36 -04:00
Jan Arne Petersen cc75ec11ca text: Rename input_method to wl_input_method
Also rename input_method_context to wl_input_method_context,
input_panel to wl_input_panel and input_panel_surface to
wl_input_panel_surface.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:18:46 -04:00
Jan Arne Petersen 70d942b4d7 text: Rename ::set_panel to ::set_overlay_panel
Also add documentation to input_panel_surface::set_overlay_panel.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:12:02 -04:00