Commit Graph

97 Commits

Author SHA1 Message Date
Dima Ryazanov cae1f0ff2d Check if the frame exists before reading its size
This fixes crashes caused by popup windows that don't have override_redirect
(e.g., menus in VLC and KDE apps).

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
2013-12-03 16:13:08 -08:00
Dima Ryazanov b03b87fe63 Check for frame being NULL before setting/unsetting flags
Fixes a crash in Firefox when clicking an "install plugin" popup.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2013-12-03 16:12:54 -08:00
Dima Ryazanov e5a3208373 Set the view to NULL when unmapping an X11 window
Fixes a crash caused by accessing a deleted view in weston_wm_window_schedule_repaint. It can be easily reproduced by switching between menus in Firefox.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2013-12-03 15:54:44 -08:00
Kristian Høgsberg 1d75c7d3a2 xwm: Set input region for fullscreen surfaces correctly
The logic here broke at some point so that we would only update the
input region for non-fullscreen windows.  Thus, a fullscreen window would
be stuck with whatever size the most recent non-fullscreen size was.

https://bugs.freedesktop.org/show_bug.cgi?id=69219
2013-10-30 23:46:08 -07:00
Jason Ekstrand a7af70436b Split the geometry information from weston_surface out into weston_view
The weston_surface structure is split into two structures:

 * The weston_surface structure storres everything required for a
   client-side or server-side surface.  This includes buffers; callbacks;
   backend private data; input, damage, and opaque regions; and a few other
   bookkeeping bits.

 * The weston_view structure represents an entity in the scenegraph and
   storres all of the geometry information.  This includes clip region,
   alpha, position, and the transformation list as well as all of the
   temporary information derived from the geometry state.  Because a view,
   and not a surface, is a scenegraph element, the view is what is placed
   in layers and planes.

There are a few things worth noting about the surface/view split:

 1. This is *not* a modification to the protocol.  It is, instead, a
    modification to Weston's internal scenegraph to allow a single surface
    to exist in multiple places at a time.  Clients are completely unaware
    of how many views to a particular surface exist.

 2. A view is considered a direct child of a surface and is destroyed when
    the surface is destroyed.  Because of this, the view.surface pointer is
    always valid and non-null.

 3. The compositor's surface_list is replaced with a view_list.  Due to
    subsurfaces, building the view list is a little more complicated than
    it used to be and involves building a tree of views on the fly whenever
    subsurfaces are used.  However, this means that backends can remain
    completely subsurface-agnostic.

 4. Surfaces and views both keep track of which outputs they are on.

 5. The weston_surface structure now has width and height fields.  These
    are populated when a new buffer is attached before surface.configure
    is called.  This is because there are many surface-based operations
    that really require the width and height and digging through the views
    didn't work well.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-22 13:34:11 -07:00
Kristian Høgsberg 2cd6da1400 xwm: Fall back to xcb_kill_client() if window does support WM_DELETE_WINDOW 2013-10-14 12:27:55 -07:00
Jason Ekstrand d14c4ca603 xwayland: Use decoration frame from cairo-util
In particular, this gives us a close button on xwayland windows.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-14 12:27:55 -07:00
Kristian Høgsberg bcfd07b70a xwm: Redirect root window subwindows
xwayland no longer does this for us, we have to request it now
2013-10-11 16:48:19 -07:00
Stefan Schmidt 08921b85ce xwayland: Remove unused call weston_wm_handle_configure_notify.
We get the child position but never use this information here. Just remove it.
Spotted by Christopher Michael.

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
2013-10-11 13:30:15 -07:00
Giulio Camuffo 1cf329bff1 xwm: remove the destroy listener from the old surface signal 2013-09-21 20:58:53 -07:00
Giulio Camuffo a2df51c19f xwm: set the right cursor when hovering on the decoration borders
use the alternative cursor names used also in window.c, since the
names it used previously are not guaranteed to exist in all themes.
2013-09-21 11:35:37 -07:00
Giulio Camuffo 85739eab12 xwm: set the window's shsurf pointer to NULL on unmap handling
the unmap event will be followed by the deletion of the weston_surface,
so the shell_surface will also be deleted by the shell. Having removed
the surface_destroy_listener, the surface_destroy callback doesn't
get called, so reset the value of shsurf here.
2013-09-21 11:27:19 -07:00
Giulio Camuffo 62942ad3a6 xwm: set the shell_surface's title
add a new function pointer to the weston_shell_interface struct that
shells will set accordingly.
2013-09-11 13:50:54 -07:00
Giulio Camuffo ca43f0942e xwm: place transient windows at the right position 2013-09-11 13:50:03 -07:00
Kristian Høgsberg f9cb3b17d5 xwm: Add support for bridging Xdnd to wayaland DnD 2013-09-04 21:24:41 -07:00
Kristian Høgsberg ab6d6674b6 xwm: Unmap frame window when client window is unmapped
We used to destroy the frame window and reparent the client window to
wm_window.  That means that we lose the destroy_notify event when the
client window is destroyed later, since we don't select for
substructure_notify on wm_window.

Instead of destroying and reparenting, just unmap the frame window.
2013-09-03 20:57:18 -07:00
Kristian Høgsberg 318ea37782 xwm: Split creation of frame window out into its own function 2013-09-03 20:57:18 -07:00
Kristian Høgsberg 81cadc725c xwm: Set window->surface to NULL when surface goes away
Otherwise we may end up trying to remove the destroy listener if we
get the surface_destroy callback before the unmap_notify.
2013-09-03 20:57:18 -07:00
Kristian Høgsberg 1a7a57f0d9 xwm: Detect WM_NORMAL_HINTS fullscreen attempts 2013-09-03 20:57:11 -07:00
Kristian Høgsberg 59f44c184d xwm: Detect legacy fullscreen modes 2013-09-03 20:56:20 -07:00
Kristian Høgsberg 1b6fed41dd xwm: Update size when override redirect windows change size 2013-09-03 20:56:12 -07:00
Kristian Høgsberg 146f5ba466 xwm: Use window->x/y for override redirect surfaces
window->x/y is the coordinate of the top-level surface (whether that's
the frame window or an override-redirect window) and the wayland surface
should be placed there, without the t->margin offset.
2013-08-22 16:30:21 -07:00
Kristian Høgsberg e89a8b6ba1 xwm: Fix transform listener
The coordinate transformation was broken (worked for first output where
output->x/y was 0,0, broke on all other outputs).  We can just use
surface->geometry.x/y directly.  We can't use the full transformation,
the best we can do is to move the X window to the geometry.x/y location.

Get rid of the static old_sx/sy hack as well.
2013-08-22 16:23:35 -07:00
Kristian Høgsberg 122877d5e7 xwm: Fix configure notify handler
We only get configure notify for toplevel (frame or override-redirect window)
and those are the cases where we want to update window->x/y.  The way the
code worked, we'd exit immeidately in those cases and window->x/y would
not be updated.
2013-08-22 16:18:17 -07:00
Kristian Høgsberg 69981d9621 xwm: Set _NET_WM_CM_S0 instead of relying on the xwayland module to do it
Not sure why I made xwayland claim this selection, seem a little
awkward in retrospect.
2013-08-21 22:14:58 -07:00
Giulio Camuffo 9f42e50868 xwm: do not crash when activating a NULL surface 2013-08-13 10:04:27 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Louis-Francis Ratté-Boulianne dce3dacc37 xwayland: Remove transform listener when destroying the wm
Fix a segfault occuring after the last X window was closed.
2013-07-29 15:47:19 -07:00
Kristian Høgsberg fa514b496e xwayland: Don't allow resizing to 0x0 or less
X windows have to be at least 1x1 pixels.

https://bugs.freedesktop.org/show_bug.cgi?id=63510
2013-07-08 15:00:25 -04:00
Kristian Høgsberg 00db2ee5ff xwayland: Don't crash when we get configure notify for destroyed frame windows
We can get a destroy notify for the frame window after we've removed it
from the hash table.  This turns into a NULL pointer deref when we look up
the window and try to use it for debugging printout.

Fixes the failing xwayland test case.
2013-07-04 02:31:53 -04:00
MoD 384a11aeac xwm: Use empty opaque region for windows with alpha
Window contents cannot be assumed to be fully opaque for windows drawn with
a RGBA visual. The optimization of setting a full opaque region is limited to
windows with a color depth != 32.
2013-07-02 18:17:09 -04:00
Kristian Høgsberg 082d58c88d xwayland: Silence X wm debug logging
Much to verbose for default logging.  Use a wm_log() wrapper that we can
toggle on/off as needed.  Maybe we're ready for log domains now.
2013-06-18 01:00:27 -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
MoD 55375b9858 xwm: Check result of xcb_get_atom_name_reply
When printing debug information about atoms, the XWM would crash if the X
server failed to respond to a request about atom names. In practice this
occurred when the server itself crashed, e.g. when starting mplayer with the
"xv" vo.
2013-06-14 14:40:43 -04:00
MoD 3170012ec5 xwm: Define SEND_EVENT_MASK and EVENT_TYPE macros to clarify xcb event type checks 2013-06-14 14:34:52 -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
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 e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Kristian Høgsberg f91871980e xwm: Reparent client windows into ARGB windows
We used to rely on an ugly hack where the xwayland server would always
report RGB X windows as having ARGB pixels, so that texturing from these
would also sample the undefined alpha.  We also relied on Xrender rendering
to RGB X windows to write the alpha channel correctly, so that when we
texture from the RGB X window as an ARGB surface we end up getting the
alpha written by Xrender.

That was obviously all broken.  We can instead reparent client windows into
ARGB frame windows.  That way we can render the decorations using a
ARGB render pictformat and sample back those alpha values in a well-defined
way.  We can also unbreak xwayland and let it report RGB pixel format for
RGB windows.  We still need the opaque region or the RGB-only client window
but that's OK.
2013-05-02 13:43:34 -04:00
Pekka Paalanen c3ce738653 compositor: introduce weston_surface_geometry_dirty()
Instead of directly setting the dirty flag on weston_surface geometry,
use a function for that.

This allows us to hook into geometry dirtying in a following patch.

Also add comments to weston_surface fields, whose modification causes
transform state to become outdated.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-03-18 22:19:57 -04:00
Kristian Høgsberg 762b166c35 xwm: Only call set_fullscreen if the window is mapped
If we get a fullscreen client message before we map the window, we don't
have a shell surface yet.  Just dont call set_fullscreen yet, and rely on
xserver_map_shell_surface() to fullscreen it when we map it.
2013-02-21 20:18:37 -05:00
Kristian Høgsberg 81585e9d2a xwm: Don't leak pending.input region
It's not really a leak, since the region is always a rectangle, but let's
play by the rules.
2013-02-14 22:03:02 -05:00
Kristian Høgsberg 25bb696fc8 xwm: Fix silly region math
We were setting up the opaque region to be the window size and then
intersecting with the opaque rectange that's always contained in the window
rectangle.  Just initialize to the opaque rectangle.
2013-02-14 22:03:02 -05:00
Kristian Høgsberg d8b617deea xwm: Fix input region regression from commit changes
This must be the last regression from the surface commit changes.  We
need to set the pending.input region, otherwise the region will be
overwritten on commit.

https://bugs.freedesktop.org/show_bug.cgi?id=60610
2013-02-14 21:56:48 -05:00
Kristian Høgsberg b810eb5750 xwm: Support _NET_WM_STATE_FULLSCREEN
We can now handle fullscreen X windows.  X clients request to go fullscreen
buy sending a _NET_WM_STATE client message to the root window.  When that
happens we call into the shell interface and asks the shell to make the
surface fullscreen.  The shell will then resize the window, which causes
the X wm to configure the X window appropriately.

Make sure we ignore configure requests from fullscreened clients and send out
the synthetic configure notify as required in that case.

Finally, inspect _NET_WM_STATE before mapping so we can handle initial
fullscreen correctly.
2013-02-12 21:55:51 -05:00
Rob Bradford aa521bd1bc xwayland/window-manager: Avoid doing work for unknown window
In particular if the hash table lookup fails and returns NULL then that value
would be passed into weston_wm_window_schedule_repaint which does not accept a
NULL value.
2013-01-10 16:08:08 -05:00
Tiago Vignatti 2d129f11fe xwayland: Staticize weston_wm_set_selection and read_and_dump_property
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-11-30 18:00:09 -05:00
Tiago Vignatti 9c4ff831c6 xwm: Rename get_resources function
It's pure WM-related function, so use the same 'weston_wm_' prefix that others
in the same file are already using.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-11-30 18:00:09 -05:00
Scott Moreau 76d8fc8216 xwm: Fix xwm opaque region
Since surface.commit was introduced, opqaue regions are stored in a pending
variable that isn't used until surface.commit. Xwayland uses the surface opaque
region as a way to tell weston what region of the surface should be opaque.
However when this pending opaque region was introduced, xwm was not updated
and so we have the 'black = transparent' problem again. This patch fixes the
problem by having xwm use the pending opaque regions.
2012-11-27 17:23:42 -05:00