Commit Graph

564 Commits

Author SHA1 Message Date
FORT David f7bb9352f7 weston: release keyboard/touch/pointer objects
This patch adds the missing calls to release when the seat has capabilities
changes. It also fixes a missing release of the touch object and a leak with
old clients.

Signed-off-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-10-09 15:23:08 -05:00
Derek Foreman 673bbe2e8c clients: ungrab the correct input when menus close
We need to input_ungrab() on the stored input, not the one that caused
the release - otherwise bad things can happen in multi-seat environments
when a seat that didn't open the menu closes it.

To reproduce:
 configure two seats
 launch weston terminal
 open the right click pop up
 select a menu item from the other seat

The next click from the seat that opened the menu will cause a segfault.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-22 18:22:28 -07:00
Jonas Ådahl decc965be9 clients: Drop deadlock circumvention hack now that we don't need it
mesa supports EGLSwapInterval 0 now, so lets remove this hack. As a
bonus we don't conflict with the XDG shell protocol that doesn't allow
committing a null-buffer, which was a side effect of this hack.

This patch reverts e9297f8e7e. See that
commit for an explanation how this worked.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
[Pekka: added reference to the original commit]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-08-21 15:22:03 +03:00
Dawid Gajownik 74a635b1ec Coding style fixes
- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-08-07 12:01:22 -07:00
Derek Foreman 118a429504 window: Use wl_cursor_frame_and_duration() for mouse cursor updates
Some animated cursor sets use very long delays, but until now we'd use the
frame callback and update the cursor at the display framerate anyway.

Now we use a timerfd to drive cursor animation if the delay is longer
than 100ms, or the old method for short delays.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-17 17:48:45 -07:00
Bryce Harrington da9d8fa3e4 clients: Simplify memory allocation with xzalloc()
It is redundant to check x*alloc's return value for null pointers, since
they are guaranteed to either return non-NULL or terminate the program.

In cases where we memset the malloc'd memory to 0, we can more
efficiently use the xzalloc() routine.  zalloc looks for opportunities
to return memory chunks that have already been zero'd out, so it can
provide better performance.

This patch addresses this warning, reported by Denis Denisov:

  [clients/window.c:1164] -> [clients/window.c:1166]: (warning) Possible
  null pointer dereference: surface - otherwise it is redundant to check
  it against null.

  [clients/window.c:4513] -> [clients/window.c:4514]: (warning) Possible
  null pointer dereference: surface - otherwise it is redundant to check
  it against null.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2015-07-10 00:15:42 -07:00
Jon Cruz d618f688d5 Moved the MIN() macro to the helper include.
Removed multiple definitions of the MIN() macro from existing
locations and unified with a single definition. Updated sources
to use the shared version.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:52 -07:00
Jon Cruz 35b2eaa989 Moved helper macro to a discrete include file.
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:45 -07:00
Jon Cruz 4678bab13c Remove redundant #include path component.
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:09 -07:00
Bryce Harrington 1f6b0d1d2c clients: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Michael Vetter 2a18a52844 remove trailing whitespaces
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
2015-05-15 13:12:32 -07:00
Pekka Paalanen 6c71aaeec5 Pass config file from compositor to everything
We have the Weston command line option '--no-config' which is meant to
prevent loading weston.ini at all. It works for Weston itself, but it
does not work for any clients that also want to read weston.ini.

To fix that, introduce a new environment variable WESTON_CONFIG_FILE.
Weston will set it to the absolute path of the config file it loads.
Clients will load the config file pointed to by WESTON_CONFIG_FILE. If
the environment variable is set but empty, no config file will be
loaded. If the variable is unset, things fall back to the default
"weston.ini".

Note, that Weston will only set WESTON_CONFIG_FILE, it never reads it.
The ability to specify a custom config file to load will be another patch.

All programs that loaded "weston.ini" are modified to honour
WESTON_CONFIG_FILE.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-27 09:38:12 +02:00
Jonny Lamb abff883d2c platform: rename create_egl_window to create_egl_surface
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 4bdcb5732b clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:57:24 -07:00
Jonny Lamb 51a7ae5f89 clients & tests: use eglGetPlatformDisplayEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:56:38 -07:00
Bryce Harrington a86c3ee697 Spellcheck fixes
./ivi-shell/README:19: protocal  ==> protocol
./src/compositor.h:596: seperate  ==> separate
./src/version.h.in:33: actualy  ==> actually
./src/cms-helper.h:44: embeded  ==> embedded
./protocol/fullscreen-shell.xml:65: seperate  ==> separate
./protocol/xdg-shell.xml:150: auxilliary  ==> auxiliary
./clients/window.c:1035: preferrably  ==> preferably

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-19 17:02:08 +02:00
Derek Foreman 493d979e57 window: Fix crash in input_set_pointer_image when cursor is special
Certain circumstances may lead to the "force" clause in
input_set_pointer_image() being reached when the current cursor
is blank or unset.  These are special cursors that don't have
images, and they need to be handled differently than image cursors.

This patch puts the special cursor handling in its own function and calls
it from both places that need it.  Previously only the frame callback
handler did this correctly.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-05 10:14:25 +02:00
Jasper St. Pierre 5ba1e1d137 xdg-shell: Bump unstable version
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:43 +02:00
Jasper St. Pierre 14f330c619 xdg-shell: Remove the flags from get_xdg_popup
There haven't been any ideas for flags, so we don't need a useless,
unused parameter hanging around. Any future ideas should be done with a
new request entirely.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:05 +02:00
Jasper St. Pierre ecf2a0f1ca xdg-shell: Remove the serial from popup_done
It doesn't serve any purpose, as it's a serial that the client gave to
the server when starting the popup, which the client already has.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:58:57 +02:00
Jasper St. Pierre 66bc949b72 xdg-shell: Take a xdg_surface as the parent surface
There is no other valid surface that we should be using here.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:58:35 +02:00
Marek Chalupa a519d06a53 window: use roundtrip instead of dispatch after get_registry
wl_display_dispatch() just dispatches events that are in
default and display queues and if there are no events,
then it will wait for them. But only dispatching
the events doesn't guarantee that we got all the global announcements,
we need to do sync too. Therefore use wl_display_roundtrip() instead
of wl_display_dispatch().

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-12 13:57:05 +02:00
Nobuhiko Tanibata b1d121d835 clients: support ivi-application.xml for clients/window.c
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-04 17:25:50 +02:00
Derek Foreman 2204492636 clients: Use xmalloc in a few more places
Just changes some places where a malloc failure is unhandled
to our xmalloc function that exit()s a little more gracefully.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-28 16:01:22 +02:00
kabeer khan 6ce67ecbce window : compare version and call appropriate destructor
[Pekka Paalanen: removed trailing space, split long line.]

Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 15:27:07 +02:00
Xiong Zhang 382de46a2f clients: Maximize window when double touch on title bar
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2014-09-22 10:19:44 +03:00
Ondřej Majerech b2c1864777 window: Don't needlessly sync parent and geometry
When a toytoolkit client redraws, the toolkit syncs the parent and
geometry. If a client redraws often (such as the terminal drawing a huge
amount of output), this can spam the compositor with requests and may
result in the client's eventual being killed.

We don't need to send requests for changing the geometry or parent if
these haven't changed. So remember the last geometry and parent, and
update them only if needed.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83297
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-15 11:22:05 +03:00
Pekka Paalanen 2623786277 Partially revert "xdg-shell: Add show_window_menu request"
This reverts the parts of commit 81ff075bf4
that touch window.c.

This brings the toytoolkit window context menus back, until someone
implements the xdg-shell equivalent in the compositor.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82972
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 11:34:31 +03:00
Xiong Zhang bfb4ade1a0 clients: Maximize window when double click on title bar
Signed-off-by: Xiong Zhang <panda0626@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-04 17:11:22 +03:00
Arnaud Vrac 38d90be5bb window: unbind egl surface and context on surface release
Binding null read and write surfaces to an egl context is not standard

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-27 16:37:44 +03:00
Pekka Paalanen 71182aed84 xdg-shell: bump experimental protocol version
The experimental versioning has not been updated when it was supposed
to. Let's try to be better at it now, as xdg-shell is close to have its
first stable version.

Bump the version now to bring the world into the same exact version.

There may be some protocol changes still coming, but we try to land them
before 1.6 gets out. Those changes will bump the experimental version
again as needed.

When 1.6.0 is released, the experimental version will no longer be
bumped, and no incompatible protocol changes will be made. Xdg-shell.xml
file will move to Wayland in 1.7.0, drop the experimental versioning,
and become stable.

Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 17:47:20 +03:00
Ran Benita 2e1968fa1f Replace deprecated xkbcommon symbols with current names
These symbols (xkb_map_* and others) were replaced in xkbcommon with more
consistent names. See the header xkbcommon/xkbcommon-compat.h for how
the old names map to the new.

The new names have been available since the first stable xkbcommon
release (0.2.0).

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-08-20 01:05:13 -07:00
Jonny Lamb 0695908a9f clients: use repeat_info event details
The weston-info client prints out the values, and the values are
respected in toytoolkit when actually repeating keys..
2014-08-15 15:39:47 +03:00
Jasper St. Pierre a177df09bf window: Don't use the frame's geometry when fullscreen
When fullscreen, we don't actually update the frame's geometry, so we
can't query it for there.
2014-08-05 12:31:04 -07:00
Jasper St. Pierre ccf48fb4f9 shell: Replace set_margin with set_window_geometry
Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.

What happens is that the client want so go maximized, so we
calculate the size that we want the window to resize to (640x480),
and then add on its margins to find the buffer size (+10 = 660x500),
and then send out a configure event for that size. The client
renders to that size, realizes that it's maximized, and then
says "oh hey, my margins are actually 0 now!", and so the compositor
has to send out another configure event.

In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.
2014-07-17 13:59:01 -07:00
Jasper St. Pierre bd65e50875 Interpret the size in the configure event as window geometry
The size of the configure event has always been specified as in window
geometry coordinates, but it was never implemented this way.
2014-07-17 13:58:45 -07:00
Jasper St. Pierre 81ff075bf4 xdg-shell: Add show_window_menu request 2014-05-23 09:43:17 -07:00
Jasper St. Pierre de8bd50d35 clients: Allow creating a "detached" menu
This will be used by the xdg_surface.show_menu_window implementation.
2014-05-23 09:37:19 -07:00
Jasper St. Pierre dda9313bd9 clients: Remove the window / user parameters from the menu function
We want the ability to create a detached menu.
2014-05-18 13:54:15 -07:00
Kristian Høgsberg be803ad67c window: Send ack_configure immediately from configure handler
Once we've updated the window state and scheduled a resize, we know that
the next frame we send to the compositor will match the configured state.
This means we can just ack the configure immediately and not jump
through hoops to try to do it from the redraw stage.
2014-05-12 23:34:34 -07:00
Jasper St. Pierre f184c382e8 window: Move the resize after interpreting the states
As the protocol says, the states determine how the width and height
arguments should be interpreted, so it makes logical sense to do the
interpretation after.
2014-05-12 23:34:31 -07:00
Jasper St. Pierre ccf908b078 window: Set frame flags immediately when we handle the new states in configure 2014-05-12 23:34:05 -07:00
Jasper St. Pierre 973d7879e3 xdg-shell: Turn "activated" into a state
This drops two events, and makes new window decorations race-free with
an attach in-flight.
2014-05-12 23:34:05 -07:00
Jasper St. Pierre de6809912e terminal: Only add the new size to the title when we're resizing
Add a new state_changed_handler callback to the window to know when the
window has changed state; the terminal will use this to know when the
window started and ended its resize operation, and modify the terminal's
titlebar accordingly.
2014-05-12 23:34:05 -07:00
Jasper St. Pierre 5befdda84f xdg-shell: Turn the resizing heuristics into an explicit state
Currently, there's a race condition. When resizing from the left, and
a client attaches a buffer after the resize ends, you suddenly see the
buffer jump to the right, because the resize ended while multiple
attaches were in-flight. Making resize a state can fix this, as the
server can now know exactly when the resize ended, and whether a commit
was before or after that place.

We don't implement the correct tracking in this commit; that's left as
an exercise to the reader.

Additionally, clients like terminals might want to display resize popups
to display the number of cells when in a resize. They can use the hint
here to figure out whether they are resizing.
2014-05-12 23:34:05 -07:00
Jasper St. Pierre ab2c108137 xdg-shell: Rework the state system
The states system, so far, has been a complicated mix of weird APIs
that solved a real race condition, but have been particularly ugly
for both compositors and clients to implement.
2014-05-12 23:33:59 -07:00
Jasper St. Pierre c815d62b85 xdg-shell: Rename set_transient_for to set_parent
It's a confusing name that comes from the ICCCM. The ICCCM is best
forgotten about.

With the addition of the potential new "transient" role meaning a
parent-relative toplevel like a long-lived popup, used for e.g.
tooltips, the set_transient_for name will become even more confusing.
2014-05-13 00:35:30 -04:00
Ander Conselvan de Oliveira a57c9f1b90 window: Ignore input events from subsurfaces
Toytoolkit was not designed to handle input from subsurfaces and
instead it expects subsurfaces to have an empty input region. That way
input events for subsurfaces are generated on the main surface and
there is no need to convert coordinates before reporting the event to
the user.

However it is possible that a subsurface has a non-empty input region,
but in that case those events aren't properly processed. The function
window_find_widget() assumes the coordinates are in the main surface
coordinate space, and ends up chosing the wrong widget.

This patch changes the input code to completely ignore input events from
subsurfaces. This option was chosen instead of ensuring that the input
region on those surfaces is always empty since there's no enforcement
that a subsurface should completely overlap with the main surface. If
an event happens in the area of the surface that doesn't overlap, the
event could cause a completely unrelated surface to be picked.

https://bugs.freedesktop.org/show_bug.cgi?id=78207
2014-05-12 12:50:00 -07:00
Jasper St. Pierre bf39e5e1ba window: Add a simple getenv to force SHM rendering 2014-04-30 21:04:34 -07:00
Jasper St. Pierre bd600774be window: Clean up buffer type choosing
Extracting it to a function makes this cleaner and more
understandable.
2014-04-30 21:04:22 -07:00