Commit Graph

3949 Commits

Author SHA1 Message Date
U. Artie Eoff
2e2384aac5 compositor: free memory from str config sections after done using it
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:10:19 -08:00
U. Artie Eoff
ff7550087e compositor-wayland: free 'theme' config option value
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:07:33 -08:00
U. Artie Eoff
1a08d1196a compositor-wayland: don't free unallocated memory
Assigning a string constant (i.e. memory that we didn't allocate)
to a char* pointer and then freeing that pointer is bad news.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:07:22 -08:00
U. Artie Eoff
107de96ba7 shared/frame: fix potential memory leak in frame_create
In frame_create, we need to destroy any frame buttons created
in preceding calls to frame_button_create during the function
execution if any of the successive calls to frame_button_create
fail.

This has minimal severity since most, if not all, cases in
frame_button_create that result in a fail (i.e. NULL result) means
a program is OOM and the program will have to exit/abort anyway.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:07:07 -08:00
U. Artie Eoff
cf5737aa41 shell: assert get_shell_surface() != NULL as appropriate
Various functions that operate on a weston_surface assume the
surface has a shell_surface.  That is, they unconditionally
deref the get_shell_surface() result.  Hence, if for some reason
the call to get_shell_surface() returned NULL to those functions then
a segmentation fault would occur and the program would crash.  So,
adding an assert(...) on the get_shell_surface() return value adds an
extra sanity check and does not change this behavior.  The assert also
adds an extra benefit to the programmer by documenting that the function
expects and requires the weston_surface to have a shell_surface and
would be a program logic error, otherwise.

The assert() also silences some static analyzers about the possible
NULL deref.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:06:05 -08:00
U. Artie Eoff
0b23b2bd58 shell: validate create_focus_surface results
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:05:42 -08:00
U. Artie Eoff
b571910584 shell: validate get_animation_type parameter
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:05:04 -08:00
U. Artie Eoff
c4c7a4f921 input-panel: validate return value of get_default_view
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:04:56 -08:00
U. Artie Eoff
6d6d190b30 exposay: remove redundant NULL check in highlight_surface
exposay_highlight_surface() is called from exposay_pick(),
exposay_layout(), and exposay_maybe_move() where the esurface
parameter is already validated prior to the call.  This makes
the 'esurface' NULL check redundant.  This assumes any future
calls to exposay_highlight_surface() will also validate the
'esurface' parameter prior to the call.

This fixes the logic in exposay_highlight_surface so static
analyzers don't complain about the possibility that 'view'
might be NULL deref'd when a 'esurface' == NULL condition is
true.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:04:27 -08:00
U. Artie Eoff
bae79ca741 clients/window: fail if NULL returned from frame_create
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:03:50 -08:00
U. Artie Eoff
86c68b328a weston-info: free allocated memory and check OOM conditions
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:02:37 -08:00
U. Artie Eoff
09827e2643 terminal: use xstrdup instead to handle OOM
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:30 -08:00
U. Artie Eoff
5cda4e328d use xzalloc wrapper instead
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:23 -08:00
U. Artie Eoff
3c946779df clients/desktop-shell: check OOM conditions
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:12 -08:00
U. Artie Eoff
13708a4d67 screenshooter: check for NULL malloc and fix memleaks
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:00:39 -08:00
U. Artie Eoff
f05645b30e wcap-decode: remove dead code
Avoids leaking memory we never use.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 21:59:37 -08:00
U. Artie Eoff
1db007202b log: print dummy timestamp if localtime call fails
Handle the case where localtime fails (NULL) and print
something else to indicate localtime is erroneous.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 21:58:57 -08:00
U. Artie Eoff
981fa33809 backlight: fix backlight_path memory leak
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 21:58:53 -08:00
Kristian Høgsberg
87d3b61355 shell: Don't start a fade animation if we don't have an output
When the last window of the X11 compositor is closed during a fade or
while locked, we'll try to start a fade back to the lock screen.  However,
if we closed the last window, there are no outputs left and the animation
will try to run with surface->output == NULL.

https://bugs.freedesktop.org/show_bug.cgi?id=73665
2014-01-19 21:48:10 -08:00
Kristian Høgsberg
8fe412d35b Revert part of 17bccaed42
Commit 17bccaed42 accidentally reverted
the fix for 73490 from 5cbc763404.
2014-01-17 16:40:49 -08:00
Kristian Høgsberg
27d5fa8922 shell: Cancel popups when triggering screensaver
This is part of the fix for bug 72540.  We cancel the popup grab when the
screensaver kicks in so that the screen unlock dialog can get input events.
The bigger problem is in mesa however, where we try to allocate new buffers
as cairo-gles2 does a gratuituous (but valid) eglMakeCurrent() as we
remove the tooltip or popup-menu.

Since we removed the weston_layer with the regular surfaces, EGL blocks
waiting for a frame event that never comes.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72540
2014-01-17 16:22:50 -08:00
Kristian Høgsberg
6f394d59a1 resizor: Don't resize if maximized
https://bugs.freedesktop.org/show_bug.cgi?id=73723
2014-01-17 15:31:33 -08:00
Kristian Høgsberg
8e80a31ba4 shell: Stop moving surfae after touch point 0 goes up
The grab stays alive as long as at least one touch point is down.  If touch
point 0 is lifted while other touch points are down, the surface will jump
around when touch point 0 is put down again.

This change marks the grab as inactive once touch point 0 is lifted
and then ignores touch events until all touch points eventually are
lifted and the grab terminates.

https://bugs.freedesktop.org/show_bug.cgi?id=73750
2014-01-17 15:18:35 -08:00
Kristian Høgsberg
1be87e3c81 compositor-drm: Make composite bypass work on secondary outputs
The opaque region is in surface coordinates, which we compare to the
output region, which is in compositor coordinates.  For non-primary
outputs, that means that the output region is not located at 0,0 but
something like 1920,0 instead.  That means that the output region isn't
contained in the surface opaque region and then we decide we can't scan
out from it.

Instead, compare the surface opaque region to the output region
translated to 0,0.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=7348i5
2014-01-17 14:22:41 -08:00
Kristian Høgsberg
e61d2f4812 shell: Don't assign keyboard focus for seats without keyboard
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73570
2014-01-17 12:19:06 -08:00
Axel Davy
e4450f9123 Fix XWayland crashes when opening popups
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2014-01-17 11:59:56 -08:00
Bryce W. Harrington
d716754cfb gitignore: Generated files text-client-protocol.h, text-protocol.c
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-01-17 11:32:01 -08:00
Bryce W. Harrington
991f271de5 Cleanup stray newline in a return statement
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-01-17 11:30:48 -08:00
Bryce W. Harrington
3abdafd12d terminal: Only set title if asprintf succeeded
Handles potential out of memory situation by skipping the title update.
This fixes the following warning:

  terminal.c: In function ‘resize_handler’:
  terminal.c:851:11: warning: ignoring return value of ‘asprintf’,
  declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-01-17 11:29:54 -08:00
Wieland Hoffmann
ad0704a226 weston.ini.man: Fix some grammar 2014-01-17 11:11:31 -08:00
Kristian Høgsberg
17bccaed42 input: Handle unplugging the output for a touchscreen device
A paired touch screen will stop sending events if its corresponding
output is unplugged.  An unpaired touchscreen will pick the new primary
output.

https://bugs.freedesktop.org/show_bug.cgi?id=73637
2014-01-16 17:08:26 -08:00
Kristian Høgsberg
d56ab4eb18 shell: Disable exposay by default
Add a config file option to enable it, but leave it off by default.  Exposay
still triggers too many lock-ups or stuck grabs and triggers under X even
when the Wayland window doesn't have keyboard focus.
2014-01-16 16:52:12 -08:00
Kristian Høgsberg
5cbc763404 shell.c: Not all seats have pointers
Don't look up the pointer focus in ping_timeout_handler() if the
seat doesn't have a pointer.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73490
2014-01-15 11:46:38 -08:00
Axel Davy
fa506b6dda Fix XWayland transient window location.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73517

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2014-01-13 16:02:29 -08:00
Jason Ekstrand
81038fba86 Only update the surface size if a new buffer is attached
This fixes a regression caused by either 918f2dd4 or da75ee1d.  In
particular, if a client called commit without attaching a buffer and if the
compositor had already released its reference to the buffer, then a size of
0x0 would be set on the surface.  In particular, this affects the wayland
backend because it frequently sends only a frame request in order to cause
a refresh.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-01-13 15:59:08 -08:00
Kristian Høgsberg
c180977e7c text: Set context->model to NULL when we deactivate text input
There's a small window between the input method (eg the on-sreen keyboard)
receiving the deactivate and destroying the context, where the keyboard may
send requests, which we forward to the destroyed input method.  Fix this
by setting the contexts model to NULL right away and then avoid sending
events if context->model is NULL.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69490
2014-01-13 15:06:10 -08:00
Kristian Høgsberg
211b517e8c shell: Move maximize and fullscreen bindings to mod + SHIFT
mod + f and mod + m conflict with too many application bindings, in
particular if mod is mapped to ALT.
2014-01-11 13:58:33 -08:00
Kristian Høgsberg
b637a40df9 window: Properly destroy tooltip windows when parent window is destroyed
If we destroy a window with an active tooltip, we leave the tooltip
hanging around.  Call tooltip destructor when destroying a window.
This fixes the stuck tooltip observed when unplugging a monitor with
an active tooltip on the panel.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72931
2014-01-10 00:27:35 -08:00
Kristian Høgsberg
9046d2424a shell: Orphan child windows when a shell surface is destroyed
We now track the child surfaces of a shell surface and the child surfaces
have a pointer back to their parent.  We need to clean all this up and
NULL out the childrens parent pointers when a shell surface is destroyed.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72931
2014-01-10 00:25:30 -08:00
Kristian Høgsberg
d6d3b377f8 keyboard: Make debug output less verbose
The keyboard is too chatty, make it use a dbg() function for logging
which defaults to disabled.

Also drop a noisy fprintf() in input_panel_configure().
2014-01-09 23:58:14 -08:00
Kristian Høgsberg
700d6ad071 keyboard: Don't strcat() into a strdup()ed string
We need to reallocate the memory to hold the entire concatenated string,
but strcat() doesn't do that.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=71750
2014-01-09 23:45:18 -08:00
Kristian Høgsberg
a548b4b85c keyboard: Fix insert_text() string utility
strncat() into a newly allocated buffer isn't well-defined.  I don't know
how this didn't crash all the time, getting blocks from malloc() with
a NUL in the first byte must be fairly common.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=71750
2014-01-09 23:39:20 -08:00
Kristian Høgsberg
b0fb25dedc compositor: Init output listeners in weston_view if it's not on any output
If we don't add the listener back to a new output, we have to init the
list links so we can remove them unconditionally.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73415
2014-01-09 22:42:28 -08:00
Kristian Høgsberg
8ca9544e06 input: Re-pair touch screen when monitor is plugged in
https://bugs.freedesktop.org/show_bug.cgi?id=73442
2014-01-09 16:46:33 -08:00
Kristian Høgsberg
70f2901989 shell: Make sure we still have touch or pointer focus when moving/resizing
It's possible to touch a surface to move it and let go before we get
to common_surface_move(), in which case we don't have a touch focus
when we get there.  For pointers, we could click a surface, but have the
surface go away before we get to common_surface_move(), in which
case the button count is non-zero, but we don't have a surface.

In either case we crash, so let's add a check to make sure we still
have a focus surface before we try to move it.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73448
2014-01-09 15:43:17 -08:00
Neil Roberts
97b747cdda westoy: Add an option to explicitly disable cairo on a widget
The subsurfaces example creates a subsurface widget and uses EGL to
render to it directly rather than using the cairo context from the
widget. In theory this shouldn't cause any problems because the westoy
window code lazily creates the cairo surface when an application
creates a cairo context. However commit fdca95c7 changed the behaviour
to force the lazy creation at the beginning of each surface redraw.
This ends up making the triangle surface get two attaches – one from
Cairo and one from the direct EGL.

It looks like it would be difficult to reinstate the lazy surface
creation behaviour whilst still maintaining the error handling for
surface creation because none of the redraw handlers in the example
clients are designed to cope with that. Instead, this patch adds an
explicit option on a widget to disable creating the Cairo surface and
the subsurface example now uses that.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72854
2014-01-09 15:03:15 -08:00
Kristian Høgsberg
a30e29af2e input: Ignore touch up events if num_tp is 0
This can happen if we start out with one or more fingers on the touch
screen, in which case we didn't get the corresponding down event.

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=73367
2014-01-08 22:29:25 -08:00
Rafal Mielniczuk
b2917a2fed shell: run surface bindings only when focus surface is not NULL
This fixes the crash when move, rotate or resize binding is activated
while exposay effect is active.

Steps to reproduce:
- activate exposay
- try to rotate the surface with mod + right mouse button
- crash

Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72885
2014-01-08 22:17:40 -08:00
Fabien DESSENNE
4b2558708b compositor-drm: consider the best mode of the mode_list as an option
This patch fixes an issue where Weston using the DRM backend, cannot start
the display. This happens in the following context:
- no video mode is set before weston starts (eg no "/dev/fb" set up)
- weston is not configured with any default video mode (nothing from
  weston.ini nor command line)
- the DRM driver provides with a list of supported modes, but none of them
  is marked as PREFERRED (which is not a usual case, but it happens)
In that case, according to the current implementation, the DRM compositor
fails to set a video mode.
This fix lets the DRM compositor selects a video mode (the best one of the
list, which is the first) from the ones provided by the driver.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
2014-01-08 22:06:05 -08:00
Rui Matos
73d9395e68 input: Don't leak the initial keymap
weston_xkb_info_create() takes ownership of the xkb_keymap instance so
we should drop our reference or we would leak it later if the keymap
was changed.
2014-01-08 21:40:32 -08:00