Commit Graph

4026 Commits

Author SHA1 Message Date
Ander Conselvan de Oliveira
9c376b54ea shell: Fix crash when a client is destroyed during the resize grab
If a client exists during a resize grab, the resource for the shell
surface being resized is destroyed. The shell surface is not destroyed
immediately, however, because of the window close animation. In that
case, the compositor would crash trying to send configure events to
the surface being resized, since it would pass a NULL pointer to
wl_resource_post_event().

The code for the resize grab was already able to handle the surface
going away, so expand it to also handle the resource going away and
fix the crash.

https://bugs.freedesktop.org/show_bug.cgi?id=77344
2014-04-29 13:33:29 -07:00
Ander Conselvan de Oliveira
15f9a26bb1 shell: Fix memory leaks caused by the window close animation
In order to do the window close animation, a reference for a destroyed
surface is kept. However, the reference count was also increased for
unmapped surfaces, in which case the animation wouldn't run. Since the
reference count was decremented in the animation done function, it would
never be decreased for unmapped surfaces, causing them to not be
released.

The close animation also changed how shell surfaces are released. The
destroy function for its resource was changed to not deallocate the
surface, and instead keep it around until the animation finishes and
the weston surface is destroyed. The destruction should happen in the
destroy listener for the weston surface, but it wouldn't destroy the
shell surface in the case the resource was still valid, assuming that
it would be freed in the resource destroy function.
2014-04-29 13:33:26 -07:00
Bryce W. Harrington
66cd2c1ce1 terminal: Convert all *alloc's to x*alloc's.
This ensures the allocation results are checked for NULL (out of
memory), and terminates the program in such a case.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-29 13:25:50 -07:00
Neil Roberts
1e40a7ec7a Simply the matrix calculation for zooming
In order to apply the zoom transformation to the output matrix, Weston was
doing the following:

• Create a temporary matrix to hold the translation
• Invert the translation matrix using weston_matrix_invert into
  another temporary matrix
• Scale that matrix by the scale factor
• Multiply the current matrix with the temporary matrix

Using weston_matrix_invert to invert a translation matrix is over the top.
Instead we can just negate the values we pass to weston_matrix_translate.
Matrix multiplication is associative so creating a temporary matrix to hold the
scale and translation transform should be equivalent to just applying them
directly to the output matrix.
2014-04-25 15:18:37 -07:00
Neil Roberts
a69dc01a6e clients/window: Don't remove the touch listener on a frame event
It looks like the handler for frame events from the wl_touch interface for
widgets may have been erroneously copied from the cancel handler so that it
removes all handlers as they are processed. I don't think this makes much sense
for the frame event. This was stopping the panel icons from being pushable with
touch events when using libinput since commit 1679f232e5. All that commit
does it make it start sending the frame events.
2014-04-25 15:18:37 -07:00
Ander Conselvan de Oliveira
a7caef964b input: Fix errors due to initializing input before creating outputs
Make sure that we don't map a device to an invalid output pointer and
intead remap devices when an output is created.

v2: fix the error with libinput too.
2014-04-25 15:04:04 -07:00
Ander Conselvan de Oliveira
ae826cead7 evdev: Fix assertion error for unplugged output with paired touchscreen
If the output a touchscreen is paired to is unplugged, events coming
from it should be ignored. Commit 17bccaed introduced logic for that
in evdev_flush_pending_damage(). However, the break statements it
introduced would cause the assertion after the switch statement to
fail.

That function has the odd behavior that goto's are used to skip the
assertion after the switch statement and jump to the hunk of code that
marks the event as processed. Only in the case where the event type has
an invalid value the assertion should trigger. So this patch fixes the
problem by moving the assertion into the default case of the switch
and replacing the goto statements with break ones.

https://bugs.freedesktop.org/show_bug.cgi?id=73950
2014-04-25 15:03:46 -07:00
Ander Conselvan de Oliveira
6c975faaa9 evdev: Discard events from a touchscreen paired with an unplugged output
Commit 17bccaed intended to make the events coming from a touchscreen
paired with an unplugged output to be discarded, while an unpaired one
would just choose a different output. However, the logic was inverted
causing the opposite to happen.

Later in commit 161c6c56, the default behavior was changed to map an
output to a default output if the one specified via udev is not
present. This change is reverted by this patch.

v2: undo the change from commit 161c6c56.

v3: deal with libinput too.
2014-04-25 14:55:28 -07:00
Ander Conselvan de Oliveira
f957dfb1de libinput: Don't process touch events for devices without a valid output
That would be the case of a touch screen mapped to an output that was
unplugged.
2014-04-25 14:55:08 -07:00
Jason Ekstrand
4283370e01 pixman-renderer: Use width/height_from_buffer for buffer transforms
This fixes an issue in the pixman renderer where it would not render
surfaces correctly if both wl_viewport and wl_surface.set_buffer_transform
were used.

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-25 14:40:11 -07:00
Jason Ekstrand
d0cebc36fb Use the correct width/height when transforming surfaces with viewports.
Previously, because of the wrong width/height,
weston_surface_to_buffer_* would return the wrong values when
wl_viewport was used in combination with wl_surface.set_buffer_transform.

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-25 13:24:57 -07:00
Bryce W. Harrington
a212cbb0e6 xwayland: Check zalloc return for out of memory situation
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-25 13:20:10 -07:00
Bryce W. Harrington
bfd74f40f3 Check zalloc return for out of memory situation
Most zalloc calls in weston are checked, this fixes a handful that were
being ignored.  As found by `grep -EIsr "[^x]zalloc\(" . -A1`

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-25 13:19:51 -07:00
Kristian Høgsberg
4c3661fd7b desktop-shell: Only use default background if no background color is set
Previously we would only use the set background color if the
background-image value was explicitly set to empty or a non-existing
image.  With this change, we only load the default background image
if there's no configure background image or background color.  In case
of both an image and a color, the image takes precedence as before.
2014-04-21 22:54:37 -07:00
Jonas Ådahl
1679f232e5 libinput: Forward frame events to clients
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77353

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-21 16:03:28 -07:00
Hardening
e57d1f211d Check malloc result
This patch checks malloc was successfull and release resources if it
wasn't.
2014-04-21 15:43:49 -07:00
John Kåre Alsaker
791324cc06 gl-renderer: Remove gl_renderer_interface from gl-renderer.h
The rationale here is, that this line would create an instance of
gl_renderer_interface in every compilation unit that included
gl-renderer.h. This is not necessary, and it can actually be harmful by
masking the real exported gl_renderer_interface symbol, if you added
another compilation unit to gl-renderer.so, causing a runtime failure in
loading it.

gl-renderer.c already creates the exported symbol.
2014-04-21 15:43:05 -07:00
U. Artie Eoff
cb0e3579af weston-info: fix log message typo
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 15:40:26 -07:00
Kristian Høgsberg
6375ea02e5 editor: Remove unused variables 2014-04-21 15:33:51 -07:00
Manuel Bachmann
8986c18f69 editor: react on Enter, Tab, and Up-Down arrow keys
The editor will now insert new lines and tabulations when
pressing the corresponding keys on the virtual keyboard.

The Up and Down arrows can be used to navigate through
lines.

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

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-21 15:32:45 -07:00
U. Artie Eoff
f4ad19a177 seat: don't break in notify_output_create
If more than one input device maps to the new output, then we need
to map all devices to that output... not just the first device.

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 14:38:14 -07:00
U. Artie Eoff
161c6c5694 input: fix input device map to output if it doesn't exist.
If an input device wants to map to an output that does not
exist, then just map it to the first output.

Also, if a device is mapped to an output that gets unplugged then
it gets default mapped to the first output in the output destroy
listener.  However, the original output destroy listener needs to
be removed before adding the new listener for the first output,
otherwise the list gets corrupted.

Later if the other output is plugged back in, we remap the device
to it.  In that case, we should remove the destroy listener for
the first output.

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 14:37:16 -07:00
U. Artie Eoff
cd9e54537a libinput-device: break after LIBINPUT_EVENT_TOUCH_UP
We need to break after handling LIBINPUT_EVENT_TOUCH_UP otherwise
we fall into the default case and end up logging that the event
is unknown and then return the wrong "handled" result.

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

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 14:35:46 -07:00
U. Artie Eoff
c81c4241d9 libinput-seat: allow setting libinput log priority in weston
Look for WESTON_LIBINPUT_LOG_PRIORITY environment variable.  If
it exists then use it to set the libinput log priority.
Otherwise, don't set the priority and get whatever libinput's
default priority is.

Setting WESTON_LIBINPUT_LOG_PRIORITY=0 allows us to log which
input devices are detected at Weston startup and makes it a
little more consistent with Weston's original evdev input setup
log messages... and useful for debugging and testing.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 14:35:33 -07:00
U. Artie Eoff
71db0fd117 libinput-seat: redirect libinput log to weston log
https://bugs.freedesktop.org/show_bug.cgi?id=77578

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 14:34:19 -07:00
Manuel Bachmann
5082ad6b28 shell: display the input panel on the active output
We now dynamically move the input panel (i.e. virtual
keyboard) surface to the output containing the currently
focused surface.

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

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-21 14:34:15 -07:00
Ander Conselvan de Oliveira
4ade0e4a29 compositor-drm: Fix crash when setting up seat constrained by an output
Commit 58e15865 changed the parameters for udev_get_seat_by_name() to
receive a struct udev_input. However, when this gets called from
create_output_from_connector() during initialization, the input struct
is not yet initialized, leading to a crash. Previously, that function
would take only a pointer to the compositor.

This patch fixes the crash by initializing input before creating any
outputs.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77503
2014-04-21 14:34:06 -07:00
Manuel Bachmann
301f06b894 keyboard: add the missing symbols layout, fix arabic layout
The "symbols" modifier key of weston-keyboard is no longer
inactive, but will provide an additionnal layout with
numerals and special characters.

Fix the Arabic keyboard, which was rendering out of the
bounds, and now use the Arabic IBM PC keyboard as a
reference for its standard and new symbols layouts.

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

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-16 22:42:27 -07:00
Ander Conselvan de Oliveira
75c373c76c shell: Destroy a previous input panel animation when showing it again
It is possible that an input panel will be shown quickly, hidden and
shown again, before the animation for the first appeareance finished.
In that case, another animation would be created and the effect of the
two combined could cause the panel to not appear in the screen.

This patch fixes this by keeping a reference to the previous animation
and deleting it when a new one is created.
2014-04-16 22:33:48 -07:00
Ander Conselvan de Oliveira
a4a6f16129 animation: Fix input panel slide animation
The position for the slide animation was calculated assuming the value
of the spring was always between 0.0 and 1.0. Commit 3a869019 broke
that assumption, and the result was that the panel would be positioned
at an invisible part of screen. Since there would be no output repaints
scheduled, the result of the animation would only be seen if something
else triggered a repaint (such as a mouse cursor movement).

This patch changes the values for the slide animation's spring to range
between 0.0 and 1.0, thus fixing the position of the panel and the lack
of scheduled repaints problem.

https://bugs.freedesktop.org/show_bug.cgi?id=77347
2014-04-16 22:33:46 -07:00
Ander Conselvan de Oliveira
f5cc2b560f animation: Split spring setup out of weston_view_animation_run()
All the animations override at least one parameter of the spring that
is set during the creation of the animation. Some need to do the whole
setup again.

This patch changes the initialization of a view animation to a three
step process. First, the animation is created. Then the caller sets up
the spring and calls weston_view_animation_run() to apply the effect of
the animation for the first animation frame.
2014-04-16 22:33:44 -07:00
Marek Chalupa
06f2fa1a60 tests: fix bad-buffer-test
bad-buffer-test is FAIL_TEST and every assert() (or even SIGSEGV signal)
make it pass. It shouldn't be so for example when assert() is invoked
when a client couldn't connect to display.

Make sure that only relevant asserts make the test pass
and the other make it fail (by returning 0)
2014-04-16 22:31:44 -07:00
Jason Ekstrand
9e9512f017 desktop-shell: Get rid of get_shell_client
We now carry the shell_client around with each shell_surface.  This is much
more reliable than tacitly assuming that there is only one wl_shell or
xdg_shell instance bound to a particular wl_client.  In particular, weston
would crash when a client bound to both wl_shell and xdg_shell even if it
only ever used one of them.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-16 22:29:01 -07:00
Ander Conselvan de Oliveira
a61b949eb8 compositor-drm: Pass the right stride to the vaapi recorder
It takes the stride in bytes, not pixels. The bug was hidden when using
va intel-driver 1.2.1 because it would ignore the stride from user and
set the surface state in a wrong way.

https://bugs.freedesktop.org/show_bug.cgi?id=77495
2014-04-16 22:24:04 -07:00
Ander Conselvan de Oliveira
304996d182 shell: Fix view repositioning logic for output move and destroy
Previously, the repositioning logic would iterate the compositor's list
of layers and move the views on those layers. However, that failed in
two different ways: it didn't cover hidden workspaces and crashed when
the display was locked.

This patch changes the logic to explicit iterate over all the layers
owned by the shell. The iteration is done through a helper function,
shell_for_each_layer().

https://bugs.freedesktop.org/show_bug.cgi?id=76859
https://bugs.freedesktop.org/show_bug.cgi?id=77290
2014-04-11 10:05:19 -07:00
Jason Ekstrand
c107306db7 gl-renderer: Fix a typo in the output_set_border description
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-04-11 09:59:26 -07:00
Jasper St. Pierre
4783739f39 xwayland/launcher: Use %m instead of manual strerror(errno) 2014-04-10 12:51:42 -07:00
Bryce W. Harrington
13600c02af protocol: Correct typo 'suppot'
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-10 11:59:30 -07:00
Ander Conselvan de Oliveira
641796c31a shell: Keep shsurf->fullscreen_output set after unset_fullscreen()
When a fullscreen surface gets the maximized state, the function
reset_surface_type() is called and that causes unset_fullscreen() to be
called. That function would set the value of shsurf->fullscreen_output
to NULL. However, since the surface still has the fullscreen state, it
will be configured as a fullscreen surface again, and an attempt to
access that field would cause the compositor to crash.

Fix the crash by keeping the value of fullscreen_output around after
unset_fullscreen(). This is safe since the value is only used when a
surface has the fullscreen state and is replaced on a new request to
make the surface fullscreen.

https://bugs.freedesktop.org/show_bug.cgi?id=76867
2014-04-10 10:20:54 -07:00
Ander Conselvan de Oliveira
facc0ccf06 shell: Damage below child surfaces on move to different workspace
When moving from a surface from visible workspace to an invisible one
via a popup menu, the area below the menu wouldn't be repainted.

https://bugs.freedesktop.org/show_bug.cgi?id=76973
2014-04-10 10:06:22 -07:00
Ander Conselvan de Oliveira
4e20e9b847 shell: Disarm the screensaver timeout timer on terminate_screensaver()
The timer was left running after the screensaver was terminated. When
it triggered, a fade out that would in turn cause the screen to be
locked was started. Since that could happen without the compositor
emitting the idle signal, there would be no wake signal to make the
shell show the lock screen, so the system was left unresponsive
until the idle signal actually triggered.

https://bugs.freedesktop.org/show_bug.cgi?id=70923
2014-04-10 10:02:35 -07:00
Neil Roberts
b4a91708e3 Reset the keyboard focus on all seats when the compositor is locked
Before commit 2f5faff7f9 when the compositor is locked it would
reset the keyboard focus on all of the seats as part of pushing the
focus_state. This was removed because it now always keeps track of the
focus_state in the workspace instead of waiting until the state is
pushed. However this had the side effect that the active surface would
retain focus when the compositor is locked. This patch just makes it
explicitly set the keyboard focus to NULL on all of the seats when
locking. This will be restored based on the workspace's state when
unlocking.

https://bugs.freedesktop.org/show_bug.cgi?id=73905
2014-04-10 09:40:28 -07:00
Neil Roberts
4237f50e11 Reset focus on unknown seats when restoring focus state
The focus_state list on a workspace only contains entries for seats
which have a keyboard focus on that workspace. For workspaces that
have no surfaces the list will be empty. That means that when a
workspace with no surfaces is switched to it would previously leave
the keyboard focus unaffected and you could still type in the surface
on the old workspace.

This patch makes it instead reset the keyboard focus to NULL for seats
without a focus_state. It does this by temporarily stealing the
compositor's list of seats while it iterates the focus_states. After
all of the focus states have been processed any seats remaining in
this temporary list have their focus reset.

https://bugs.freedesktop.org/show_bug.cgi?id=73905
2014-04-10 09:32:09 -07:00
Ander Conselvan de Oliveira
e5a1aee694 shell: Allow unresponsive surfaces to be moved again
Commit c85f1d45 caused the move of an unresponsive surface to be no
longer possible, since the grabbed flag would prevent the move grab
to start while the busy grab was still active.
2014-04-09 10:44:32 -07:00
Daiki Ueno
56d8a7a155 terminal: Don't try to render RLE used as a placeholder
weston-terminal uses RLE (U+202B) as a placeholder of the right half
of a double width character.  However, not all fonts include this
glyph and cairo renders it as .notdef (glyph index 0) in that case.
2014-04-08 10:03:17 -07:00
Kristian Høgsberg
79d5a6ebe4 configure.ac: Bump version to 1.4.91 2014-04-07 16:14:54 -07:00
Kristian Høgsberg
f0ce581b92 desktop-shell: Activate surface on right click too
This raises the surface to the top on right click as well, which fixes
pop stacking.

https://bugs.freedesktop.org/show_bug.cgi?id=74831
2014-04-07 11:52:17 -07:00
Kristian Høgsberg
cdbbae2cac window.c: Create xdg_surface up front
Fixes initial fullscreen for calibrator.

https://bugs.freedesktop.org/show_bug.cgi?id=76970
2014-04-07 11:28:05 -07:00
Andrew Wedgbury
9cd661e746 Make sure config.h is included before any system headers
There was an issue recently in screen-share.c where config.h was not
being included, resulting in the wrong definition for off_t being used on
32 bit systems. I checked and I don't think this problem is happening
elsewhere, but to help avoid this sort of problem in the future, I went
through and made sure that config.h is included first whenever system
headers are included.

The config.h header should be included before any system headers, failing
to do this can result in the wrong type sizes being defined on certain
systems, e.g. off_t from sys/types.h

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
2014-04-07 10:22:28 -07:00
Kristian Høgsberg
ba83db216c xwayland: Clean up unpaired surfaces 2014-04-07 10:16:19 -07:00