Commit Graph

81 Commits

Author SHA1 Message Date
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
Tiago Vignatti ac78bb1017 xwm: Fail safely if cursor is not found
It will use the stock 'x' cursor instead when the system cursors are not
provided.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-10-29 13:44:33 -04:00
Scott Moreau c6a7e4b277 toytoolkit: Don't draw shadows for maximized windows.
Add THEME_FRAME_MAXIMIZED flag so the theming system can know not to draw
shadows for maximized windows. This allows maximized surfaces' content to be
sized and placed in a more expectable fashion.
2012-10-10 11:23:41 -04:00
Tiago Vignatti 0d20d7c8f4 xwm: Plug kill signal for killing X apps
Xeyes is the counter-example that fails on that heuristic and won't be caught
on kill binding. This and the last two patches should fix:

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

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-10-04 11:07:50 -04:00
Pekka Paalanen 4f9c07bf11 xwayland: replace opaque_rect, fix an alpha problem
Remove weston_surface::opaque_rect completely.

Instead, set the opaque region in xwayland.

Before this patch, black text in xterm was transparent. Now it is not.

However, this patch fixes only a part of the alpha problem. If you apply
full-surface alpha with super+alt+wheel, the problem reappears. This
problem is still due to bad alpha channel contents on xwayland windows.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-04 16:14:29 -04:00
Kristian Høgsberg 5ba31891a1 xwm: Use a simple heuristic for mapping X input events to a weston seat 2012-08-10 10:06:59 -04:00
Kristian Høgsberg 64eca8949b compositor: Fold the log prototypes into compositor.h and drop log.h
We're trying to keep the API exposed by the core compositor in compositor.h
2012-08-01 00:00:57 -04:00
Kristian Høgsberg c4063f310a xwm: Make override-redirect windows opaque 2012-07-22 15:32:45 -04:00
Tiago Vignatti ce1baa8097 xwm: use last focused window for guessing transient parent
On X the global absolute coordinates are sent in ConfigureNotify and transient
windows are mapped exactly on that position. On Wayland we don't have the
concept of global coordinates, and that's a problem for transient surfaces
without transient_for set because they rely on such hint for setting their
positioning.

So this solution is a workaround. It guesses a parent based on the last
focused window to determine the relative position of the transient surface.
This put transient windows of Chrome browser back to work.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-22 14:35:25 -04:00
Tiago Vignatti e66fcee435 xwm: Fix transient positioning
Commit eaee7841 took out the configure positioning of windows. This patch
brings it back and addresses also logic for resizing and sub-menus, that was
not covered on that commit.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-22 14:28:35 -04:00
Tiago Vignatti 2ea74d9f71 xwm: Initialize window decoration always as !override
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-22 14:26:49 -04:00
Tiago Vignatti 9134b77f2c xwm: Don't try to change frame cursor when there's no decoration
It was causing some artifacts on chrome.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-20 15:31:00 -04:00
Tiago Vignatti c190323c90 xwm: set the root window pointer to left_ptr
More pretty and also consistent with toytoolkit.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-16 13:35:27 -04:00
Tiago Vignatti 236b48d414 xwm: set appropriate cursors for the frame window
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-16 13:35:27 -04:00
Tiago Vignatti 90fada4338 xwayland: add simple xcb-cursor hook based on libXcursor
It's in fact based on the core of libXcursor, which doesn't bring any Xlib
dependency.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-16 13:35:27 -04:00
Kristian Høgsberg e89cef37eb xwayland: Look up 32 depth rgba render format as well 2012-07-16 13:35:27 -04:00
Kristian Høgsberg e6d8d2f62a xwayland: Use the right length for iterating through the formats array
Spotted by Tiago Vignatti, minimal fix to just use the right length.
2012-07-16 13:35:26 -04:00