Commit Graph

64 Commits

Author SHA1 Message Date
Emilio Pozuelo Monfort
7908bffdf9 dim-layer: fix dimming for unfocused surfaces
Unfocusing a surface should dim it when dim-layer is enabled,
but this got broken in commit 83ffd9.
2014-02-05 17:26:45 -08:00
Kristian Høgsberg
4c72f5721e shell: Remove elaborate if-statement with empty body 2014-02-05 13:36:01 -08:00
Kristian Høgsberg
0b7d9958a8 shell: Handle wl_shell surfaces created by xwayland correctly
When xwayland creates a shell surface we don't have a resource.  The
recently added shell_surface_is_wl_shell/xdg_surface() tests don't
handle that very well.

For now, we assume that a surface without a resource is created from
xwayland and is a wl_shell surface.  We'll want to modify that to be a
xdg surface eventually, but for now this stops weston from crashing.
2014-02-03 15:50:38 -08:00
Quentin Glidic
088ba5e475 Makefile.am: Fix protocol source files usage
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2014-02-01 21:21:39 -08:00
Jasper St. Pierre
faf27a9a3b weston: Send xdg_surface_send_focused_[un]set when focusing surfaces 2014-02-01 01:41:01 -08:00
Emilio Pozuelo Monfort
adaa20c017 desktop-shell: initialize children link
Since commit 9046d2, when destroying a surface, we remove all the
links from its children. But when the child surfaces are destroyed,
those links will be removed again, but since they were not properly
initialized, weston will crash.

Call shell_surface_set_parent instead which removes the link and
sets parent while also initializing the link, thus avoiding this
crash.
2014-02-01 01:29:13 -08:00
Emilio Pozuelo Monfort
38b58eba74 desktop-shell: maximize the surface with the kbd focus
We don't have focus-follows-mouse, so it makes more sense to
maximize or fullscreen the surface that has the keyboard focus,
not the one behind the pointer.
2014-02-01 01:26:34 -08:00
Kristian Høgsberg
bc00dbe4f5 build: Move desktop-shell/Makefile.am into toplevel Makefile.am 2014-02-01 00:07:21 -08:00
Kristian Høgsberg
d500bf1ac9 shell: Properly track the focus state surface
We have to move the surface destroy listener around as we track the
currently focused surface.  Introduce a helper function,
focus_state_set_focus() for this and use throughout.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73768
2014-01-22 12:25:20 -08:00
Ricardo Vieira
f1c3bd8e81 shell: Don't move maximized window
We'll want to ask the client to unmaximize once we get support for that in
xdg-shell, but for now, just refuse moving a maximized window.
2014-01-20 10:36:28 -08:00
Kristian Høgsberg
0837fa9626 shell: Add mod+shift left-click as a resize binding
This lets us use compositor-initiated resize on laptops with touchpads and
no middle buttons.
2014-01-20 10:35:26 -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
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
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
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
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
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
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
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
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
Emilio Pozuelo Monfort
1a26f1baba exposay: set an alpha on fullscreen surfaces
This makes the desktop background actually draw when there is
a fullscreen surface and we go to exposay.
2014-01-07 21:46:36 -08:00
Emilio Pozuelo Monfort
e6bbe5a90d exposay: fix infinite loop with fullscreen surfaces
We were calling exposay_highlight_surface() inside a wl_list_for_each
loop for a layer, but exposay_highlight_surface() calls activate()
which calls shell_surface_update_layer(), which removes the surface
from its layer and reinserts it, causing an infinite loop.

Call exposay_highlight_surface() outside the for_each to avoid this.

https://bugs.freedesktop.org/show_bug.cgi?id=72404
2014-01-07 21:41:18 -08:00
Kristian Høgsberg
0ed6750541 shell: Only assign focus on touch if there is a touch focus surface
Similar to 7c4f6cc145, if we don't have
a background image from the desktop-shell client or the touch point
for some other reason doesn't hit a surface we trigger a
segfault as we try to deref the seat->touch->focus NULL pointer.

For touch, another problem could be fudgey calibration that ends up
giving touch coordinates outside the output space.

https://bugs.freedesktop.org/show_bug.cgi?id=72839
2014-01-02 23:00:11 -08:00
Kristian Høgsberg
9f7e331a20 xwm: Handle WM_TRANSIENT_FOR
Set up X windows that are transient for another window as transient
surfaces in shell.c.  This keeps the transient windows on top of their
parent as windows are raised, lowered for fullscreened.

https://bugs.freedesktop.org/show_bug.cgi?id=69443
2014-01-02 22:55:04 -08:00
Kristian Høgsberg
0e45e8712a shell: Start the input panel slide slightly on the output
If a surface is not on any output, scheduling a repaint for it is a no-op.
weston_view_schedule_repaint() schedules repaints for all outputs that
overlap with the surface extents, but if the surface is completely
outside all outputs nothing will be scheduled.  Fix this for now by starting
the slide slightly into the output.
2014-01-02 01:33:42 -08:00
Kristian Høgsberg
2eebcd34fc shell: Test for surface->width == 0 to see if input-panel was unmapped
The input-panel codes tries to see determine if a buffer has not yet
been attached (or a NULL buffer has been attached), and doesn't map
the input panel surface yet in that case.  However, it test for
buffer_ref being NULL, which can happen for other reasons.  The right
test is to see if surface->width is 0, which means that either a
buffer hasn't yet been attached or a NULL buffer has been attached.

https://bugs.freedesktop.org/show_bug.cgi?id=72519
2014-01-02 01:27:38 -08:00
Kristian Høgsberg
c30c8a3db5 shell: Always set input-panel position on initial configure
If we're not currently showing the input panels, we still need to set the
panel position so that it's set when we later need to show them.  This fixes
the initial flicker of the input panel in the wrong position when we first
show it.
2014-01-02 00:45:19 -08:00
Kristian Høgsberg
8bc525c60d shell.c: Set state_changed for xwayland surfaces as well
Fixes the problem where xwayland surfaces pop up at 0,0 always.
2014-01-01 22:34:49 -08:00
Kristian Høgsberg
7c4f6cc145 shell: Only assign focus on click if there is a pointer focus surface
If we don't have a background image from the desktop-shell client or the
pointer for some other reason doesn't have a focus we trigger a
segfault as we try to deref the seat->pointer->focus NULL pointer.

https://bugs.freedesktop.org/show_bug.cgi?id=73066
2014-01-01 16:28:32 -08:00
Kristian Høgsberg
8662349394 shell.c: Back out alt-tab functionality
This is still fairly unstable, causes lockups with fullscreen and exposay,
leaves small preview surfaces on-screen if used on the same modifier as
mod-tab.  We also only need on mod-tab implementation so lets see if we
can consolidate the current and this alt-tab implementation in 1.5.

https://bugs.freedesktop.org/show_bug.cgi?id=72610
2014-01-01 16:10:44 -08:00
Jason Ekstrand
6228ee235f Fix the size of surfaces created in create_black_surface
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-01-01 14:01:14 -08:00
Kristian Høgsberg
ead5242e07 shell: Fix up previous broken commit 2014-01-01 13:51:52 -08:00
Kristian Høgsberg
d55db69c94 Revert "shell: Change stacking order calculation for popup surfaces"
Popup windows are relative to a plain wl_surface, so that custom surfaces
can have popups.  This used for the desktop-shell panel for example.  Also,
popups should be immediately on top of their parent surface, as they
typically represent an extension of an UI element in the parent surface
such as a combo box or menu.

This reverts commit da704d97fa.

Conflicts:
	desktop-shell/shell.c

https://bugs.freedesktop.org/show_bug.cgi?id=72547
2014-01-01 12:26:14 -08:00
Kristian Høgsberg
a1df7acb78 shell: Set state_changed when we make a surface transient
If we don't mark the state as changed, we don't copy over next_state to
state and we fail to treat the surface as a transient.  In particular,
we give it a random intial position instead of mapping it at the given
parent relative position.

https://bugs.freedesktop.org/show_bug.cgi?id=72532
2013-12-31 15:01:09 -08:00
Ander Conselvan de Oliveira
312ea4ca42 shell: Handle the desktop shell client destroy signal
Set the internal pointer for the client to NULL. This fixes a
segmentation fault at shutdown, where the shell would hang up before
and cause libwayland to call wl_client_destroy(). When the shell was
destroyed later, another call to wl_client_destroy() would cause the
crash.

https://bugs.freedesktop.org/show_bug.cgi?id=72550
2013-12-22 13:45:36 -08:00
Jason Ekstrand
5c11a3340b Add a weston_surface_set_size function
Surfaces that are created by clients get their size automatically updated
by the attach/commit.  Surfaces created directly by shells (such as black
surfaces) sometimes need to be manually resized.  This function allows you
to do that while being somewhat less messy than messing with the internals
of weston_surface manually.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-12-16 17:23:09 -08:00
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
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
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