Compare commits
283 Commits
3.11.2-way
...
wip/surfac
Author | SHA1 | Date | |
---|---|---|---|
2210c30cba | |||
6b98ac3d1f | |||
13ddd366a9 | |||
17462c21e8 | |||
c964ef4e01 | |||
0dccc440b6 | |||
48f7232492 | |||
ff5867e4d3 | |||
a5d950f453 | |||
7615d17293 | |||
374e30043b | |||
f771bb88d6 | |||
7ef8d21e48 | |||
c251eb8ec0 | |||
1e6b3faa83 | |||
e62fe956fd | |||
24c5290d7f | |||
00c8d3c897 | |||
cc13f8f65e | |||
47f4c9db7b | |||
4c621cc30f | |||
756a412436 | |||
be16c2fe71 | |||
a364c2a96b | |||
414259a7f8 | |||
283a81eac0 | |||
2a145262c7 | |||
57728b4322 | |||
ef24fb6296 | |||
86f057a712 | |||
dcd628d289 | |||
6038877c4c | |||
4e6321c239 | |||
304a525744 | |||
f26de405dd | |||
ed18580118 | |||
b65649186d | |||
515dc08a97 | |||
2e7a56a28f | |||
c485637a61 | |||
f9f2a82e18 | |||
2f4563132a | |||
e3a0f2c546 | |||
d39baeb8ad | |||
f27f6aab78 | |||
a66060e21a | |||
11aa3c030b | |||
bd1bec5617 | |||
d9659d4b36 | |||
d043d9943b | |||
a0ef7c7142 | |||
4efe4483fb | |||
aec3edb1cc | |||
0c5a6ad775 | |||
2be5401b1e | |||
f16e9b2ee7 | |||
06380938d4 | |||
87b20d7f2a | |||
593db0baee | |||
6b66553493 | |||
ddaae9c923 | |||
0c7a7d7527 | |||
6561b53346 | |||
def5e86673 | |||
0c213c8fee | |||
912a0abd26 | |||
d694260ad2 | |||
8566566451 | |||
0ce64e46e8 | |||
a8336669a3 | |||
f6db756326 | |||
27ab516f41 | |||
9542b464bf | |||
1ebaaa1950 | |||
71efbf0330 | |||
a6539463be | |||
b8e096db82 | |||
3e98ffaf99 | |||
0a9754f305 | |||
965a784c8a | |||
2db9f55669 | |||
3e73babaf7 | |||
66c4555dc7 | |||
183ad75603 | |||
66fc32ee14 | |||
d6396cf2c4 | |||
c9b7104117 | |||
6bf1a66b7c | |||
7e7b671b8e | |||
e04a55d1a2 | |||
8905bd2280 | |||
b09e1399c0 | |||
59c8b949ad | |||
6dbb3fddce | |||
f166240225 | |||
91b789c707 | |||
14db280fab | |||
f7097e6f66 | |||
ff89f1e271 | |||
6a8a4bfdcd | |||
cd35982d4e | |||
2f6f0f252c | |||
13651949ed | |||
fdeb72224c | |||
92e36e7076 | |||
d74796ee80 | |||
3e35cac67a | |||
1f7a6bf845 | |||
365442c1ff | |||
c8d185fc74 | |||
9567fa9c6a | |||
7a8de0c0af | |||
10fead9ba1 | |||
d5d5c2167a | |||
b9755ea725 | |||
39fee9f5a2 | |||
d6282716b2 | |||
60d9bee3bf | |||
a09fa3b0e4 | |||
9edff6f250 | |||
7d3012fd67 | |||
225e20a898 | |||
1a62ac9276 | |||
45cb151443 | |||
55b18f9671 | |||
4f4b1bfc37 | |||
9348c9bd4b | |||
16de7f66fb | |||
799c27484d | |||
c3b0faec82 | |||
9c876722a0 | |||
96fc93d744 | |||
20545941fa | |||
59f79e8294 | |||
ac32b9ef95 | |||
ba484be754 | |||
a318198ab4 | |||
e6391c2896 | |||
7ea537fad7 | |||
03146c2967 | |||
0a81314337 | |||
fa7a5782c6 | |||
e3b64912b6 | |||
a0fe392665 | |||
0e5f365d55 | |||
bfc906cbc4 | |||
8e6f8087e8 | |||
56207ddb6a | |||
8cb9cfb7b8 | |||
be698b597b | |||
1d61a0f9b5 | |||
788bd59857 | |||
2391606cc5 | |||
7155d7e043 | |||
419dfd333a | |||
b4535f2622 | |||
9b21346427 | |||
7b15d21e40 | |||
7b597b8c62 | |||
7a4adce44f | |||
a5f0db5ecb | |||
577624adef | |||
af46ef3b96 | |||
39d26be941 | |||
7bfc9109f7 | |||
becbad56ef | |||
384a34c27d | |||
002c5b8f87 | |||
1d3dbea20c | |||
ebe6e3180e | |||
a3de799939 | |||
0caf7381bb | |||
a42305edab | |||
732c059235 | |||
ef2b6e7d00 | |||
9c1b972ca1 | |||
cb33e1942a | |||
7009d1e470 | |||
c54a19825b | |||
8131f34eb6 | |||
f29241d90e | |||
bad48ea815 | |||
66af41f4a9 | |||
e30be380dd | |||
65f2e29375 | |||
98dbba1e17 | |||
422648e2eb | |||
f0fa4d831a | |||
1b600f5867 | |||
fd8cc9b7a8 | |||
ca5b5e6bc4 | |||
ee683ff187 | |||
57602adfe7 | |||
1481836ed6 | |||
309f78ff52 | |||
6436459381 | |||
65b39212d5 | |||
283649b8d7 | |||
fa65c380db | |||
58b39233f5 | |||
82066e02c5 | |||
c36aa5e696 | |||
29197d40c6 | |||
8d5ab6b5b3 | |||
a796938b39 | |||
3813113f1a | |||
1be117e430 | |||
622c7a021b | |||
4d2d2f285b | |||
0924c7d61b | |||
2746608eb2 | |||
fe26cb5989 | |||
602307e694 | |||
b2c18c4a78 | |||
1e211722c7 | |||
461f74ef18 | |||
3f022ca963 | |||
20e92c5a72 | |||
0850da44d7 | |||
37ba264190 | |||
6c12c928df | |||
9c5733caf0 | |||
21d8b8310a | |||
c46af91d54 | |||
d44574f738 | |||
a9424255a5 | |||
5089a63d76 | |||
f9a2c64460 | |||
7841042a85 | |||
ea1b8cdc22 | |||
52b48cfbef | |||
644f3e1275 | |||
304005e04f | |||
025ab35af7 | |||
a27744503b | |||
1011331caf | |||
0ccef81789 | |||
4780f74a40 | |||
57866fb267 | |||
d3bc7570d0 | |||
74e43a4702 | |||
0764b2058a | |||
7a787d7946 | |||
eec0f5df47 | |||
ba3968a822 | |||
762fa0e116 | |||
0be57b621b | |||
7d88b3593b | |||
858db7081a | |||
5af7f619c8 | |||
e5e35e5a7f | |||
6d639ac528 | |||
aa3643cdde | |||
8a3501ffe1 | |||
5ea443eb4b | |||
a37a8c6497 | |||
ebf6862a10 | |||
6c0e16c482 | |||
40b1e7312d | |||
1c0e6f26e2 | |||
f4fc498e65 | |||
a8632c2546 | |||
600a0f836f | |||
0ac142d39e | |||
abd368be00 | |||
a8ac2cc275 | |||
2f14b5cc3f | |||
2930612e64 | |||
2952d3671d | |||
1b5ace8256 | |||
2ebecc5370 | |||
02144d17e9 | |||
71496c8909 | |||
594b15abf1 | |||
bbe3641844 | |||
0cc5cf940b | |||
153d8efcf5 | |||
be744775c1 | |||
5959457c73 | |||
0824eb7c96 | |||
d945501be6 | |||
ca342c4573 | |||
4326d0bf3a |
3
.gitignore
vendored
3
.gitignore
vendored
@ -79,13 +79,10 @@ src/meta-dbus-xrandr.[ch]
|
||||
src/meta-dbus-idle-monitor.[ch]
|
||||
src/mutter-plugins.pc
|
||||
src/wayland/gtk-shell-protocol.c
|
||||
src/wayland/gtk-shell-client-protocol.h
|
||||
src/wayland/gtk-shell-server-protocol.h
|
||||
src/wayland/xdg-shell-protocol.c
|
||||
src/wayland/xdg-shell-client-protocol.h
|
||||
src/wayland/xdg-shell-server-protocol.h
|
||||
src/wayland/xserver-protocol.c
|
||||
src/wayland/xserver-client-protocol.h
|
||||
src/wayland/xserver-server-protocol.h
|
||||
doc/reference/*.args
|
||||
doc/reference/*.bak
|
||||
|
41
COPYING
41
COPYING
@ -1,12 +1,12 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
@ -225,7 +225,7 @@ impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
42
NEWS
42
NEWS
@ -1,3 +1,45 @@
|
||||
3.11.5
|
||||
======
|
||||
* Fix CSD titlebars being placed off-screen [Jasper; #719772]
|
||||
* Add support for subsurfaces [Jonas; #705502]
|
||||
* Expose MetaWindow:skip-taskbar property [Florian; #723307]
|
||||
* Fix legacy tray icons showing up blank [Adel; #721596]
|
||||
* Fix configuration of cloned monitors [Adel; #710610]
|
||||
* Misc bug fixes and cleanups [Jasper, Adel, Marek, Jonas; #720631, #723468,
|
||||
#720818, #723563, #723564]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Marek Ch, Adel Gadllah, Florian Müllner, Jasper St. Pierre
|
||||
|
||||
3.11.4
|
||||
======
|
||||
* Don't leave focus on windows that are being unmanaged [Owen; #711618]
|
||||
* Reduce server grabs [Daniel Drake; #721345, #721709]
|
||||
* Improve heuristic to determine display output name [Cosimo Cecchi; #721674]
|
||||
* Atomically unmaximize both directions [Jasper; #722108]
|
||||
* Misc bug fixes [Debarshi, Andika, Florian; #721517, #721674, #722347]
|
||||
|
||||
Contributors:
|
||||
Cosimo Cecchi, Daniel Drake, Florian Müllner, Debarshi Ray, Jasper St. Pierre,
|
||||
Andika Triwidada, Owen W. Taylor
|
||||
|
||||
3.11.3
|
||||
======
|
||||
* Fix focus issues with external OSKs[Jasper; #715030]
|
||||
* Add a MetaCullable interface [Jasper; #714706]
|
||||
* Fix window keybindings [Rui; #719724]
|
||||
* Fix settings keyboard/pointer focus for new clients [Rui; #719725]
|
||||
* Fix window group paint volume [Owen; #719669]
|
||||
* Fix frame extents problems [Owen; #714707]
|
||||
* Add shortcut to move windows between monitors [Florian; #671054]
|
||||
* Fix problems with focus tracking [Owen; #720558]
|
||||
* Misc. bug fixes and cleanups: [Rui, Colin, Lionel, Jasper, Owen; #712833,
|
||||
#719557, #719695, #719833, #678989, #720417, #720630]
|
||||
|
||||
Contributors:
|
||||
Lionel Landwerlin, Rui Matos, Alberto Milone, Florian Müllner,
|
||||
Jasper St. Pierre, Rico Tzschichholz, Owen W. Taylor, Colin Walters
|
||||
|
||||
3.11.2
|
||||
======
|
||||
* Support setting a NULL opaque region [Andreas; #711518]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
|
@ -3,7 +3,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
m4_define([mutter_major_version], [3])
|
||||
m4_define([mutter_minor_version], [11])
|
||||
m4_define([mutter_micro_version], [2])
|
||||
m4_define([mutter_micro_version], [5])
|
||||
|
||||
m4_define([mutter_version],
|
||||
[mutter_major_version.mutter_minor_version.mutter_micro_version])
|
||||
@ -79,7 +79,7 @@ MUTTER_PC_MODULES="
|
||||
gsettings-desktop-schemas >= 3.7.3
|
||||
xcomposite >= 0.2 xfixes xrender xdamage xi >= 1.6.0
|
||||
$CLUTTER_PACKAGE >= 1.17.1
|
||||
cogl-1.0 >= 1.13.3
|
||||
cogl-1.0 >= 1.17.1
|
||||
upower-glib >= 0.99.0
|
||||
gnome-desktop-3.0
|
||||
"
|
||||
@ -212,9 +212,6 @@ fi
|
||||
|
||||
MUTTER_PC_MODULES="$MUTTER_PC_MODULES xcursor"
|
||||
|
||||
# We always build with wayland enabled
|
||||
AC_DEFINE(HAVE_WAYLAND, , [Building with Wayland support])
|
||||
|
||||
AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
|
||||
AS_IF([test "x$WAYLAND_SCANNER" = "xno"],
|
||||
AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension protocols]))
|
||||
|
@ -96,8 +96,6 @@ meta_compositor_hide_window
|
||||
meta_compositor_switch_workspace
|
||||
meta_compositor_maximize_window
|
||||
meta_compositor_unmaximize_window
|
||||
meta_compositor_window_mapped
|
||||
meta_compositor_window_unmapped
|
||||
meta_compositor_sync_window_geometry
|
||||
meta_compositor_set_updates_frozen
|
||||
meta_compositor_queue_frame_drawn
|
||||
@ -388,6 +386,23 @@ MetaWindowActorPrivate
|
||||
meta_window_actor_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>meta-cullable</FILE>
|
||||
<TITLE>MetaCullable</TITLE>
|
||||
MetaCullable
|
||||
MetaCullableInterface
|
||||
meta_cullable_cull_out
|
||||
meta_cullable_reset_culling
|
||||
meta_cullable_cull_out_children
|
||||
meta_cullable_reset_culling_children
|
||||
<SUBSECTION Standard>
|
||||
META_TYPE_CULLABLE
|
||||
META_CULLABLE
|
||||
META_IS_CULLABLE
|
||||
META_CULLABLE_GET_IFACE
|
||||
meta_cullable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>prefs</FILE>
|
||||
MetaPreference
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="xdg_surface">
|
||||
<protocol name="xdg_shell">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2008-2013 Kristian Høgsberg
|
||||
@ -43,7 +43,7 @@
|
||||
Use this enum to check the protocol version, and it will be updated
|
||||
automatically.
|
||||
</description>
|
||||
<entry name="current" value="1" summary="Always the latest version"/>
|
||||
<entry name="current" value="2" summary="Always the latest version"/>
|
||||
</enum>
|
||||
|
||||
|
||||
@ -84,6 +84,28 @@
|
||||
<arg name="y" type="int"/>
|
||||
<arg name="flags" type="uint"/>
|
||||
</request>
|
||||
|
||||
<event name="ping">
|
||||
<description summary="check if the client is alive">
|
||||
The ping event asks the client if it's still alive. Pass the
|
||||
serial specified in the event back to the compositor by sending
|
||||
a "pong" request back with the specified serial.
|
||||
|
||||
Compositors can use this to determine if the client is still
|
||||
alive. It's unspecified what will happen if the client doesn't
|
||||
respond to the ping request, or in what timeframe. Clients should
|
||||
try to respond in a reasonable amount of time.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="pass this to the callback"/>
|
||||
</event>
|
||||
|
||||
<request name="pong">
|
||||
<description summary="respond to a ping event">
|
||||
A client must respond to a ping event with a pong request or
|
||||
the client may be deemed unresponsive.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="serial of the ping event"/>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="xdg_surface" version="1">
|
||||
@ -121,7 +143,33 @@
|
||||
unmapped if the parent is unmapped too. They should not appear
|
||||
on task bars and alt+tab.
|
||||
</description>
|
||||
<arg name="parent" type="object" interface="wl_surface"/>
|
||||
<arg name="parent" type="object" interface="wl_surface" allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<request name="set_margin">
|
||||
<description summary="set the visible frame boundaries">
|
||||
This tells the compositor what the visible size of the window
|
||||
should be, so it can use it to determine what borders to use for
|
||||
constrainment and alignment.
|
||||
|
||||
CSD often has invisible areas for decoration purposes, like drop
|
||||
shadows. These "shadow" drawings need to be subtracted out of the
|
||||
normal boundaries of the window when computing where to place
|
||||
windows (e.g. to set this window so it's centered on top of another,
|
||||
or to put it to the left or right of the screen.)
|
||||
|
||||
This value should change as little as possible at runtime, to
|
||||
prevent flicker.
|
||||
|
||||
This value is also ignored when the window is maximized or
|
||||
fullscreen, and assumed to be 0.
|
||||
|
||||
If never called, this value is assumed to be 0.
|
||||
</description>
|
||||
<arg name="left_margin" type="int"/>
|
||||
<arg name="right_margin" type="int"/>
|
||||
<arg name="top_margin" type="int"/>
|
||||
<arg name="bottom_margin" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_title">
|
||||
@ -150,22 +198,6 @@
|
||||
<arg name="app_id" type="string"/>
|
||||
</request>
|
||||
|
||||
<request name="pong">
|
||||
<description summary="respond to a ping event">
|
||||
A client must respond to a ping event with a pong request or
|
||||
the client may be deemed unresponsive.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="serial of the ping event"/>
|
||||
</request>
|
||||
|
||||
<event name="ping">
|
||||
<description summary="ping client">
|
||||
Ping a client to check if it is receiving events and sending
|
||||
requests. A client is expected to reply with a pong request.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
</event>
|
||||
|
||||
<request name="move">
|
||||
<description summary="start an interactive move">
|
||||
Start a pointer-driven move of the surface.
|
||||
@ -217,15 +249,6 @@
|
||||
ignore it if it doesn't resize, pick a smaller size (to
|
||||
satisfy aspect ratio or resize in steps of NxM pixels).
|
||||
|
||||
The edges parameter provides a hint about how the surface
|
||||
was resized. The client may use this information to decide
|
||||
how to adjust its content to the new size (e.g. a scrolling
|
||||
area might adjust its content position to leave the viewable
|
||||
content unmoved). Valid edge values are from resize_edge enum.
|
||||
|
||||
The maximized parameter informs if the surface is in a maximized
|
||||
state. Same for the fullscreen parameter.
|
||||
|
||||
The client is free to dismiss all but the last configure
|
||||
event it received.
|
||||
|
||||
@ -233,11 +256,8 @@
|
||||
in surface local coordinates.
|
||||
</description>
|
||||
|
||||
<arg name="edges" type="uint"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="maximized" type="uint"/>
|
||||
<arg name="fullscreen" type="uint"/>
|
||||
</event>
|
||||
|
||||
<request name="set_output">
|
||||
@ -255,16 +275,43 @@
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<event name="request_set_fullscreen">
|
||||
<description summary="server requests that the client set fullscreen">
|
||||
Event sent from the compositor to the client requesting that the client
|
||||
goes to a fullscreen state. It's the client job to call set_fullscreen
|
||||
and really trigger the fullscreen state.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="request_unset_fullscreen">
|
||||
<description summary="server requests that the client unset fullscreen">
|
||||
Event sent from the compositor to the client requesting that the client
|
||||
leaves the fullscreen state. It's the client job to call
|
||||
unset_fullscreen and really leave the fullscreen state.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="set_fullscreen">
|
||||
<description summary="set the surface state as fullscreen">
|
||||
Set the surface as fullscreen.
|
||||
|
||||
The compositor must reply to this request with a configure event
|
||||
with the dimensions for the output on which the surface will be
|
||||
made fullscreen.
|
||||
After this request, the compositor should send a configure event
|
||||
informing the output size.
|
||||
|
||||
Once the fullscreen state is set, a "fullscreen_set" event will
|
||||
be sent to the client.
|
||||
This request informs the compositor that the next attached buffer
|
||||
committed will be in a fullscreen state. The buffer size should be the
|
||||
same size as the size informed in the configure event, if the client
|
||||
doesn't want to leave any empty area.
|
||||
|
||||
In other words: the next attached buffer after set_maximized is the new
|
||||
maximized buffer. And the surface will be positioned at the maximized
|
||||
position on commit.
|
||||
|
||||
A simple way to synchronize and wait for the correct configure event is
|
||||
to use a wl_display.sync request right after the set_fullscreen
|
||||
request. When the sync callback returns, the last configure event
|
||||
received just before it will be the correct one, and should contain the
|
||||
right size for the surface to maximize.
|
||||
|
||||
Setting one state won't unset another state. Use
|
||||
xdg_surface.unset_fullscreen for unsetting it.
|
||||
@ -274,19 +321,48 @@
|
||||
<request name="unset_fullscreen">
|
||||
<description summary="unset the surface state as fullscreen">
|
||||
Unset the surface fullscreen state.
|
||||
|
||||
Same negotiation as set_fullscreen must be used.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="request_set_maximized">
|
||||
<description summary="server requests that the client set maximized">
|
||||
Event sent from the compositor to the client requesting that the client
|
||||
goes to a maximized state. It's the client job to call set_maximized
|
||||
and really trigger the maximized state.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="request_unset_maximized">
|
||||
<description summary="server requests that the client unset maximized">
|
||||
Event sent from the compositor to the client requesting that the client
|
||||
leaves the maximized state. It's the client job to call unset_maximized
|
||||
and really leave the maximized state.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="set_maximized">
|
||||
<description summary="set the surface state as maximized">
|
||||
Set the surface as maximized.
|
||||
|
||||
The compositor must reply to this request with a configure event
|
||||
with the dimensions for the output on which the surface will be
|
||||
made maximized.
|
||||
After this request, the compositor will send a configure event
|
||||
informing the output size minus panel and other MW decorations.
|
||||
|
||||
Once the maximized state is set, a "maximized_set" event will be
|
||||
sent to the client.
|
||||
This request informs the compositor that the next attached buffer
|
||||
committed will be in a maximized state. The buffer size should be the
|
||||
same size as the size informed in the configure event, if the client
|
||||
doesn't want to leave any empty area.
|
||||
|
||||
In other words: the next attached buffer after set_maximized is the new
|
||||
maximized buffer. And the surface will be positioned at the maximized
|
||||
position on commit.
|
||||
|
||||
A simple way to synchronize and wait for the correct configure event is
|
||||
to use a wl_display.sync request right after the set_maximized request.
|
||||
When the sync callback returns, the last configure event received just
|
||||
before it will be the correct one, and should contain the right size
|
||||
for the surface to maximize.
|
||||
|
||||
Setting one state won't unset another state. Use
|
||||
xdg_surface.unset_maximized for unsetting it.
|
||||
@ -296,6 +372,8 @@
|
||||
<request name="unset_maximized">
|
||||
<description summary="unset the surface state as maximized">
|
||||
Unset the surface maximized state.
|
||||
|
||||
Same negotiation as set_maximized must be used.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
@ -307,18 +385,38 @@
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="focused_set">
|
||||
<description summary="surface was focused">
|
||||
The focused_set event is sent when this surface has been
|
||||
activated. Window decorations should be updated accordingly.
|
||||
<event name="activated">
|
||||
<description summary="surface was activated">
|
||||
The activated_set event is sent when this surface has been
|
||||
activated, which means that the surface has user attention.
|
||||
Window decorations should be updated accordingly. You should
|
||||
not use this event for anything but the style of decorations
|
||||
you display, use wl_keyboard.enter and wl_keyboard.leave for
|
||||
determining keyboard focus.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="focused_unset">
|
||||
<description summary="surface was unfocused">
|
||||
The focused_unset event is sent when this surface has been
|
||||
deactivated, because another surface has been activated. Window
|
||||
decorations should be updated accordingly.
|
||||
<event name="deactivated">
|
||||
<description summary="surface was deactivated">
|
||||
The deactivate event is sent when this surface has been
|
||||
deactivated, which means that the surface lost user attention.
|
||||
Window decorations should be updated accordingly. You should
|
||||
not use this event for anything but the style of decorations
|
||||
you display, use wl_keyboard.enter and wl_keyboard.leave for
|
||||
determining keyboard focus.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<event name="delete">
|
||||
<description summary="surface wants to be closed">
|
||||
The delete event is sent by the compositor when the user
|
||||
wants the surface to be closed. This should be equivalent to
|
||||
the user clicking the close button in client-side decorations,
|
||||
if your application has any...
|
||||
|
||||
This is only a request that the user intends to close your
|
||||
window. The client may choose to ignore this request, or show
|
||||
a dialog to ask the user to save their data...
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
@ -356,22 +454,6 @@
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="pong">
|
||||
<description summary="respond to a ping event">
|
||||
A client must respond to a ping event with a pong request or
|
||||
the client may be deemed unresponsive.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="serial of the ping event"/>
|
||||
</request>
|
||||
|
||||
<event name="ping">
|
||||
<description summary="ping client">
|
||||
Ping a client to check if it is receiving events and sending
|
||||
requests. A client is expected to reply with a pong request.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
</event>
|
||||
|
||||
<event name="popup_done">
|
||||
<description summary="popup interaction is done">
|
||||
The popup_done event is sent out when a popup grab is broken,
|
||||
|
@ -42,13 +42,10 @@ mutter_built_sources = \
|
||||
mutter-enum-types.c \
|
||||
wayland/gtk-shell-protocol.c \
|
||||
wayland/gtk-shell-server-protocol.h \
|
||||
wayland/gtk-shell-client-protocol.h \
|
||||
wayland/xdg-shell-protocol.c \
|
||||
wayland/xdg-shell-server-protocol.h \
|
||||
wayland/xdg-shell-client-protocol.h \
|
||||
wayland/xserver-protocol.c \
|
||||
wayland/xserver-server-protocol.h \
|
||||
wayland/xserver-client-protocol.h
|
||||
wayland/xserver-server-protocol.h
|
||||
|
||||
libmutter_wayland_la_SOURCES = \
|
||||
core/async-getprop.c \
|
||||
@ -70,7 +67,8 @@ libmutter_wayland_la_SOURCES = \
|
||||
compositor/meta-background-actor.c \
|
||||
compositor/meta-background-actor-private.h \
|
||||
compositor/meta-background-group.c \
|
||||
compositor/meta-background-group-private.h \
|
||||
compositor/meta-cullable.c \
|
||||
compositor/meta-cullable.h \
|
||||
compositor/meta-module.c \
|
||||
compositor/meta-module.h \
|
||||
compositor/meta-plugin.c \
|
||||
@ -82,6 +80,10 @@ libmutter_wayland_la_SOURCES = \
|
||||
compositor/meta-shaped-texture-private.h \
|
||||
compositor/meta-surface-actor.c \
|
||||
compositor/meta-surface-actor.h \
|
||||
compositor/meta-surface-actor-x11.c \
|
||||
compositor/meta-surface-actor-x11.h \
|
||||
compositor/meta-surface-actor-wayland.c \
|
||||
compositor/meta-surface-actor-wayland.h \
|
||||
compositor/meta-texture-rectangle.c \
|
||||
compositor/meta-texture-rectangle.h \
|
||||
compositor/meta-texture-tower.c \
|
||||
@ -162,6 +164,8 @@ libmutter_wayland_la_SOURCES = \
|
||||
core/util-private.h \
|
||||
core/window-props.c \
|
||||
core/window-props.h \
|
||||
core/window-x11.c \
|
||||
core/window-x11.h \
|
||||
core/window.c \
|
||||
core/window-private.h \
|
||||
meta/window.h \
|
||||
@ -188,12 +192,7 @@ libmutter_wayland_la_SOURCES = \
|
||||
ui/theme.c \
|
||||
meta/theme.h \
|
||||
ui/theme-private.h \
|
||||
ui/ui.c
|
||||
|
||||
nodist_libmutter_wayland_la_SOURCES = \
|
||||
$(mutter_built_sources)
|
||||
|
||||
libmutter_wayland_la_SOURCES += \
|
||||
ui/ui.c \
|
||||
wayland/meta-wayland.c \
|
||||
wayland/meta-wayland-private.h \
|
||||
wayland/meta-xwayland-private.h \
|
||||
@ -215,6 +214,9 @@ libmutter_wayland_la_SOURCES += \
|
||||
wayland/meta-weston-launch.c \
|
||||
wayland/meta-weston-launch.h
|
||||
|
||||
nodist_libmutter_wayland_la_SOURCES = \
|
||||
$(mutter_built_sources)
|
||||
|
||||
libmutter_wayland_la_LDFLAGS = -no-undefined
|
||||
libmutter_wayland_la_LIBADD = $(MUTTER_LIBS)
|
||||
|
||||
@ -417,6 +419,3 @@ wayland/%-protocol.c : $(top_builddir)/protocol/%.xml
|
||||
wayland/%-server-protocol.h : $(top_builddir)/protocol/%.xml
|
||||
mkdir -p wayland
|
||||
$(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@
|
||||
wayland/%-client-protocol.h : $(top_builddir)/protocol/%.xml
|
||||
mkdir -p wayland
|
||||
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "clutter-utils.h"
|
||||
@ -95,8 +93,10 @@ meta_actor_vertices_are_untransformed (ClutterVertex *verts,
|
||||
v3x != v1x || v3y != v2y)
|
||||
return FALSE;
|
||||
|
||||
*x_origin = x;
|
||||
*y_origin = y;
|
||||
if (x_origin)
|
||||
*x_origin = x;
|
||||
if (y_origin)
|
||||
*y_origin = y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_CLUTTER_UTILS_H__
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_COGL_UTILS_H__
|
||||
|
@ -17,8 +17,6 @@ struct _MetaCompositor
|
||||
{
|
||||
MetaDisplay *display;
|
||||
|
||||
Atom atom_x_root_pixmap;
|
||||
Atom atom_net_wm_window_opacity;
|
||||
guint repaint_func_id;
|
||||
|
||||
ClutterActor *shadow_src;
|
||||
@ -48,11 +46,8 @@ struct _MetaCompScreen
|
||||
CoglFrameClosure *frame_closure;
|
||||
|
||||
/* Used for unredirecting fullscreen windows */
|
||||
guint disable_unredirect_count;
|
||||
MetaWindowActor *unredirected_window;
|
||||
|
||||
/* Before we create the output window */
|
||||
XserverRegion pending_input_region;
|
||||
guint disable_unredirect_count;
|
||||
MetaWindow *unredirected_window;
|
||||
|
||||
gint switch_workspace_in_progress;
|
||||
|
||||
|
@ -42,15 +42,6 @@
|
||||
* the call, so it may be necessary to readjust the display based on the
|
||||
* old_rect to start the animation.
|
||||
*
|
||||
* meta_compositor_window_mapped() and meta_compositor_window_unmapped() are
|
||||
* notifications when the toplevel window (frame or client window) is mapped or
|
||||
* unmapped. That is, when the result of meta_window_toplevel_is_mapped()
|
||||
* changes. The main use of this is to drop resources when a window is unmapped.
|
||||
* A window will always be mapped before meta_compositor_show_window()
|
||||
* is called and will not be unmapped until after meta_compositor_hide_window()
|
||||
* is called. If the live_hidden_windows preference is set, windows will never
|
||||
* be unmapped.
|
||||
*
|
||||
* # Containers #
|
||||
*
|
||||
* There's two containers in the stage that are used to place window actors, here
|
||||
@ -149,19 +140,6 @@ meta_compositor_destroy (MetaCompositor *compositor)
|
||||
clutter_threads_remove_repaint_func (compositor->repaint_func_id);
|
||||
}
|
||||
|
||||
static void
|
||||
add_win (MetaWindow *window)
|
||||
{
|
||||
MetaScreen *screen = meta_window_get_screen (window);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
meta_window_actor_new (window);
|
||||
|
||||
sync_actor_stacking (info);
|
||||
}
|
||||
|
||||
static void
|
||||
process_damage (MetaCompositor *compositor,
|
||||
XDamageNotifyEvent *event,
|
||||
@ -179,31 +157,6 @@ process_damage (MetaCompositor *compositor,
|
||||
meta_window_actor_process_x11_damage (window_actor, event);
|
||||
}
|
||||
|
||||
static void
|
||||
process_property_notify (MetaCompositor *compositor,
|
||||
XPropertyEvent *event,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaWindowActor *window_actor;
|
||||
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||
if (window_actor == NULL)
|
||||
return;
|
||||
|
||||
/* Check for the opacity changing */
|
||||
if (event->atom == compositor->atom_net_wm_window_opacity)
|
||||
{
|
||||
meta_window_actor_update_opacity (window_actor);
|
||||
DEBUG_TRACE ("process_property_notify: net_wm_window_opacity\n");
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_TRACE ("process_property_notify: unknown\n");
|
||||
}
|
||||
|
||||
static Window
|
||||
get_output_window (MetaScreen *screen)
|
||||
{
|
||||
@ -308,25 +261,6 @@ meta_get_window_actors (MetaScreen *screen)
|
||||
return info->windows;
|
||||
}
|
||||
|
||||
static void
|
||||
do_set_stage_input_region (MetaScreen *screen,
|
||||
XserverRegion region)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
|
||||
XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
|
||||
|
||||
/* It's generally a good heuristic that when a crossing event is generated because
|
||||
* we reshape the overlay, we don't want it to affect focus-follows-mouse focus -
|
||||
* it's not the user doing something, it's the environment changing under the user.
|
||||
*/
|
||||
meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
|
||||
XFixesSetWindowShapeRegion (xdpy, info->output, ShapeInput, 0, 0, region);
|
||||
}
|
||||
|
||||
void
|
||||
meta_set_stage_input_region (MetaScreen *screen,
|
||||
XserverRegion region)
|
||||
@ -338,29 +272,19 @@ meta_set_stage_input_region (MetaScreen *screen,
|
||||
*/
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
|
||||
if (info->stage && info->output)
|
||||
{
|
||||
do_set_stage_input_region (screen, region);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Reset info->pending_input_region if one existed before and set the new
|
||||
* one to use it later. */
|
||||
if (info->pending_input_region)
|
||||
{
|
||||
XFixesDestroyRegion (xdpy, info->pending_input_region);
|
||||
info->pending_input_region = None;
|
||||
}
|
||||
if (region != None)
|
||||
{
|
||||
info->pending_input_region = XFixesCreateRegion (xdpy, NULL, 0);
|
||||
XFixesCopyRegion (xdpy, info->pending_input_region, region);
|
||||
}
|
||||
}
|
||||
XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
|
||||
|
||||
/* It's generally a good heuristic that when a crossing event is generated because
|
||||
* we reshape the overlay, we don't want it to affect focus-follows-mouse focus -
|
||||
* it's not the user doing something, it's the environment changing under the user.
|
||||
*/
|
||||
meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
|
||||
XFixesSetWindowShapeRegion (xdpy, info->output, ShapeInput, 0, 0, region);
|
||||
}
|
||||
}
|
||||
|
||||
@ -637,6 +561,9 @@ after_stage_paint (ClutterStage *stage,
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
meta_window_actor_post_paint (l->data);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
meta_wayland_compositor_paint_finished (meta_wayland_compositor_get_default ());
|
||||
}
|
||||
|
||||
static void
|
||||
@ -699,21 +626,6 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
return;
|
||||
|
||||
info = g_new0 (MetaCompScreen, 1);
|
||||
/*
|
||||
* We use an empty input region for Clutter as a default because that allows
|
||||
* the user to interact with all the windows displayed on the screen.
|
||||
* We have to initialize info->pending_input_region to an empty region explicitly,
|
||||
* because None value is used to mean that the whole screen is an input region.
|
||||
*/
|
||||
if (!meta_is_wayland_compositor ())
|
||||
info->pending_input_region = XFixesCreateRegion (xdisplay, NULL, 0);
|
||||
else
|
||||
{
|
||||
/* Stage input region trickery isn't needed when we're running as a
|
||||
* wayland compositor. */
|
||||
info->pending_input_region = None;
|
||||
}
|
||||
|
||||
info->screen = screen;
|
||||
|
||||
meta_screen_set_compositor_data (screen, info);
|
||||
@ -799,6 +711,8 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
info->output = get_output_window (screen);
|
||||
XReparentWindow (xdisplay, xwin, info->output, 0, 0);
|
||||
|
||||
meta_empty_stage_input_region (screen);
|
||||
|
||||
/* Make sure there isn't any left-over output shape on the
|
||||
* overlay window by setting the whole screen to be an
|
||||
* output region.
|
||||
@ -809,22 +723,15 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
*/
|
||||
XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
|
||||
|
||||
do_set_stage_input_region (screen, info->pending_input_region);
|
||||
if (info->pending_input_region != None)
|
||||
{
|
||||
XFixesDestroyRegion (xdisplay, info->pending_input_region);
|
||||
info->pending_input_region = None;
|
||||
}
|
||||
|
||||
info->plugin_mgr = meta_plugin_manager_new (screen);
|
||||
|
||||
/* Map overlay window before redirecting windows offscreen so we catch their
|
||||
* contents until we show the stage.
|
||||
*/
|
||||
XMapWindow (xdisplay, info->output);
|
||||
|
||||
redirect_windows (compositor, screen);
|
||||
}
|
||||
|
||||
redirect_windows (compositor, screen);
|
||||
|
||||
info->plugin_mgr = meta_plugin_manager_new (screen);
|
||||
}
|
||||
|
||||
void
|
||||
@ -885,19 +792,50 @@ meta_shape_cow_for_window (MetaScreen *screen,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_unredirected_window (MetaCompScreen *info,
|
||||
MetaWindow *window)
|
||||
{
|
||||
if (info->unredirected_window == window)
|
||||
return;
|
||||
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (info->unredirected_window));
|
||||
meta_window_actor_set_unredirected (window_actor, FALSE);
|
||||
}
|
||||
|
||||
info->unredirected_window = window;
|
||||
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (info->unredirected_window));
|
||||
meta_window_actor_set_unredirected (window_actor, TRUE);
|
||||
}
|
||||
|
||||
meta_shape_cow_for_window (info->screen, info->unredirected_window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_add_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaScreen *screen = meta_window_get_screen (window);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
g_return_if_fail (info != NULL);
|
||||
|
||||
/* Window was already added previously, probably coming
|
||||
* back from hiding */
|
||||
if (window->compositor_private != NULL)
|
||||
return;
|
||||
|
||||
DEBUG_TRACE ("meta_compositor_add_window\n");
|
||||
meta_error_trap_push (display);
|
||||
|
||||
add_win (window);
|
||||
|
||||
meta_window_actor_new (window);
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
sync_actor_stacking (info);
|
||||
}
|
||||
|
||||
void
|
||||
@ -913,19 +851,11 @@ meta_compositor_remove_window (MetaCompositor *compositor,
|
||||
if (!window_actor)
|
||||
return;
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
screen = meta_window_get_screen (window);
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
screen = meta_window_get_screen (window);
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (window_actor == info->unredirected_window)
|
||||
{
|
||||
meta_window_actor_set_redirected (window_actor, TRUE);
|
||||
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (info->unredirected_window)),
|
||||
NULL);
|
||||
info->unredirected_window = NULL;
|
||||
}
|
||||
}
|
||||
if (info->unredirected_window == window)
|
||||
set_unredirected_window (info, NULL);
|
||||
|
||||
meta_window_actor_destroy (window_actor);
|
||||
}
|
||||
@ -995,23 +925,30 @@ meta_compositor_window_shape_changed (MetaCompositor *compositor,
|
||||
meta_window_actor_update_shape (window_actor);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_window_opacity_changed (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaWindowActor *window_actor;
|
||||
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||
if (!window_actor)
|
||||
return;
|
||||
|
||||
meta_window_actor_update_opacity (window_actor);
|
||||
}
|
||||
|
||||
/* Clutter makes the assumption that there is only one X window
|
||||
* per stage, which is a valid assumption to make for a generic
|
||||
* application toolkit. As such, it will ignore any events sent
|
||||
* to the a stage that isn't its X window.
|
||||
*
|
||||
* When a user clicks on what she thinks is the wallpaper, she
|
||||
* is actually clicking on the guard window, which is an entirely
|
||||
* separate top-level override-redirect window in the hierarchy.
|
||||
* We want to recieve events on this guard window so that users
|
||||
* can right-click on the background actor. We do this by telling
|
||||
* Clutter a little white lie, by transforming clicks on the guard
|
||||
* window to become clicks on the stage window, allowing Clutter
|
||||
* to process the event normally.
|
||||
* When running as an X window manager, we need to respond to
|
||||
* events from lots of windows. Trick Clutter into translating
|
||||
* these events by pretending we got an event on the stage window.
|
||||
*/
|
||||
static void
|
||||
maybe_spoof_guard_window_event_as_stage_event (MetaCompScreen *info,
|
||||
XEvent *event)
|
||||
maybe_spoof_event_as_stage_event (MetaCompScreen *info,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (info->screen);
|
||||
|
||||
@ -1020,19 +957,22 @@ maybe_spoof_guard_window_event_as_stage_event (MetaCompScreen *info,
|
||||
{
|
||||
XIEvent *input_event = (XIEvent *) event->xcookie.data;
|
||||
|
||||
/* Only care about pointer events for now. */
|
||||
switch (input_event->evtype)
|
||||
{
|
||||
case XI_Motion:
|
||||
case XI_ButtonPress:
|
||||
case XI_ButtonRelease:
|
||||
case XI_KeyPress:
|
||||
case XI_KeyRelease:
|
||||
{
|
||||
XIDeviceEvent *device_event = ((XIDeviceEvent *) input_event);
|
||||
if (device_event->event == info->screen->guard_window)
|
||||
{
|
||||
Window xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
device_event->event = xwin;
|
||||
}
|
||||
|
||||
/* If this is a GTK+ widget, like a window menu, let GTK+ handle
|
||||
* it as-is without mangling. */
|
||||
if (meta_ui_window_is_widget (info->screen->ui, device_event->event))
|
||||
break;
|
||||
|
||||
device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1089,7 +1029,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
||||
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
maybe_spoof_guard_window_event_as_stage_event (info, event);
|
||||
maybe_spoof_event_as_stage_event (info, event);
|
||||
|
||||
if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
|
||||
{
|
||||
@ -1101,29 +1041,20 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
||||
}
|
||||
}
|
||||
|
||||
switch (event->type)
|
||||
if (!meta_is_wayland_compositor () &&
|
||||
event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
|
||||
{
|
||||
case PropertyNotify:
|
||||
process_property_notify (compositor, (XPropertyEvent *) event, window);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!meta_is_wayland_compositor () &&
|
||||
event->type == meta_display_get_damage_event_base (compositor->display) + XDamageNotify)
|
||||
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
|
||||
* ourselves
|
||||
*/
|
||||
if (window == NULL)
|
||||
{
|
||||
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
|
||||
* ourselves
|
||||
*/
|
||||
if (window == NULL)
|
||||
{
|
||||
Window xwin = ((XDamageNotifyEvent *) event)->drawable;
|
||||
window = meta_display_lookup_x_window (compositor->display, xwin);
|
||||
}
|
||||
|
||||
DEBUG_TRACE ("meta_compositor_process_event (process_damage)\n");
|
||||
process_damage (compositor, (XDamageNotifyEvent *) event, window);
|
||||
Window xwin = ((XDamageNotifyEvent *) event)->drawable;
|
||||
window = meta_display_lookup_x_window (compositor->display, xwin);
|
||||
}
|
||||
break;
|
||||
|
||||
DEBUG_TRACE ("meta_compositor_process_event (process_damage)\n");
|
||||
process_damage (compositor, (XDamageNotifyEvent *) event, window);
|
||||
}
|
||||
|
||||
/* Clutter needs to know about MapNotify events otherwise it will
|
||||
@ -1423,30 +1354,6 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
sync_actor_stacking (info);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_window_mapped (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||
DEBUG_TRACE ("meta_compositor_window_mapped\n");
|
||||
if (!window_actor)
|
||||
return;
|
||||
|
||||
meta_window_actor_mapped (window_actor);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_window_unmapped (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||
DEBUG_TRACE ("meta_compositor_window_unmapped\n");
|
||||
if (!window_actor)
|
||||
return;
|
||||
|
||||
meta_window_actor_unmapped (window_actor);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
@ -1554,7 +1461,6 @@ pre_paint_windows (MetaCompScreen *info)
|
||||
{
|
||||
GList *l;
|
||||
MetaWindowActor *top_window;
|
||||
MetaWindowActor *expected_unredirected_window = NULL;
|
||||
|
||||
if (info->onscreen == NULL)
|
||||
{
|
||||
@ -1568,33 +1474,13 @@ pre_paint_windows (MetaCompScreen *info)
|
||||
if (info->windows == NULL)
|
||||
return;
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
top_window = g_list_last (info->windows)->data;
|
||||
top_window = g_list_last (info->windows)->data;
|
||||
|
||||
if (meta_window_actor_should_unredirect (top_window) &&
|
||||
info->disable_unredirect_count == 0)
|
||||
expected_unredirected_window = top_window;
|
||||
|
||||
if (info->unredirected_window != expected_unredirected_window)
|
||||
{
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
meta_window_actor_set_redirected (info->unredirected_window, TRUE);
|
||||
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (info->unredirected_window)),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (expected_unredirected_window != NULL)
|
||||
{
|
||||
meta_shape_cow_for_window (meta_window_get_screen (meta_window_actor_get_meta_window (top_window)),
|
||||
meta_window_actor_get_meta_window (top_window));
|
||||
meta_window_actor_set_redirected (top_window, FALSE);
|
||||
}
|
||||
|
||||
info->unredirected_window = expected_unredirected_window;
|
||||
}
|
||||
}
|
||||
if (meta_window_actor_should_unredirect (top_window) &&
|
||||
info->disable_unredirect_count == 0)
|
||||
set_unredirected_window (info, meta_window_actor_get_meta_window (top_window));
|
||||
else
|
||||
set_unredirected_window (info, NULL);
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
meta_window_actor_pre_paint (l->data);
|
||||
@ -1648,13 +1534,7 @@ on_shadow_factory_changed (MetaShadowFactory *factory,
|
||||
MetaCompositor *
|
||||
meta_compositor_new (MetaDisplay *display)
|
||||
{
|
||||
char *atom_names[] = {
|
||||
"_XROOTPMAP_ID",
|
||||
"_NET_WM_WINDOW_OPACITY",
|
||||
};
|
||||
Atom atoms[G_N_ELEMENTS(atom_names)];
|
||||
MetaCompositor *compositor;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
if (!composite_at_least_version (display, 0, 3))
|
||||
return NULL;
|
||||
@ -1666,18 +1546,11 @@ meta_compositor_new (MetaDisplay *display)
|
||||
if (g_getenv("META_DISABLE_MIPMAPS"))
|
||||
compositor->no_mipmaps = TRUE;
|
||||
|
||||
meta_verbose ("Creating %d atoms\n", (int) G_N_ELEMENTS (atom_names));
|
||||
XInternAtoms (xdisplay, atom_names, G_N_ELEMENTS (atom_names),
|
||||
False, atoms);
|
||||
|
||||
g_signal_connect (meta_shadow_factory_get_default (),
|
||||
"changed",
|
||||
G_CALLBACK (on_shadow_factory_changed),
|
||||
compositor);
|
||||
|
||||
compositor->atom_x_root_pixmap = atoms[0];
|
||||
compositor->atom_net_wm_window_opacity = atoms[1];
|
||||
|
||||
compositor->repaint_func_id = clutter_threads_add_repaint_func (meta_repaint_func,
|
||||
compositor,
|
||||
NULL);
|
||||
|
@ -6,9 +6,6 @@
|
||||
#include <meta/screen.h>
|
||||
#include <meta/meta-background-actor.h>
|
||||
|
||||
void meta_background_actor_set_clip_region (MetaBackgroundActor *self,
|
||||
cairo_region_t *clip_region);
|
||||
|
||||
cairo_region_t *meta_background_actor_get_clip_region (MetaBackgroundActor *self);
|
||||
|
||||
#endif /* META_BACKGROUND_ACTOR_PRIVATE_H */
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Portions adapted from gnome-shell/src/shell-global.c
|
||||
*/
|
||||
@ -41,20 +39,35 @@
|
||||
#include <meta/errors.h>
|
||||
#include <meta/meta-background.h>
|
||||
#include "meta-background-actor-private.h"
|
||||
#include "meta-cullable.h"
|
||||
|
||||
struct _MetaBackgroundActorPrivate
|
||||
{
|
||||
cairo_region_t *clip_region;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR);
|
||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||
|
||||
static void
|
||||
set_clip_region (MetaBackgroundActor *self,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
MetaBackgroundActorPrivate *priv = self->priv;
|
||||
|
||||
g_clear_pointer (&priv->clip_region, (GDestroyNotify) cairo_region_destroy);
|
||||
if (clip_region)
|
||||
priv->clip_region = cairo_region_copy (clip_region);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_background_actor_dispose (GObject *object)
|
||||
{
|
||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
|
||||
|
||||
meta_background_actor_set_clip_region (self, NULL);
|
||||
set_clip_region (self, NULL);
|
||||
|
||||
G_OBJECT_CLASS (meta_background_actor_parent_class)->dispose (object);
|
||||
}
|
||||
@ -104,26 +117,6 @@ meta_background_actor_get_preferred_height (ClutterActor *actor,
|
||||
*natural_height_p = height;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_background_actor_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
ClutterContent *content;
|
||||
gfloat width, height;
|
||||
|
||||
content = clutter_actor_get_content (actor);
|
||||
|
||||
if (!content)
|
||||
return FALSE;
|
||||
|
||||
clutter_content_get_preferred_size (content, &width, &height);
|
||||
|
||||
clutter_paint_volume_set_width (volume, width);
|
||||
clutter_paint_volume_set_height (volume, height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_background_actor_class_init (MetaBackgroundActorClass *klass)
|
||||
{
|
||||
@ -136,7 +129,6 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
|
||||
|
||||
actor_class->get_preferred_width = meta_background_actor_get_preferred_width;
|
||||
actor_class->get_preferred_height = meta_background_actor_get_preferred_height;
|
||||
actor_class->get_paint_volume = meta_background_actor_get_paint_volume;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -166,31 +158,27 @@ meta_background_actor_new (void)
|
||||
return CLUTTER_ACTOR (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_background_actor_set_clip_region:
|
||||
* @self: a #MetaBackgroundActor
|
||||
* @clip_region: (allow-none): the area of the actor (in allocate-relative
|
||||
* coordinates) that is visible.
|
||||
*
|
||||
* Sets the area of the background that is unobscured by overlapping windows.
|
||||
* This is used to optimize and only paint the visible portions.
|
||||
*/
|
||||
void
|
||||
meta_background_actor_set_clip_region (MetaBackgroundActor *self,
|
||||
cairo_region_t *clip_region)
|
||||
static void
|
||||
meta_background_actor_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
MetaBackgroundActorPrivate *priv;
|
||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (cullable);
|
||||
set_clip_region (self, clip_region);
|
||||
}
|
||||
|
||||
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
|
||||
static void
|
||||
meta_background_actor_reset_culling (MetaCullable *cullable)
|
||||
{
|
||||
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (cullable);
|
||||
set_clip_region (self, NULL);
|
||||
}
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
g_clear_pointer (&priv->clip_region,
|
||||
(GDestroyNotify)
|
||||
cairo_region_destroy);
|
||||
|
||||
if (clip_region)
|
||||
priv->clip_region = cairo_region_copy (clip_region);
|
||||
static void
|
||||
cullable_iface_init (MetaCullableInterface *iface)
|
||||
{
|
||||
iface->cull_out = meta_background_actor_cull_out;
|
||||
iface->reset_culling = meta_background_actor_reset_culling;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,11 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
#ifndef META_BACKGROUND_GROUP_PRIVATE_H
|
||||
#define META_BACKGROUND_GROUP_PRIVATE_H
|
||||
|
||||
#include <meta/screen.h>
|
||||
#include <meta/meta-background-group.h>
|
||||
|
||||
void meta_background_group_set_clip_region (MetaBackgroundGroup *self,
|
||||
cairo_region_t *visible_region);
|
||||
#endif /* META_BACKGROUND_GROUP_PRIVATE_H */
|
@ -16,87 +16,43 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "compositor-private.h"
|
||||
#include "clutter-utils.h"
|
||||
#include "meta-background-actor-private.h"
|
||||
#include "meta-background-group-private.h"
|
||||
#include <meta/meta-background-group.h>
|
||||
#include "meta-cullable.h"
|
||||
|
||||
G_DEFINE_TYPE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR);
|
||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||
|
||||
struct _MetaBackgroundGroupPrivate
|
||||
{
|
||||
gpointer dummy;
|
||||
};
|
||||
|
||||
static void
|
||||
meta_background_group_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (meta_background_group_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_background_group_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return clutter_paint_volume_set_from_allocation (volume, actor);
|
||||
}
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||
|
||||
static void
|
||||
meta_background_group_class_init (MetaBackgroundGroupClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
}
|
||||
|
||||
actor_class->get_paint_volume = meta_background_group_get_paint_volume;
|
||||
object_class->dispose = meta_background_group_dispose;
|
||||
static void
|
||||
meta_background_group_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
|
||||
}
|
||||
|
||||
g_type_class_add_private (klass, sizeof (MetaBackgroundGroupPrivate));
|
||||
static void
|
||||
meta_background_group_reset_culling (MetaCullable *cullable)
|
||||
{
|
||||
meta_cullable_reset_culling_children (cullable);
|
||||
}
|
||||
|
||||
static void
|
||||
cullable_iface_init (MetaCullableInterface *iface)
|
||||
{
|
||||
iface->cull_out = meta_background_group_cull_out;
|
||||
iface->reset_culling = meta_background_group_reset_culling;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_background_group_init (MetaBackgroundGroup *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
META_TYPE_BACKGROUND_GROUP,
|
||||
MetaBackgroundGroupPrivate);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_background_group_set_clip_region:
|
||||
* @self: a #MetaBackgroundGroup
|
||||
* @region: (allow-none): the parts of the background to paint
|
||||
*
|
||||
* Sets the area of the backgrounds that is unobscured by overlapping windows.
|
||||
* This is used to optimize and only paint the visible portions.
|
||||
*/
|
||||
void
|
||||
meta_background_group_set_clip_region (MetaBackgroundGroup *self,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GList *children, *l;
|
||||
|
||||
children = clutter_actor_get_children (CLUTTER_ACTOR (self));
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
ClutterActor *actor = l->data;
|
||||
|
||||
if (META_IS_BACKGROUND_ACTOR (actor))
|
||||
{
|
||||
meta_background_actor_set_clip_region (META_BACKGROUND_ACTOR (actor), region);
|
||||
}
|
||||
else if (META_IS_BACKGROUND_GROUP (actor))
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (!meta_actor_is_untransformed (actor, &x, &y))
|
||||
continue;
|
||||
|
||||
cairo_region_translate (region, -x, -y);
|
||||
meta_background_group_set_clip_region (META_BACKGROUND_GROUP (actor), region);
|
||||
cairo_region_translate (region, x, y);
|
||||
}
|
||||
}
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
201
src/compositor/meta-cullable.c
Normal file
201
src/compositor/meta-cullable.c
Normal file
@ -0,0 +1,201 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Written by:
|
||||
* Owen Taylor <otaylor@redhat.com>
|
||||
* Ray Strode <rstrode@redhat.com>
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "meta-cullable.h"
|
||||
#include "clutter-utils.h"
|
||||
|
||||
G_DEFINE_INTERFACE (MetaCullable, meta_cullable, CLUTTER_TYPE_ACTOR);
|
||||
|
||||
/**
|
||||
* SECTION:meta-cullable
|
||||
* @title: MetaCullable
|
||||
* @short_description: CPU culling operations for efficient drawing
|
||||
*
|
||||
* When we are painting a stack of 5-10 large actors, the standard
|
||||
* bottom-to-top method of drawing every actor results in a tremendous
|
||||
* amount of overdraw. If these actors are painting textures like
|
||||
* windows, it can easily max out the available memory bandwidth on a
|
||||
* low-end graphics chipset. It's even worse if window textures are
|
||||
* being accessed over the AGP bus.
|
||||
*
|
||||
* #MetaCullable is our solution. The basic technique applied here is to
|
||||
* do a pre-pass before painting where we walk each actor from top to bottom
|
||||
* and ask each actor to "cull itself out". We pass in a region it can copy
|
||||
* to clip its drawing to, and the actor can subtract its fully opaque pixels
|
||||
* so that actors underneath know not to draw there as well.
|
||||
*/
|
||||
|
||||
/**
|
||||
* meta_cullable_cull_out_children:
|
||||
* @cullable: The #MetaCullable
|
||||
* @unobscured_region: The unobscured region, as passed into cull_out()
|
||||
* @clip_region: The clip region, as passed into cull_out()
|
||||
*
|
||||
* This is a helper method for actors that want to recurse over their
|
||||
* child actors, and cull them out.
|
||||
*
|
||||
* See #MetaCullable and meta_cullable_cull_out() for more details.
|
||||
*/
|
||||
void
|
||||
meta_cullable_cull_out_children (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (cullable);
|
||||
ClutterActor *child;
|
||||
ClutterActorIter iter;
|
||||
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_prev (&iter, &child))
|
||||
{
|
||||
float x, y;
|
||||
gboolean needs_culling;
|
||||
|
||||
if (!META_IS_CULLABLE (child))
|
||||
continue;
|
||||
|
||||
needs_culling = (unobscured_region != NULL && clip_region != NULL);
|
||||
|
||||
if (needs_culling && !CLUTTER_ACTOR_IS_VISIBLE (child))
|
||||
needs_culling = FALSE;
|
||||
|
||||
/* If an actor has effects applied, then that can change the area
|
||||
* it paints and the opacity, so we no longer can figure out what
|
||||
* portion of the actor is obscured and what portion of the screen
|
||||
* it obscures, so we skip the actor.
|
||||
*
|
||||
* This has a secondary beneficial effect: if a ClutterOffscreenEffect
|
||||
* is applied to an actor, then our clipped redraws interfere with the
|
||||
* caching of the FBO - even if we only need to draw a small portion
|
||||
* of the window right now, ClutterOffscreenEffect may use other portions
|
||||
* of the FBO later. So, skipping actors with effects applied also
|
||||
* prevents these bugs.
|
||||
*
|
||||
* Theoretically, we should check clutter_actor_get_offscreen_redirect()
|
||||
* as well for the same reason, but omitted for simplicity in the
|
||||
* hopes that no-one will do that.
|
||||
*/
|
||||
if (needs_culling && clutter_actor_has_effects (child))
|
||||
needs_culling = FALSE;
|
||||
|
||||
if (needs_culling && !meta_actor_is_untransformed (child, NULL, NULL))
|
||||
needs_culling = FALSE;
|
||||
|
||||
if (needs_culling)
|
||||
{
|
||||
clutter_actor_get_position (child, &x, &y);
|
||||
|
||||
/* Temporarily move to the coordinate system of the actor */
|
||||
cairo_region_translate (unobscured_region, - x, - y);
|
||||
cairo_region_translate (clip_region, - x, - y);
|
||||
|
||||
meta_cullable_cull_out (META_CULLABLE (child), unobscured_region, clip_region);
|
||||
|
||||
cairo_region_translate (unobscured_region, x, y);
|
||||
cairo_region_translate (clip_region, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_cullable_cull_out (META_CULLABLE (child), NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_cullable_reset_culling_children:
|
||||
* @cullable: The #MetaCullable
|
||||
*
|
||||
* This is a helper method for actors that want to recurse over their
|
||||
* child actors, and cull them out.
|
||||
*
|
||||
* See #MetaCullable and meta_cullable_reset_culling() for more details.
|
||||
*/
|
||||
void
|
||||
meta_cullable_reset_culling_children (MetaCullable *cullable)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (cullable);
|
||||
ClutterActor *child;
|
||||
ClutterActorIter iter;
|
||||
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
if (!META_IS_CULLABLE (child))
|
||||
continue;
|
||||
|
||||
meta_cullable_reset_culling (META_CULLABLE (child));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_cullable_default_init (MetaCullableInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_cullable_cull_out:
|
||||
* @cullable: The #MetaCullable
|
||||
* @unobscured_region: The unobscured region, in @cullable's space.
|
||||
* @clip_region: The clip region, in @cullable's space.
|
||||
*
|
||||
* When #MetaWindowGroup is painted, we walk over its direct cullable
|
||||
* children from top to bottom and ask themselves to "cull out". Cullables
|
||||
* can use @unobscured_region and @clip_region to clip their drawing. Actors
|
||||
* interested in eliminating overdraw should copy the @clip_region and only
|
||||
* paint those parts, as everything else has been obscured by actors above it.
|
||||
*
|
||||
* Actors that may have fully opaque parts should also subtract out a region
|
||||
* that is fully opaque from @unobscured_region and @clip_region.
|
||||
*
|
||||
* @unobscured_region and @clip_region are extremely similar. The difference
|
||||
* is that @clip_region starts off with the stage's clip, if Clutter detects
|
||||
* that we're doing a clipped redraw. @unobscured_region, however, starts off
|
||||
* with the full stage size, so actors that may want to record what parts of
|
||||
* their window are unobscured for e.g. scheduling repaints can do so.
|
||||
*
|
||||
* Actors that have children can also use the meta_cullable_cull_out_children()
|
||||
* helper method to do a simple cull across all their children.
|
||||
*/
|
||||
void
|
||||
meta_cullable_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region, clip_region);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_cullable_reset_culling:
|
||||
* @cullable: The #MetaCullable
|
||||
*
|
||||
* Actors that copied data in their cull_out() implementation can now
|
||||
* reset their data, as the paint is now over. Additional paints may be
|
||||
* done by #ClutterClone or similar, and they should not be affected by
|
||||
* the culling operation.
|
||||
*/
|
||||
void
|
||||
meta_cullable_reset_culling (MetaCullable *cullable)
|
||||
{
|
||||
META_CULLABLE_GET_IFACE (cullable)->reset_culling (cullable);
|
||||
}
|
66
src/compositor/meta-cullable.h
Normal file
66
src/compositor/meta-cullable.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Written by:
|
||||
* Owen Taylor <otaylor@redhat.com>
|
||||
* Ray Strode <rstrode@redhat.com>
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#ifndef __META_CULLABLE_H__
|
||||
#define __META_CULLABLE_H__
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define META_TYPE_CULLABLE (meta_cullable_get_type ())
|
||||
#define META_CULLABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_CULLABLE, MetaCullable))
|
||||
#define META_IS_CULLABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_CULLABLE))
|
||||
#define META_CULLABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), META_TYPE_CULLABLE, MetaCullableInterface))
|
||||
|
||||
typedef struct _MetaCullable MetaCullable;
|
||||
typedef struct _MetaCullableInterface MetaCullableInterface;
|
||||
|
||||
struct _MetaCullableInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void (* cull_out) (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region);
|
||||
void (* reset_culling) (MetaCullable *cullable);
|
||||
};
|
||||
|
||||
GType meta_cullable_get_type (void);
|
||||
|
||||
void meta_cullable_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region);
|
||||
void meta_cullable_reset_culling (MetaCullable *cullable);
|
||||
|
||||
/* Utility methods for implementations */
|
||||
void meta_cullable_cull_out_children (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region);
|
||||
void meta_cullable_reset_culling_children (MetaCullable *cullable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __META_CULLABLE_H__ */
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <meta/meta-plugin.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_MODULE_H_
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_PLUGIN_MANAGER_H_
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_SHADOW_FACTORY_PRIVATE_H__
|
||||
|
@ -13,9 +13,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -32,5 +32,8 @@
|
||||
ClutterActor *meta_shaped_texture_new (void);
|
||||
void meta_shaped_texture_set_texture (MetaShapedTexture *stex,
|
||||
CoglTexture *texture);
|
||||
gboolean meta_shaped_texture_get_unobscured_bounds (MetaShapedTexture *stex,
|
||||
cairo_rectangle_int_t *unobscured_bounds);
|
||||
gboolean meta_shaped_texture_is_obscured (MetaShapedTexture *self);
|
||||
|
||||
#endif
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -39,12 +37,11 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include <cogl/cogl.h>
|
||||
#include <gdk/gdk.h> /* for gdk_rectangle_intersect() */
|
||||
#include "meta-cullable.h"
|
||||
|
||||
static void meta_shaped_texture_dispose (GObject *object);
|
||||
|
||||
static void meta_shaped_texture_paint (ClutterActor *actor);
|
||||
static void meta_shaped_texture_pick (ClutterActor *actor,
|
||||
const ClutterColor *color);
|
||||
|
||||
static void meta_shaped_texture_get_preferred_width (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
@ -58,7 +55,10 @@ static void meta_shaped_texture_get_preferred_height (ClutterActor *self,
|
||||
|
||||
static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, ClutterPaintVolume *volume);
|
||||
|
||||
G_DEFINE_TYPE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR);
|
||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||
|
||||
#define META_SHAPED_TEXTURE_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \
|
||||
@ -71,10 +71,13 @@ struct _MetaShapedTexturePrivate
|
||||
CoglTexture *texture;
|
||||
CoglTexture *mask_texture;
|
||||
|
||||
cairo_region_t *clip_region;
|
||||
cairo_region_t *input_shape_region;
|
||||
/* The region containing only fully opaque pixels */
|
||||
cairo_region_t *opaque_region;
|
||||
|
||||
/* MetaCullable regions, see that documentation for more details */
|
||||
cairo_region_t *clip_region;
|
||||
cairo_region_t *unobscured_region;
|
||||
|
||||
guint tex_width, tex_height;
|
||||
|
||||
guint create_mipmaps : 1;
|
||||
@ -91,7 +94,6 @@ meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
|
||||
actor_class->get_preferred_width = meta_shaped_texture_get_preferred_width;
|
||||
actor_class->get_preferred_height = meta_shaped_texture_get_preferred_height;
|
||||
actor_class->paint = meta_shaped_texture_paint;
|
||||
actor_class->pick = meta_shaped_texture_pick;
|
||||
actor_class->get_paint_volume = meta_shaped_texture_get_paint_volume;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (MetaShapedTexturePrivate));
|
||||
@ -111,6 +113,32 @@ meta_shaped_texture_init (MetaShapedTexture *self)
|
||||
priv->create_mipmaps = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
set_unobscured_region (MetaShapedTexture *self,
|
||||
cairo_region_t *unobscured_region)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv = self->priv;
|
||||
|
||||
g_clear_pointer (&priv->unobscured_region, (GDestroyNotify) cairo_region_destroy);
|
||||
if (unobscured_region)
|
||||
{
|
||||
cairo_rectangle_int_t bounds = { 0, 0, priv->tex_width, priv->tex_height };
|
||||
priv->unobscured_region = cairo_region_copy (unobscured_region);
|
||||
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_clip_region (MetaShapedTexture *self,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv = self->priv;
|
||||
|
||||
g_clear_pointer (&priv->clip_region, (GDestroyNotify) cairo_region_destroy);
|
||||
if (clip_region)
|
||||
priv->clip_region = cairo_region_copy (clip_region);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_shaped_texture_dispose (GObject *object)
|
||||
{
|
||||
@ -125,7 +153,8 @@ meta_shaped_texture_dispose (GObject *object)
|
||||
g_clear_pointer (&priv->opaque_region, cairo_region_destroy);
|
||||
|
||||
meta_shaped_texture_set_mask_texture (self, NULL);
|
||||
meta_shaped_texture_set_clip_region (self, NULL);
|
||||
set_unobscured_region (self, NULL);
|
||||
set_clip_region (self, NULL);
|
||||
|
||||
G_OBJECT_CLASS (meta_shaped_texture_parent_class)->dispose (object);
|
||||
}
|
||||
@ -212,10 +241,11 @@ set_cogl_texture (MetaShapedTexture *stex,
|
||||
if (priv->texture)
|
||||
cogl_object_unref (priv->texture);
|
||||
|
||||
priv->texture = cogl_object_ref (cogl_tex);
|
||||
priv->texture = cogl_tex;
|
||||
|
||||
if (cogl_tex != NULL)
|
||||
{
|
||||
cogl_object_ref (cogl_tex);
|
||||
width = cogl_texture_get_width (COGL_TEXTURE (cogl_tex));
|
||||
height = cogl_texture_get_height (COGL_TEXTURE (cogl_tex));
|
||||
|
||||
@ -301,15 +331,8 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
||||
|
||||
filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||
|
||||
if (!clutter_actor_is_in_clone_paint (actor))
|
||||
{
|
||||
int x_origin, y_origin;
|
||||
|
||||
if (meta_actor_is_untransformed (actor,
|
||||
&x_origin,
|
||||
&y_origin))
|
||||
filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||
}
|
||||
if (!clutter_actor_is_in_clone_paint (actor) && meta_actor_is_untransformed (actor, NULL, NULL))
|
||||
filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||
|
||||
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
@ -435,71 +458,6 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
||||
cairo_region_destroy (blended_region);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_shaped_texture_pick (ClutterActor *actor,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
MetaShapedTexture *stex = (MetaShapedTexture *) actor;
|
||||
MetaShapedTexturePrivate *priv = stex->priv;
|
||||
|
||||
if (!clutter_actor_should_pick_paint (actor) ||
|
||||
(priv->clip_region && cairo_region_is_empty (priv->clip_region)))
|
||||
return;
|
||||
|
||||
/* If there is no region then use the regular pick */
|
||||
if (priv->input_shape_region == NULL)
|
||||
CLUTTER_ACTOR_CLASS (meta_shaped_texture_parent_class)->pick (actor, color);
|
||||
else
|
||||
{
|
||||
int n_rects;
|
||||
float *rectangles;
|
||||
int i;
|
||||
CoglPipeline *pipeline;
|
||||
CoglContext *ctx;
|
||||
CoglFramebuffer *fb;
|
||||
CoglColor cogl_color;
|
||||
|
||||
/* Note: We don't bother trying to intersect the pick and clip regions
|
||||
* since needing to copy the region, do the intersection, and probably
|
||||
* increase the number of rectangles seems more likely to have a negative
|
||||
* effect.
|
||||
*
|
||||
* NB: Most of the time when just using rectangles for picking then
|
||||
* picking shouldn't involve any rendering, and minimizing the number of
|
||||
* rectangles has more benefit than reducing the area of the pick
|
||||
* region.
|
||||
*/
|
||||
|
||||
n_rects = cairo_region_num_rectangles (priv->input_shape_region);
|
||||
rectangles = g_alloca (sizeof (float) * 4 * n_rects);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
int pos = i * 4;
|
||||
|
||||
cairo_region_get_rectangle (priv->input_shape_region, i, &rect);
|
||||
|
||||
rectangles[pos] = rect.x;
|
||||
rectangles[pos + 1] = rect.y;
|
||||
rectangles[pos + 2] = rect.x + rect.width;
|
||||
rectangles[pos + 3] = rect.y + rect.height;
|
||||
}
|
||||
|
||||
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color, color->red, color->green, color->blue, color->alpha);
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_color (pipeline, &cogl_color);
|
||||
|
||||
cogl_framebuffer_draw_rectangles (fb, pipeline,
|
||||
rectangles, n_rects);
|
||||
cogl_object_unref (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_shaped_texture_get_preferred_width (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
@ -539,10 +497,37 @@ meta_shaped_texture_get_preferred_height (ClutterActor *self,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_shaped_texture_get_paint_volume (ClutterActor *self,
|
||||
meta_shaped_texture_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return clutter_paint_volume_set_from_allocation (volume, self);
|
||||
MetaShapedTexture *self = META_SHAPED_TEXTURE (actor);
|
||||
cairo_rectangle_int_t unobscured_bounds;
|
||||
|
||||
if (!clutter_paint_volume_set_from_allocation (volume, actor))
|
||||
return FALSE;
|
||||
|
||||
if (meta_shaped_texture_get_unobscured_bounds (self, &unobscured_bounds))
|
||||
{
|
||||
ClutterVertex origin;
|
||||
cairo_rectangle_int_t bounds;
|
||||
|
||||
/* I hate ClutterPaintVolume so much... */
|
||||
clutter_paint_volume_get_origin (volume, &origin);
|
||||
bounds.x = origin.x;
|
||||
bounds.y = origin.y;
|
||||
bounds.width = clutter_paint_volume_get_width (volume);
|
||||
bounds.height = clutter_paint_volume_get_height (volume);
|
||||
|
||||
gdk_rectangle_intersect (&bounds, &unobscured_bounds, &bounds);
|
||||
|
||||
origin.x = bounds.x;
|
||||
origin.y = bounds.y;
|
||||
clutter_paint_volume_set_origin (volume, &origin);
|
||||
clutter_paint_volume_set_width (volume, bounds.width);
|
||||
clutter_paint_volume_set_height (volume, bounds.height);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -587,50 +572,38 @@ meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_clip (MetaShapedTexture *stex,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
cairo_rectangle_int_t *clip)
|
||||
static cairo_region_t *
|
||||
effective_unobscured_region (MetaShapedTexture *self)
|
||||
{
|
||||
ClutterActor *self = CLUTTER_ACTOR (stex);
|
||||
MetaShapedTexturePrivate *priv;
|
||||
ClutterActorBox allocation;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
MetaShapedTexturePrivate *priv = self->priv;
|
||||
|
||||
/* NB: clutter_actor_queue_redraw_with_clip expects a box in the actor's
|
||||
* coordinate space so we need to convert from surface coordinates to
|
||||
* actor coordinates...
|
||||
*/
|
||||
return clutter_actor_has_mapped_clones (CLUTTER_ACTOR (self)) ? NULL : priv->unobscured_region;
|
||||
}
|
||||
|
||||
/* Calling clutter_actor_get_allocation_box() is enormously expensive
|
||||
* if the actor has an out-of-date allocation, since it triggers
|
||||
* a full redraw. clutter_actor_queue_redraw_with_clip() would redraw
|
||||
* the whole stage anyways in that case, so just go ahead and do
|
||||
* it here.
|
||||
*/
|
||||
if (!clutter_actor_has_allocation (self))
|
||||
gboolean
|
||||
meta_shaped_texture_get_unobscured_bounds (MetaShapedTexture *self,
|
||||
cairo_rectangle_int_t *unobscured_bounds)
|
||||
{
|
||||
cairo_region_t *unobscured_region = effective_unobscured_region (self);
|
||||
|
||||
if (unobscured_region)
|
||||
{
|
||||
cairo_region_get_extents (unobscured_region, unobscured_bounds);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv = stex->priv;
|
||||
gboolean
|
||||
meta_shaped_texture_is_obscured (MetaShapedTexture *self)
|
||||
{
|
||||
cairo_region_t *unobscured_region = effective_unobscured_region (self);
|
||||
|
||||
if (priv->tex_width == 0 || priv->tex_height == 0)
|
||||
if (unobscured_region)
|
||||
return cairo_region_is_empty (unobscured_region);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
clutter_actor_get_allocation_box (self, &allocation);
|
||||
|
||||
scale_x = (allocation.x2 - allocation.x1) / priv->tex_width;
|
||||
scale_y = (allocation.y2 - allocation.y1) / priv->tex_height;
|
||||
|
||||
clip->x = x * scale_x;
|
||||
clip->y = y * scale_y;
|
||||
clip->width = width * scale_x;
|
||||
clip->height = height * scale_y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -640,14 +613,9 @@ get_clip (MetaShapedTexture *stex,
|
||||
* @y: the y coordinate of the damaged area
|
||||
* @width: the width of the damaged area
|
||||
* @height: the height of the damaged area
|
||||
* @unobscured_region: The unobscured region of the window or %NULL if
|
||||
* there is no valid one (like when the actor is transformed or
|
||||
* has a mapped clone)
|
||||
*
|
||||
* Repairs the damaged area indicated by @x, @y, @width and @height
|
||||
* and queues a redraw for the intersection @unobscured_region and
|
||||
* the damage area. If @unobscured_region is %NULL a redraw will always
|
||||
* get queued.
|
||||
* and potentially queues a redraw.
|
||||
*
|
||||
* Return value: Whether a redraw have been queued or not
|
||||
*/
|
||||
@ -656,12 +624,11 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
cairo_region_t *unobscured_region)
|
||||
int height)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
cairo_rectangle_int_t clip;
|
||||
gboolean has_clip;
|
||||
cairo_region_t *unobscured_region;
|
||||
const cairo_rectangle_int_t clip = { x, y, width, height };
|
||||
|
||||
priv = stex->priv;
|
||||
|
||||
@ -670,8 +637,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
|
||||
meta_texture_tower_update_area (priv->paint_tower, x, y, width, height);
|
||||
|
||||
has_clip = get_clip (stex, x, y, width, height, &clip);
|
||||
|
||||
unobscured_region = effective_unobscured_region (stex);
|
||||
if (unobscured_region)
|
||||
{
|
||||
cairo_region_t *intersection;
|
||||
@ -680,8 +646,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
return FALSE;
|
||||
|
||||
intersection = cairo_region_copy (unobscured_region);
|
||||
if (has_clip)
|
||||
cairo_region_intersect_rectangle (intersection, &clip);
|
||||
cairo_region_intersect_rectangle (intersection, &clip);
|
||||
|
||||
if (!cairo_region_is_empty (intersection))
|
||||
{
|
||||
@ -689,21 +654,17 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
cairo_region_get_extents (intersection, &damage_rect);
|
||||
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &damage_rect);
|
||||
cairo_region_destroy (intersection);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cairo_region_destroy (intersection);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (has_clip)
|
||||
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &clip);
|
||||
else
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
||||
|
||||
return TRUE;
|
||||
{
|
||||
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &clip);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -733,74 +694,6 @@ meta_shaped_texture_get_texture (MetaShapedTexture *stex)
|
||||
return COGL_TEXTURE (stex->priv->texture);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_shaped_texture_set_input_shape_region:
|
||||
* @stex: a #MetaShapedTexture
|
||||
* @shape_region: the region of the texture that should respond to
|
||||
* input.
|
||||
*
|
||||
* Determines what region of the texture should accept input. For
|
||||
* X based windows this is defined by the ShapeInput region of the
|
||||
* window.
|
||||
*/
|
||||
void
|
||||
meta_shaped_texture_set_input_shape_region (MetaShapedTexture *stex,
|
||||
cairo_region_t *shape_region)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
|
||||
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
||||
|
||||
priv = stex->priv;
|
||||
|
||||
if (priv->input_shape_region != NULL)
|
||||
{
|
||||
cairo_region_destroy (priv->input_shape_region);
|
||||
priv->input_shape_region = NULL;
|
||||
}
|
||||
|
||||
if (shape_region != NULL)
|
||||
{
|
||||
cairo_region_reference (shape_region);
|
||||
priv->input_shape_region = shape_region;
|
||||
}
|
||||
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_shaped_texture_set_clip_region:
|
||||
* @stex: a #MetaShapedTexture
|
||||
* @clip_region: the region of the texture that is visible and
|
||||
* should be painted.
|
||||
*
|
||||
* Provides a hint to the texture about what areas of the texture
|
||||
* are not completely obscured and thus need to be painted. This
|
||||
* is an optimization and is not supposed to have any effect on
|
||||
* the output.
|
||||
*
|
||||
* Typically a parent container will set the clip region before
|
||||
* painting its children, and then unset it afterwards.
|
||||
*/
|
||||
void
|
||||
meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
|
||||
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
|
||||
|
||||
priv = stex->priv;
|
||||
|
||||
if (priv->clip_region)
|
||||
cairo_region_destroy (priv->clip_region);
|
||||
|
||||
if (clip_region)
|
||||
priv->clip_region = cairo_region_copy (clip_region);
|
||||
else
|
||||
priv->clip_region = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_shaped_texture_set_opaque_region:
|
||||
* @stex: a #MetaShapedTexture
|
||||
@ -929,6 +822,43 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
|
||||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_shaped_texture_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
MetaShapedTexture *self = META_SHAPED_TEXTURE (cullable);
|
||||
MetaShapedTexturePrivate *priv = self->priv;
|
||||
|
||||
set_unobscured_region (self, unobscured_region);
|
||||
set_clip_region (self, clip_region);
|
||||
|
||||
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self)) == 0xff)
|
||||
{
|
||||
if (priv->opaque_region)
|
||||
{
|
||||
if (unobscured_region)
|
||||
cairo_region_subtract (unobscured_region, priv->opaque_region);
|
||||
if (clip_region)
|
||||
cairo_region_subtract (clip_region, priv->opaque_region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_shaped_texture_reset_culling (MetaCullable *cullable)
|
||||
{
|
||||
MetaShapedTexture *self = META_SHAPED_TEXTURE (cullable);
|
||||
set_clip_region (self, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
cullable_iface_init (MetaCullableInterface *iface)
|
||||
{
|
||||
iface->cull_out = meta_shaped_texture_cull_out;
|
||||
iface->reset_culling = meta_shaped_texture_reset_culling;
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
meta_shaped_texture_new (void)
|
||||
{
|
||||
|
153
src/compositor/meta-surface-actor-wayland.c
Normal file
153
src/compositor/meta-surface-actor-wayland.c
Normal file
@ -0,0 +1,153 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by:
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "meta-surface-actor-wayland.h"
|
||||
|
||||
#include <cogl/cogl-wayland-server.h>
|
||||
#include "meta-shaped-texture-private.h"
|
||||
|
||||
struct _MetaSurfaceActorWaylandPrivate
|
||||
{
|
||||
MetaWaylandSurface *surface;
|
||||
MetaWaylandBuffer *buffer;
|
||||
};
|
||||
typedef struct _MetaSurfaceActorWaylandPrivate MetaSurfaceActorWaylandPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorWayland, meta_surface_actor_wayland, META_TYPE_SURFACE_ACTOR)
|
||||
|
||||
static void
|
||||
meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
|
||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
||||
|
||||
struct wl_resource *resource = priv->buffer->resource;
|
||||
struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get (resource);
|
||||
|
||||
if (shm_buffer)
|
||||
{
|
||||
CoglTexture2D *texture = COGL_TEXTURE_2D (priv->buffer->texture);
|
||||
cogl_wayland_texture_set_region_from_shm_buffer (texture, x, y, width, height, shm_buffer, x, y, 0, NULL);
|
||||
}
|
||||
|
||||
meta_surface_actor_update_area (META_SURFACE_ACTOR (self), x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_wayland_pre_paint (MetaSurfaceActor *actor)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_wayland_is_argb32 (MetaSurfaceActor *actor)
|
||||
{
|
||||
/* XXX -- look at the SHM buffer format. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_wayland_is_visible (MetaSurfaceActor *actor)
|
||||
{
|
||||
/* TODO: ensure that the buffer isn't NULL, implement
|
||||
* wayland mapping semantics */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_wayland_should_unredirect (MetaSurfaceActor *actor)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_wayland_set_unredirected (MetaSurfaceActor *actor,
|
||||
gboolean unredirected)
|
||||
{
|
||||
/* Do nothing. In the future, we'll use KMS to set this
|
||||
* up as a hardware overlay or something. */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
|
||||
{
|
||||
MetaSurfaceActorClass *surface_actor_class = META_SURFACE_ACTOR_CLASS (klass);
|
||||
|
||||
surface_actor_class->process_damage = meta_surface_actor_wayland_process_damage;
|
||||
surface_actor_class->pre_paint = meta_surface_actor_wayland_pre_paint;
|
||||
surface_actor_class->is_argb32 = meta_surface_actor_wayland_is_argb32;
|
||||
surface_actor_class->is_visible = meta_surface_actor_wayland_is_visible;
|
||||
|
||||
surface_actor_class->should_unredirect = meta_surface_actor_wayland_should_unredirect;
|
||||
surface_actor_class->set_unredirected = meta_surface_actor_wayland_set_unredirected;
|
||||
surface_actor_class->is_unredirected = meta_surface_actor_wayland_is_unredirected;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_wayland_init (MetaSurfaceActorWayland *self)
|
||||
{
|
||||
}
|
||||
|
||||
MetaSurfaceActor *
|
||||
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL);
|
||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
||||
|
||||
g_assert (meta_is_wayland_compositor ());
|
||||
|
||||
priv->surface = surface;
|
||||
|
||||
return META_SURFACE_ACTOR (self);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_wayland_set_buffer (MetaSurfaceActorWayland *self,
|
||||
MetaWaylandBuffer *buffer)
|
||||
{
|
||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
||||
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||
|
||||
priv->buffer = buffer;
|
||||
|
||||
if (buffer)
|
||||
meta_shaped_texture_set_texture (stex, buffer->texture);
|
||||
else
|
||||
meta_shaped_texture_set_texture (stex, NULL);
|
||||
}
|
||||
|
||||
MetaWaylandSurface *
|
||||
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
|
||||
{
|
||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
||||
return priv->surface;
|
||||
}
|
66
src/compositor/meta-surface-actor-wayland.h
Normal file
66
src/compositor/meta-surface-actor-wayland.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by:
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#ifndef __META_SURFACE_ACTOR_WAYLAND_H__
|
||||
#define __META_SURFACE_ACTOR_WAYLAND_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "meta-surface-actor.h"
|
||||
|
||||
#include "meta-wayland-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define META_TYPE_SURFACE_ACTOR_WAYLAND (meta_surface_actor_wayland_get_type ())
|
||||
#define META_SURFACE_ACTOR_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWayland))
|
||||
#define META_SURFACE_ACTOR_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWaylandClass))
|
||||
#define META_IS_SURFACE_ACTOR_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND))
|
||||
#define META_IS_SURFACE_ACTOR_WAYLAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR_WAYLAND))
|
||||
#define META_SURFACE_ACTOR_WAYLAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SURFACE_ACTOR_WAYLAND, MetaSurfaceActorWaylandClass))
|
||||
|
||||
typedef struct _MetaSurfaceActorWayland MetaSurfaceActorWayland;
|
||||
typedef struct _MetaSurfaceActorWaylandClass MetaSurfaceActorWaylandClass;
|
||||
|
||||
struct _MetaSurfaceActorWayland
|
||||
{
|
||||
MetaSurfaceActor parent;
|
||||
};
|
||||
|
||||
struct _MetaSurfaceActorWaylandClass
|
||||
{
|
||||
MetaSurfaceActorClass parent_class;
|
||||
};
|
||||
|
||||
GType meta_surface_actor_wayland_get_type (void);
|
||||
|
||||
MetaSurfaceActor * meta_surface_actor_wayland_new (MetaWaylandSurface *surface);
|
||||
MetaWaylandSurface * meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self);
|
||||
|
||||
void meta_surface_actor_wayland_set_buffer (MetaSurfaceActorWayland *self,
|
||||
MetaWaylandBuffer *buffer);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __META_SURFACE_ACTOR_WAYLAND_H__ */
|
453
src/compositor/meta-surface-actor-x11.c
Normal file
453
src/compositor/meta-surface-actor-x11.c
Normal file
@ -0,0 +1,453 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by:
|
||||
* Owen Taylor <otaylor@redhat.com>
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "meta-surface-actor-x11.h"
|
||||
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#include <cogl/cogl-texture-pixmap-x11.h>
|
||||
|
||||
#include <meta/errors.h>
|
||||
#include "window-private.h"
|
||||
#include "meta-shaped-texture-private.h"
|
||||
#include "meta-cullable.h"
|
||||
|
||||
struct _MetaSurfaceActorX11Private
|
||||
{
|
||||
MetaWindow *window;
|
||||
|
||||
MetaDisplay *display;
|
||||
|
||||
CoglTexture *texture;
|
||||
Pixmap pixmap;
|
||||
Damage damage;
|
||||
|
||||
int last_width;
|
||||
int last_height;
|
||||
|
||||
/* This is used to detect fullscreen windows that need to be unredirected */
|
||||
guint full_damage_frames_count;
|
||||
guint does_full_damage : 1;
|
||||
|
||||
/* Other state... */
|
||||
guint argb32 : 1;
|
||||
guint received_damage : 1;
|
||||
guint size_changed : 1;
|
||||
|
||||
guint unredirected : 1;
|
||||
};
|
||||
typedef struct _MetaSurfaceActorX11Private MetaSurfaceActorX11Private;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorX11, meta_surface_actor_x11, META_TYPE_SURFACE_ACTOR)
|
||||
|
||||
static void
|
||||
free_damage (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = priv->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
if (priv->damage == None)
|
||||
return;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
XDamageDestroy (xdisplay, priv->damage);
|
||||
priv->damage = None;
|
||||
meta_error_trap_pop (display);
|
||||
}
|
||||
|
||||
static void
|
||||
detach_pixmap (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = priv->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||
|
||||
if (priv->pixmap == None)
|
||||
return;
|
||||
|
||||
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
|
||||
* you are supposed to be able to free a GLXPixmap after freeing the underlying
|
||||
* pixmap, but it certainly doesn't work with current DRI/Mesa
|
||||
*/
|
||||
meta_shaped_texture_set_texture (stex, NULL);
|
||||
cogl_flush ();
|
||||
|
||||
meta_error_trap_push (display);
|
||||
XFreePixmap (xdisplay, priv->pixmap);
|
||||
priv->pixmap = None;
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
cogl_object_unref (priv->texture);
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
set_pixmap (MetaSurfaceActorX11 *self,
|
||||
Pixmap pixmap)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
|
||||
CoglTexture *texture;
|
||||
|
||||
g_assert (priv->pixmap == None);
|
||||
priv->pixmap = pixmap;
|
||||
|
||||
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE, NULL));
|
||||
|
||||
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
|
||||
g_warning ("NOTE: Not using GLX TFP!\n");
|
||||
|
||||
priv->texture = texture;
|
||||
meta_shaped_texture_set_texture (stex, texture);
|
||||
}
|
||||
|
||||
static void
|
||||
update_pixmap (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = priv->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
if (priv->size_changed)
|
||||
{
|
||||
detach_pixmap (self);
|
||||
priv->size_changed = FALSE;
|
||||
}
|
||||
|
||||
if (priv->pixmap == None)
|
||||
{
|
||||
Pixmap new_pixmap;
|
||||
Window xwindow = meta_window_get_toplevel_xwindow (priv->window);
|
||||
|
||||
meta_error_trap_push (display);
|
||||
new_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
|
||||
|
||||
if (meta_error_trap_pop_with_return (display) != Success)
|
||||
{
|
||||
/* Probably a BadMatch if the window isn't viewable; we could
|
||||
* GrabServer/GetWindowAttributes/NameWindowPixmap/UngrabServer/Sync
|
||||
* to avoid this, but there's no reason to take two round trips
|
||||
* when one will do. (We need that Sync if we want to handle failures
|
||||
* for any reason other than !viewable. That's unlikely, but maybe
|
||||
* we'll BadAlloc or something.)
|
||||
*/
|
||||
new_pixmap = None;
|
||||
}
|
||||
|
||||
if (new_pixmap == None)
|
||||
{
|
||||
meta_verbose ("Unable to get named pixmap for %s\n",
|
||||
meta_window_get_description (priv->window));
|
||||
return;
|
||||
}
|
||||
|
||||
set_pixmap (self, new_pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_visible (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
return (priv->pixmap != None) && !priv->unredirected;
|
||||
}
|
||||
|
||||
static void
|
||||
damage_area (MetaSurfaceActorX11 *self,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
if (!is_visible (self))
|
||||
return;
|
||||
|
||||
cogl_texture_pixmap_x11_update_area (priv->texture, x, y, width, height);
|
||||
meta_surface_actor_update_area (META_SURFACE_ACTOR (self), x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
priv->received_damage = TRUE;
|
||||
|
||||
if (meta_window_is_fullscreen (priv->window) && !priv->unredirected && !priv->does_full_damage)
|
||||
{
|
||||
MetaRectangle window_rect;
|
||||
meta_window_get_frame_rect (priv->window, &window_rect);
|
||||
|
||||
if (window_rect.x == x &&
|
||||
window_rect.y == y &&
|
||||
window_rect.width == width &&
|
||||
window_rect.height == height)
|
||||
priv->full_damage_frames_count++;
|
||||
else
|
||||
priv->full_damage_frames_count = 0;
|
||||
|
||||
if (priv->full_damage_frames_count >= 100)
|
||||
priv->does_full_damage = TRUE;
|
||||
}
|
||||
|
||||
/* Drop damage event for unredirected windows */
|
||||
if (priv->unredirected)
|
||||
return;
|
||||
|
||||
damage_area (self, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = priv->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
if (priv->received_damage)
|
||||
{
|
||||
meta_error_trap_push (display);
|
||||
XDamageSubtract (xdisplay, priv->damage, None, None);
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
/* We need to make sure that any X drawing that happens before the
|
||||
* XDamageSubtract() above is visible to subsequent GL rendering;
|
||||
* the only standardized way to do this is EXT_x11_sync_object,
|
||||
* which isn't yet widely available. For now, we count on details
|
||||
* of Xorg and the open source drivers, and hope for the best
|
||||
* otherwise.
|
||||
*
|
||||
* Xorg and open source driver specifics:
|
||||
*
|
||||
* The X server makes sure to flush drawing to the kernel before
|
||||
* sending out damage events, but since we use DamageReportBoundingBox
|
||||
* there may be drawing between the last damage event and the
|
||||
* XDamageSubtract() that needs to be flushed as well.
|
||||
*
|
||||
* Xorg always makes sure that drawing is flushed to the kernel
|
||||
* before writing events or responses to the client, so any round trip
|
||||
* request at this point is sufficient to flush the GLX buffers.
|
||||
*/
|
||||
XSync (xdisplay, False);
|
||||
|
||||
priv->received_damage = FALSE;
|
||||
}
|
||||
|
||||
update_pixmap (self);
|
||||
}
|
||||
|
||||
static void
|
||||
update_is_argb32 (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = priv->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
XRenderPictFormat *format;
|
||||
format = XRenderFindVisualFormat (xdisplay, priv->window->xvisual);
|
||||
|
||||
priv->argb32 = (format && format->type == PictTypeDirect && format->direct.alphaMask);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_x11_is_argb32 (MetaSurfaceActor *actor)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
return priv->argb32;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_x11_is_visible (MetaSurfaceActor *actor)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
return is_visible (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
MetaWindow *window = priv->window;
|
||||
|
||||
if (meta_window_requested_dont_bypass_compositor (window))
|
||||
return FALSE;
|
||||
|
||||
if (window->opacity != 0xFF)
|
||||
return FALSE;
|
||||
|
||||
if (window->shape_region != NULL)
|
||||
return FALSE;
|
||||
|
||||
if (priv->argb32 && !meta_window_requested_bypass_compositor (window))
|
||||
return FALSE;
|
||||
|
||||
if (!meta_window_is_monitor_sized (window))
|
||||
return FALSE;
|
||||
|
||||
if (meta_window_requested_bypass_compositor (window))
|
||||
return TRUE;
|
||||
|
||||
if (meta_window_is_override_redirect (window))
|
||||
return TRUE;
|
||||
|
||||
if (priv->does_full_damage)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
sync_unredirected (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = priv->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
Window xwindow = meta_window_get_toplevel_xwindow (priv->window);
|
||||
|
||||
meta_error_trap_push (display);
|
||||
|
||||
if (priv->unredirected)
|
||||
{
|
||||
detach_pixmap (self);
|
||||
XCompositeUnredirectWindow (xdisplay, xwindow, CompositeRedirectManual);
|
||||
}
|
||||
else
|
||||
{
|
||||
XCompositeRedirectWindow (xdisplay, xwindow, CompositeRedirectManual);
|
||||
}
|
||||
|
||||
meta_error_trap_pop (display);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_x11_set_unredirected (MetaSurfaceActor *actor,
|
||||
gboolean unredirected)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
if (priv->unredirected == unredirected)
|
||||
return;
|
||||
|
||||
priv->unredirected = unredirected;
|
||||
sync_unredirected (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
return priv->unredirected;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_x11_dispose (GObject *object)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (object);
|
||||
|
||||
detach_pixmap (self);
|
||||
free_damage (self);
|
||||
|
||||
G_OBJECT_CLASS (meta_surface_actor_x11_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
MetaSurfaceActorClass *surface_actor_class = META_SURFACE_ACTOR_CLASS (klass);
|
||||
|
||||
object_class->dispose = meta_surface_actor_x11_dispose;
|
||||
|
||||
surface_actor_class->process_damage = meta_surface_actor_x11_process_damage;
|
||||
surface_actor_class->pre_paint = meta_surface_actor_x11_pre_paint;
|
||||
surface_actor_class->is_argb32 = meta_surface_actor_x11_is_argb32;
|
||||
surface_actor_class->is_visible = meta_surface_actor_x11_is_visible;
|
||||
|
||||
surface_actor_class->should_unredirect = meta_surface_actor_x11_should_unredirect;
|
||||
surface_actor_class->set_unredirected = meta_surface_actor_x11_set_unredirected;
|
||||
surface_actor_class->is_unredirected = meta_surface_actor_x11_is_unredirected;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
priv->last_width = -1;
|
||||
priv->last_height = -1;
|
||||
}
|
||||
|
||||
MetaSurfaceActor *
|
||||
meta_surface_actor_x11_new (MetaWindow *window)
|
||||
{
|
||||
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
Window xwindow = meta_window_get_toplevel_xwindow (window);
|
||||
|
||||
g_assert (!meta_is_wayland_compositor ());
|
||||
|
||||
priv->window = window;
|
||||
priv->display = display;
|
||||
|
||||
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
|
||||
update_is_argb32 (self);
|
||||
|
||||
priv->unredirected = FALSE;
|
||||
sync_unredirected (self);
|
||||
|
||||
return META_SURFACE_ACTOR (self);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
|
||||
int width, int height)
|
||||
{
|
||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||
|
||||
if (priv->last_width == width &&
|
||||
priv->last_height == height)
|
||||
return;
|
||||
|
||||
priv->size_changed = TRUE;
|
||||
priv->last_width = width;
|
||||
priv->last_height = height;
|
||||
}
|
69
src/compositor/meta-surface-actor-x11.h
Normal file
69
src/compositor/meta-surface-actor-x11.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by:
|
||||
* Owen Taylor <otaylor@redhat.com>
|
||||
* Jasper St. Pierre <jstpierre@mecheye.net>
|
||||
*/
|
||||
|
||||
#ifndef __META_SURFACE_ACTOR_X11_H__
|
||||
#define __META_SURFACE_ACTOR_X11_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "meta-surface-actor.h"
|
||||
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
|
||||
#include <meta/display.h>
|
||||
#include <meta/window.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define META_TYPE_SURFACE_ACTOR_X11 (meta_surface_actor_x11_get_type ())
|
||||
#define META_SURFACE_ACTOR_X11(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11))
|
||||
#define META_SURFACE_ACTOR_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11Class))
|
||||
#define META_IS_SURFACE_ACTOR_X11(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_SURFACE_ACTOR_X11))
|
||||
#define META_IS_SURFACE_ACTOR_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SURFACE_ACTOR_X11))
|
||||
#define META_SURFACE_ACTOR_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SURFACE_ACTOR_X11, MetaSurfaceActorX11Class))
|
||||
|
||||
typedef struct _MetaSurfaceActorX11 MetaSurfaceActorX11;
|
||||
typedef struct _MetaSurfaceActorX11Class MetaSurfaceActorX11Class;
|
||||
|
||||
struct _MetaSurfaceActorX11
|
||||
{
|
||||
MetaSurfaceActor parent;
|
||||
};
|
||||
|
||||
struct _MetaSurfaceActorX11Class
|
||||
{
|
||||
MetaSurfaceActorClass parent_class;
|
||||
};
|
||||
|
||||
GType meta_surface_actor_x11_get_type (void);
|
||||
|
||||
MetaSurfaceActor * meta_surface_actor_x11_new (MetaWindow *window);
|
||||
|
||||
void meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
|
||||
int width, int height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __META_SURFACE_ACTOR_X11_H__ */
|
@ -10,29 +10,134 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include <cogl/cogl-wayland-server.h>
|
||||
#include <cogl/cogl-texture-pixmap-x11.h>
|
||||
#include <meta/meta-shaped-texture.h>
|
||||
|
||||
#include "meta-surface-actor.h"
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <meta/meta-shaped-texture.h>
|
||||
#include "meta-wayland-private.h"
|
||||
#include "meta-cullable.h"
|
||||
#include "meta-shaped-texture-private.h"
|
||||
|
||||
struct _MetaSurfaceActorPrivate
|
||||
{
|
||||
MetaShapedTexture *texture;
|
||||
MetaWaylandBuffer *buffer;
|
||||
Pixmap pixmap;
|
||||
|
||||
cairo_region_t *input_region;
|
||||
|
||||
/* Freeze/thaw accounting */
|
||||
guint freeze_count;
|
||||
guint needs_damage_all : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR);
|
||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||
|
||||
gboolean
|
||||
meta_surface_actor_get_unobscured_bounds (MetaSurfaceActor *self,
|
||||
cairo_rectangle_int_t *unobscured_bounds)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
return meta_shaped_texture_get_unobscured_bounds (priv->texture, unobscured_bounds);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_pick (ClutterActor *actor,
|
||||
const ClutterColor *color)
|
||||
{
|
||||
MetaSurfaceActor *self = META_SURFACE_ACTOR (actor);
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
|
||||
if (!clutter_actor_should_pick_paint (actor))
|
||||
return;
|
||||
|
||||
/* If there is no region then use the regular pick */
|
||||
if (priv->input_region == NULL)
|
||||
CLUTTER_ACTOR_CLASS (meta_surface_actor_parent_class)->pick (actor, color);
|
||||
else
|
||||
{
|
||||
int n_rects;
|
||||
float *rectangles;
|
||||
int i;
|
||||
CoglPipeline *pipeline;
|
||||
CoglContext *ctx;
|
||||
CoglFramebuffer *fb;
|
||||
CoglColor cogl_color;
|
||||
|
||||
n_rects = cairo_region_num_rectangles (priv->input_region);
|
||||
rectangles = g_alloca (sizeof (float) * 4 * n_rects);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
int pos = i * 4;
|
||||
|
||||
cairo_region_get_rectangle (priv->input_region, i, &rect);
|
||||
|
||||
rectangles[pos + 0] = rect.x;
|
||||
rectangles[pos + 1] = rect.y;
|
||||
rectangles[pos + 2] = rect.x + rect.width;
|
||||
rectangles[pos + 3] = rect.y + rect.height;
|
||||
}
|
||||
|
||||
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
fb = cogl_get_draw_framebuffer ();
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color, color->red, color->green, color->blue, color->alpha);
|
||||
|
||||
pipeline = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_color (pipeline, &cogl_color);
|
||||
cogl_framebuffer_draw_rectangles (fb, pipeline, rectangles, n_rects);
|
||||
cogl_object_unref (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_dispose (GObject *object)
|
||||
{
|
||||
MetaSurfaceActor *self = META_SURFACE_ACTOR (object);
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
|
||||
g_clear_pointer (&priv->input_region, cairo_region_destroy);
|
||||
|
||||
G_OBJECT_CLASS (meta_surface_actor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
object_class->dispose = meta_surface_actor_dispose;
|
||||
actor_class->pick = meta_surface_actor_pick;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (MetaSurfaceActorPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_reset_culling (MetaCullable *cullable)
|
||||
{
|
||||
meta_cullable_reset_culling_children (cullable);
|
||||
}
|
||||
|
||||
static void
|
||||
cullable_iface_init (MetaCullableInterface *iface)
|
||||
{
|
||||
iface->cull_out = meta_surface_actor_cull_out;
|
||||
iface->reset_culling = meta_surface_actor_reset_culling;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_surface_actor_init (MetaSurfaceActor *self)
|
||||
{
|
||||
@ -42,21 +147,8 @@ meta_surface_actor_init (MetaSurfaceActor *self)
|
||||
META_TYPE_SURFACE_ACTOR,
|
||||
MetaSurfaceActorPrivate);
|
||||
|
||||
priv->texture = NULL;
|
||||
}
|
||||
|
||||
MetaSurfaceActor *
|
||||
meta_surface_actor_new (void)
|
||||
{
|
||||
MetaSurfaceActor *self = g_object_new (META_TYPE_SURFACE_ACTOR, NULL);
|
||||
MetaShapedTexture *stex;
|
||||
|
||||
stex = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
|
||||
self->priv->texture = stex;
|
||||
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (stex));
|
||||
|
||||
return self;
|
||||
priv->texture = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->texture));
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
@ -72,78 +164,152 @@ meta_surface_actor_get_texture (MetaSurfaceActor *self)
|
||||
return self->priv->texture;
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_set_clip_region (MetaSurfaceActor *self,
|
||||
cairo_region_t *clip_region)
|
||||
gboolean
|
||||
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
meta_shaped_texture_set_clip_region (self->priv->texture, clip_region);
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
return meta_shaped_texture_update_area (priv->texture, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
update_area (MetaSurfaceActor *self,
|
||||
int x, int y, int width, int height)
|
||||
gboolean
|
||||
meta_surface_actor_is_obscured (MetaSurfaceActor *self)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
return meta_shaped_texture_is_obscured (priv->texture);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
struct wl_resource *resource = priv->buffer->resource;
|
||||
struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get (resource);
|
||||
if (priv->input_region)
|
||||
cairo_region_destroy (priv->input_region);
|
||||
|
||||
if (shm_buffer)
|
||||
{
|
||||
CoglTexture2D *texture = COGL_TEXTURE_2D (priv->buffer->texture);
|
||||
cogl_wayland_texture_2d_update_area (texture, shm_buffer, x, y, width, height);
|
||||
}
|
||||
}
|
||||
if (region)
|
||||
priv->input_region = cairo_region_reference (region);
|
||||
else
|
||||
priv->input_region = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
meta_shaped_texture_set_opaque_region (priv->texture, region);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_frozen (MetaSurfaceActor *self)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
return (priv->freeze_count > 0);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
|
||||
if (is_frozen (self))
|
||||
{
|
||||
CoglTexturePixmapX11 *texture = COGL_TEXTURE_PIXMAP_X11 (meta_shaped_texture_get_texture (priv->texture));
|
||||
cogl_texture_pixmap_x11_update_area (texture, x, y, width, height);
|
||||
/* The window is frozen due to an effect in progress: we ignore damage
|
||||
* here on the off chance that this will stop the corresponding
|
||||
* texture_from_pixmap from being update.
|
||||
*
|
||||
* needs_damage_all tracks that some unknown damage happened while the
|
||||
* window was frozen so that when the window becomes unfrozen we can
|
||||
* issue a full window update to cover any lost damage.
|
||||
*
|
||||
* It should be noted that this is an unreliable mechanism since it's
|
||||
* quite likely that drivers will aim to provide a zero-copy
|
||||
* implementation of the texture_from_pixmap extension and in those cases
|
||||
* any drawing done to the window is always immediately reflected in the
|
||||
* texture regardless of damage event handling.
|
||||
*/
|
||||
priv->needs_damage_all = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_pre_paint (MetaSurfaceActor *self)
|
||||
{
|
||||
META_SURFACE_ACTOR_GET_CLASS (self)->pre_paint (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_surface_actor_is_argb32 (MetaSurfaceActor *self)
|
||||
{
|
||||
return META_SURFACE_ACTOR_GET_CLASS (self)->is_argb32 (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_surface_actor_is_visible (MetaSurfaceActor *self)
|
||||
{
|
||||
return META_SURFACE_ACTOR_GET_CLASS (self)->is_visible (self);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_freeze (MetaSurfaceActor *self)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
|
||||
priv->freeze_count ++;
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_thaw (MetaSurfaceActor *self)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
|
||||
if (priv->freeze_count == 0)
|
||||
{
|
||||
g_critical ("Error in freeze/thaw accounting.");
|
||||
return;
|
||||
}
|
||||
|
||||
priv->freeze_count --;
|
||||
|
||||
/* Since we ignore damage events while a window is frozen for certain effects
|
||||
* we may need to issue an update_area() covering the whole pixmap if we
|
||||
* don't know what real damage has happened. */
|
||||
if (priv->needs_damage_all)
|
||||
{
|
||||
meta_surface_actor_process_damage (self, 0, 0,
|
||||
clutter_actor_get_width (CLUTTER_ACTOR (priv->texture)),
|
||||
clutter_actor_get_height (CLUTTER_ACTOR (priv->texture)));
|
||||
priv->needs_damage_all = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_surface_actor_damage_all (MetaSurfaceActor *self,
|
||||
cairo_region_t *unobscured_region)
|
||||
meta_surface_actor_is_frozen (MetaSurfaceActor *self)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
CoglTexture *texture = meta_shaped_texture_get_texture (priv->texture);
|
||||
|
||||
update_area (self, 0, 0, cogl_texture_get_width (texture), cogl_texture_get_height (texture));
|
||||
return meta_shaped_texture_update_area (self->priv->texture,
|
||||
0, 0,
|
||||
cogl_texture_get_width (texture),
|
||||
cogl_texture_get_height (texture),
|
||||
unobscured_region);
|
||||
return is_frozen (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_surface_actor_damage_area (MetaSurfaceActor *self,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
cairo_region_t *unobscured_region)
|
||||
meta_surface_actor_should_unredirect (MetaSurfaceActor *self)
|
||||
{
|
||||
update_area (self, x, y, width, height);
|
||||
return meta_shaped_texture_update_area (self->priv->texture,
|
||||
x, y, width, height,
|
||||
unobscured_region);
|
||||
return META_SURFACE_ACTOR_GET_CLASS (self)->should_unredirect (self);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_attach_wayland_buffer (MetaSurfaceActor *self,
|
||||
MetaWaylandBuffer *buffer)
|
||||
meta_surface_actor_set_unredirected (MetaSurfaceActor *self,
|
||||
gboolean unredirected)
|
||||
{
|
||||
MetaSurfaceActorPrivate *priv = self->priv;
|
||||
priv->buffer = buffer;
|
||||
meta_shaped_texture_set_texture (self->priv->texture, buffer->texture);
|
||||
META_SURFACE_ACTOR_GET_CLASS (self)->set_unredirected (self, unredirected);
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_set_texture (MetaSurfaceActor *self,
|
||||
CoglTexture *texture)
|
||||
gboolean
|
||||
meta_surface_actor_is_unredirected (MetaSurfaceActor *self)
|
||||
{
|
||||
meta_shaped_texture_set_texture (self->priv->texture, texture);
|
||||
return META_SURFACE_ACTOR_GET_CLASS (self)->is_unredirected (self);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <meta/meta-shaped-texture.h>
|
||||
#include "meta-wayland-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -25,6 +24,17 @@ struct _MetaSurfaceActorClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
void (* process_damage) (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height);
|
||||
void (* pre_paint) (MetaSurfaceActor *actor);
|
||||
gboolean (* is_argb32) (MetaSurfaceActor *actor);
|
||||
gboolean (* is_visible) (MetaSurfaceActor *actor);
|
||||
|
||||
gboolean (* should_unredirect) (MetaSurfaceActor *actor);
|
||||
void (* set_unredirected) (MetaSurfaceActor *actor,
|
||||
gboolean unredirected);
|
||||
gboolean (* is_unredirected) (MetaSurfaceActor *actor);
|
||||
};
|
||||
|
||||
struct _MetaSurfaceActor
|
||||
@ -36,30 +46,37 @@ struct _MetaSurfaceActor
|
||||
|
||||
GType meta_surface_actor_get_type (void);
|
||||
|
||||
MetaSurfaceActor *meta_surface_actor_new (void);
|
||||
|
||||
cairo_surface_t *meta_surface_actor_get_image (MetaSurfaceActor *self,
|
||||
cairo_rectangle_int_t *clip);
|
||||
|
||||
MetaShapedTexture *meta_surface_actor_get_texture (MetaSurfaceActor *self);
|
||||
|
||||
void meta_surface_actor_set_clip_region (MetaSurfaceActor *self,
|
||||
cairo_region_t *clip_region);
|
||||
gboolean meta_surface_actor_is_obscured (MetaSurfaceActor *self);
|
||||
gboolean meta_surface_actor_get_unobscured_bounds (MetaSurfaceActor *self,
|
||||
cairo_rectangle_int_t *unobscured_bounds);
|
||||
|
||||
gboolean meta_surface_actor_damage_all (MetaSurfaceActor *self,
|
||||
cairo_region_t *unobscured_region);
|
||||
void meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
||||
cairo_region_t *region);
|
||||
void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
||||
cairo_region_t *region);
|
||||
|
||||
gboolean meta_surface_actor_damage_area (MetaSurfaceActor *self,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
cairo_region_t *unobscured_region);
|
||||
gboolean meta_surface_actor_update_area (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height);
|
||||
|
||||
void meta_surface_actor_set_texture (MetaSurfaceActor *self,
|
||||
CoglTexture *texture);
|
||||
void meta_surface_actor_attach_wayland_buffer (MetaSurfaceActor *self,
|
||||
MetaWaylandBuffer *buffer);
|
||||
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
|
||||
int x, int y, int width, int height);
|
||||
void meta_surface_actor_pre_paint (MetaSurfaceActor *actor);
|
||||
gboolean meta_surface_actor_is_argb32 (MetaSurfaceActor *actor);
|
||||
gboolean meta_surface_actor_is_visible (MetaSurfaceActor *actor);
|
||||
|
||||
void meta_surface_actor_freeze (MetaSurfaceActor *actor);
|
||||
void meta_surface_actor_thaw (MetaSurfaceActor *actor);
|
||||
gboolean meta_surface_actor_is_frozen (MetaSurfaceActor *actor);
|
||||
|
||||
gboolean meta_surface_actor_should_unredirect (MetaSurfaceActor *actor);
|
||||
void meta_surface_actor_set_unredirected (MetaSurfaceActor *actor,
|
||||
gboolean unredirected);
|
||||
gboolean meta_surface_actor_is_unredirected (MetaSurfaceActor *actor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -28,41 +26,6 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include "meta-texture-rectangle.h"
|
||||
|
||||
CoglTexture *
|
||||
meta_texture_rectangle_new (unsigned int width,
|
||||
unsigned int height,
|
||||
CoglPixelFormat format,
|
||||
CoglPixelFormat internal_format,
|
||||
unsigned int rowstride,
|
||||
const guint8 *data,
|
||||
GError **error)
|
||||
{
|
||||
ClutterBackend *backend =
|
||||
clutter_get_default_backend ();
|
||||
CoglContext *context =
|
||||
clutter_backend_get_cogl_context (backend);
|
||||
CoglTextureRectangle *tex_rect;
|
||||
|
||||
tex_rect = cogl_texture_rectangle_new_with_size (context,
|
||||
width, height,
|
||||
internal_format,
|
||||
error);
|
||||
if (tex_rect == NULL)
|
||||
return NULL;
|
||||
|
||||
if (data)
|
||||
cogl_texture_set_region (COGL_TEXTURE (tex_rect),
|
||||
0, 0, /* src_x/y */
|
||||
0, 0, /* dst_x/y */
|
||||
width, height, /* dst_width/height */
|
||||
width, height, /* width/height */
|
||||
format,
|
||||
rowstride,
|
||||
data);
|
||||
|
||||
return COGL_TEXTURE (tex_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_rectangle_check_cb (CoglTexture *sub_texture,
|
||||
const float *sub_texture_coords,
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_TEXTURE_RECTANGLE_H__
|
||||
@ -30,15 +28,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
CoglTexture *
|
||||
meta_texture_rectangle_new (unsigned int width,
|
||||
unsigned int height,
|
||||
CoglPixelFormat format,
|
||||
CoglPixelFormat internal_format,
|
||||
unsigned int rowstride,
|
||||
const guint8 *data,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
meta_texture_rectangle_check (CoglTexture *texture);
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
@ -357,18 +355,10 @@ texture_tower_create_texture (MetaTextureTower *tower,
|
||||
if ((!is_power_of_two (width) || !is_power_of_two (height)) &&
|
||||
meta_texture_rectangle_check (tower->textures[level - 1]))
|
||||
{
|
||||
tower->textures[level] =
|
||||
meta_texture_rectangle_new (width, height,
|
||||
/* data format */
|
||||
TEXTURE_FORMAT,
|
||||
/* internal cogl format */
|
||||
TEXTURE_FORMAT,
|
||||
/* rowstride */
|
||||
width * 4,
|
||||
/* data */
|
||||
NULL,
|
||||
/* error */
|
||||
NULL);
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
CoglContext *context = clutter_backend_get_cogl_context (backend);
|
||||
|
||||
tower->textures[level] = cogl_texture_rectangle_new_with_size (context, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_TEXTURE_TOWER_H__
|
||||
|
@ -31,14 +31,6 @@ void meta_window_actor_unmaximize (MetaWindowActor *self,
|
||||
void meta_window_actor_process_x11_damage (MetaWindowActor *self,
|
||||
XDamageNotifyEvent *event);
|
||||
|
||||
void meta_window_actor_process_wayland_damage (MetaWindowActor *self,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
void meta_window_actor_attach_wayland_buffer (MetaWindowActor *self,
|
||||
MetaWaylandBuffer *buffer);
|
||||
|
||||
void meta_window_actor_pre_paint (MetaWindowActor *self);
|
||||
void meta_window_actor_post_paint (MetaWindowActor *self);
|
||||
void meta_window_actor_frame_complete (MetaWindowActor *self,
|
||||
@ -47,13 +39,13 @@ void meta_window_actor_frame_complete (MetaWindowActor *self,
|
||||
|
||||
void meta_window_actor_invalidate_shadow (MetaWindowActor *self);
|
||||
|
||||
void meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state);
|
||||
|
||||
gboolean meta_window_actor_should_unredirect (MetaWindowActor *self);
|
||||
|
||||
void meta_window_actor_get_shape_bounds (MetaWindowActor *self,
|
||||
cairo_rectangle_int_t *bounds);
|
||||
|
||||
gboolean meta_window_actor_should_unredirect (MetaWindowActor *self);
|
||||
void meta_window_actor_set_unredirected (MetaWindowActor *self,
|
||||
gboolean unredirected);
|
||||
|
||||
gboolean meta_window_actor_effect_in_progress (MetaWindowActor *self);
|
||||
void meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
|
||||
gboolean did_placement);
|
||||
@ -67,17 +59,6 @@ void meta_window_actor_set_updates_frozen (MetaWindowActor *self,
|
||||
void meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
|
||||
gboolean no_delay_frame);
|
||||
|
||||
cairo_region_t *meta_window_actor_get_obscured_region (MetaWindowActor *self);
|
||||
|
||||
void meta_window_actor_set_clip_region (MetaWindowActor *self,
|
||||
cairo_region_t *clip_region);
|
||||
void meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
|
||||
cairo_region_t *beneath_region);
|
||||
void meta_window_actor_reset_clip_regions (MetaWindowActor *self);
|
||||
|
||||
void meta_window_actor_set_unobscured_region (MetaWindowActor *self,
|
||||
cairo_region_t *unobscured_region);
|
||||
|
||||
void meta_window_actor_effect_completed (MetaWindowActor *actor,
|
||||
gulong event);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,9 +11,8 @@
|
||||
#include "compositor-private.h"
|
||||
#include "meta-window-actor-private.h"
|
||||
#include "meta-window-group.h"
|
||||
#include "meta-background-actor-private.h"
|
||||
#include "meta-background-group-private.h"
|
||||
#include "window-private.h"
|
||||
#include "meta-cullable.h"
|
||||
|
||||
struct _MetaWindowGroupClass
|
||||
{
|
||||
@ -27,7 +26,10 @@ struct _MetaWindowGroup
|
||||
MetaScreen *screen;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR);
|
||||
static void cullable_iface_init (MetaCullableInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
|
||||
|
||||
/* Help macros to scale from OpenGL <-1,1> coordinates system to
|
||||
* window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c
|
||||
@ -87,34 +89,40 @@ painting_untransformed (MetaWindowGroup *window_group,
|
||||
return meta_actor_vertices_are_untransformed (vertices, width, height, x_origin, y_origin);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_group_cull_out (MetaCullable *cullable,
|
||||
cairo_region_t *unobscured_region,
|
||||
cairo_region_t *clip_region)
|
||||
{
|
||||
meta_cullable_cull_out_children (cullable, unobscured_region, clip_region);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_group_reset_culling (MetaCullable *cullable)
|
||||
{
|
||||
meta_cullable_reset_culling_children (cullable);
|
||||
}
|
||||
|
||||
static void
|
||||
cullable_iface_init (MetaCullableInterface *iface)
|
||||
{
|
||||
iface->cull_out = meta_window_group_cull_out;
|
||||
iface->reset_culling = meta_window_group_reset_culling;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_group_paint (ClutterActor *actor)
|
||||
{
|
||||
cairo_region_t *clip_region;
|
||||
cairo_region_t *unobscured_region;
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
cairo_rectangle_int_t visible_rect, clip_rect;
|
||||
int paint_x_offset, paint_y_offset;
|
||||
int paint_x_origin, paint_y_origin;
|
||||
int actor_x_origin, actor_y_origin;
|
||||
int paint_x_offset, paint_y_offset;
|
||||
|
||||
MetaWindowGroup *window_group = META_WINDOW_GROUP (actor);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (window_group->screen);
|
||||
ClutterActor *stage = clutter_actor_get_stage (actor);
|
||||
|
||||
/* Start off by treating all windows as completely unobscured, so damage anywhere
|
||||
* in a window queues redraws, but confine it more below. */
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
if (META_IS_WINDOW_ACTOR (child))
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (child);
|
||||
meta_window_actor_set_unobscured_region (window_actor, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Normally we expect an actor to be drawn at it's position on the screen.
|
||||
* However, if we're inside the paint of a ClutterClone, that won't be the
|
||||
* case and we need to compensate. We look at the position of the window
|
||||
@ -135,9 +143,6 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
return;
|
||||
}
|
||||
|
||||
paint_x_offset = paint_x_origin - actor_x_origin;
|
||||
paint_y_offset = paint_y_origin - actor_y_origin;
|
||||
|
||||
visible_rect.x = visible_rect.y = 0;
|
||||
visible_rect.width = clutter_actor_get_width (CLUTTER_ACTOR (stage));
|
||||
visible_rect.height = clutter_actor_get_height (CLUTTER_ACTOR (stage));
|
||||
@ -155,138 +160,44 @@ meta_window_group_paint (ClutterActor *actor)
|
||||
|
||||
clip_region = cairo_region_create_rectangle (&clip_rect);
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
info = meta_screen_get_compositor_data (window_group->screen);
|
||||
if (info->unredirected_window != NULL)
|
||||
{
|
||||
cairo_rectangle_int_t unredirected_rect;
|
||||
MetaWindow *window = meta_window_actor_get_meta_window (info->unredirected_window);
|
||||
paint_x_offset = paint_x_origin - actor_x_origin;
|
||||
paint_y_offset = paint_y_origin - actor_y_origin;
|
||||
cairo_region_translate (clip_region, -paint_x_offset, -paint_y_offset);
|
||||
|
||||
meta_window_get_frame_rect (window, (MetaRectangle *)&unredirected_rect);
|
||||
cairo_region_subtract_rectangle (unobscured_region, &unredirected_rect);
|
||||
cairo_region_subtract_rectangle (clip_region, &unredirected_rect);
|
||||
}
|
||||
}
|
||||
|
||||
/* We walk the list from top to bottom (opposite of painting order),
|
||||
* and subtract the opaque area of each window out of the visible
|
||||
* region that we pass to the windows below.
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_prev (&iter, &child))
|
||||
{
|
||||
if (!CLUTTER_ACTOR_IS_VISIBLE (child))
|
||||
continue;
|
||||
|
||||
if (!meta_is_wayland_compositor () &&
|
||||
info->unredirected_window != NULL &&
|
||||
child == CLUTTER_ACTOR (info->unredirected_window))
|
||||
continue;
|
||||
|
||||
/* If an actor has effects applied, then that can change the area
|
||||
* it paints and the opacity, so we no longer can figure out what
|
||||
* portion of the actor is obscured and what portion of the screen
|
||||
* it obscures, so we skip the actor.
|
||||
*
|
||||
* This has a secondary beneficial effect: if a ClutterOffscreenEffect
|
||||
* is applied to an actor, then our clipped redraws interfere with the
|
||||
* caching of the FBO - even if we only need to draw a small portion
|
||||
* of the window right now, ClutterOffscreenEffect may use other portions
|
||||
* of the FBO later. So, skipping actors with effects applied also
|
||||
* prevents these bugs.
|
||||
*
|
||||
* Theoretically, we should check clutter_actor_get_offscreen_redirect()
|
||||
* as well for the same reason, but omitted for simplicity in the
|
||||
* hopes that no-one will do that.
|
||||
*/
|
||||
if (clutter_actor_has_effects (child))
|
||||
continue;
|
||||
|
||||
if (META_IS_WINDOW_ACTOR (child))
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (child);
|
||||
int x, y;
|
||||
|
||||
if (!meta_actor_is_untransformed (CLUTTER_ACTOR (window_actor), &x, &y))
|
||||
continue;
|
||||
|
||||
x += paint_x_offset;
|
||||
y += paint_y_offset;
|
||||
|
||||
|
||||
/* Temporarily move to the coordinate system of the actor */
|
||||
cairo_region_translate (unobscured_region, - x, - y);
|
||||
cairo_region_translate (clip_region, - x, - y);
|
||||
|
||||
meta_window_actor_set_unobscured_region (window_actor, unobscured_region);
|
||||
meta_window_actor_set_clip_region (window_actor, clip_region);
|
||||
|
||||
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (window_actor)) == 0xff)
|
||||
{
|
||||
cairo_region_t *obscured_region = meta_window_actor_get_obscured_region (window_actor);
|
||||
if (obscured_region)
|
||||
{
|
||||
cairo_region_subtract (unobscured_region, obscured_region);
|
||||
cairo_region_subtract (clip_region, obscured_region);
|
||||
}
|
||||
}
|
||||
|
||||
meta_window_actor_set_clip_region_beneath (window_actor, clip_region);
|
||||
|
||||
cairo_region_translate (unobscured_region, x, y);
|
||||
cairo_region_translate (clip_region, x, y);
|
||||
}
|
||||
else if (META_IS_BACKGROUND_ACTOR (child) ||
|
||||
META_IS_BACKGROUND_GROUP (child))
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (!meta_actor_is_untransformed (child, &x, &y))
|
||||
continue;
|
||||
|
||||
x += paint_x_offset;
|
||||
y += paint_y_offset;
|
||||
|
||||
cairo_region_translate (clip_region, - x, - y);
|
||||
|
||||
if (META_IS_BACKGROUND_GROUP (child))
|
||||
meta_background_group_set_clip_region (META_BACKGROUND_GROUP (child), clip_region);
|
||||
else
|
||||
meta_background_actor_set_clip_region (META_BACKGROUND_ACTOR (child), clip_region);
|
||||
cairo_region_translate (clip_region, x, y);
|
||||
}
|
||||
}
|
||||
meta_cullable_cull_out (META_CULLABLE (window_group), unobscured_region, clip_region);
|
||||
|
||||
cairo_region_destroy (unobscured_region);
|
||||
cairo_region_destroy (clip_region);
|
||||
|
||||
CLUTTER_ACTOR_CLASS (meta_window_group_parent_class)->paint (actor);
|
||||
|
||||
/* Now that we are done painting, unset the visible regions (they will
|
||||
* mess up painting clones of our actors)
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, actor);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
if (META_IS_WINDOW_ACTOR (child))
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (child);
|
||||
meta_window_actor_reset_clip_regions (window_actor);
|
||||
}
|
||||
else if (META_IS_BACKGROUND_ACTOR (child))
|
||||
{
|
||||
MetaBackgroundActor *background_actor = META_BACKGROUND_ACTOR (child);
|
||||
meta_background_actor_set_clip_region (background_actor, NULL);
|
||||
}
|
||||
}
|
||||
meta_cullable_reset_culling (META_CULLABLE (window_group));
|
||||
}
|
||||
|
||||
/* Adapted from clutter_actor_update_default_paint_volume() */
|
||||
static gboolean
|
||||
meta_window_group_get_paint_volume (ClutterActor *actor,
|
||||
meta_window_group_get_paint_volume (ClutterActor *self,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return clutter_paint_volume_set_from_allocation (volume, actor);
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
const ClutterPaintVolume *child_volume;
|
||||
|
||||
if (!CLUTTER_ACTOR_IS_MAPPED (child))
|
||||
continue;
|
||||
|
||||
child_volume = clutter_actor_get_transformed_paint_volume (child, self);
|
||||
if (child_volume == NULL)
|
||||
return FALSE;
|
||||
|
||||
clutter_paint_volume_union (volume, child_volume);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -11,29 +11,9 @@
|
||||
* MetaWindowGroup:
|
||||
*
|
||||
* This class is a subclass of ClutterActor with special handling for
|
||||
* MetaWindowActor/MetaBackgroundActor/MetaBackgroundGroup when painting
|
||||
* children.
|
||||
*
|
||||
* When we are painting a stack of 5-10 maximized windows, the
|
||||
* standard bottom-to-top method of drawing every actor results in a
|
||||
* tremendous amount of overdraw and can easily max out the available
|
||||
* memory bandwidth on a low-end graphics chipset. It's even worse if
|
||||
* window textures are being accessed over the AGP bus.
|
||||
*
|
||||
* The basic technique applied here is to do a pre-pass before painting
|
||||
* where we walk window from top to bottom and compute the visible area
|
||||
* at each step by subtracting out the windows above it. The visible
|
||||
* area is passed to MetaWindowActor which uses it to clip the portion of
|
||||
* the window which drawn and avoid redrawing the shadow if it is completely
|
||||
* obscured.
|
||||
*
|
||||
* A caveat is that this is ineffective if applications are using ARGB
|
||||
* visuals, since we have no way of knowing whether a window obscures
|
||||
* the windows behind it or not. Alternate approaches using the depth
|
||||
* or stencil buffer rather than client side regions might be able to
|
||||
* handle alpha windows, but the combination of glAlphaFunc and stenciling
|
||||
* tends not to be efficient except on newer cards. (And on newer cards
|
||||
* we have lots of memory and bandwidth.)
|
||||
* #MetaCullable when painting children. It uses code similar to
|
||||
* meta_cullable_cull_out_children(), but also has additional special
|
||||
* cases for the undirected window, and similar.
|
||||
*/
|
||||
|
||||
#define META_TYPE_WINDOW_GROUP (meta_window_group_get_type ())
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_WINDOW_SHAPE_H__
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -34,7 +32,7 @@
|
||||
#include <gmodule.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DESTROY_TIMEOUT 250
|
||||
#define DESTROY_TIMEOUT 100
|
||||
#define MINIMIZE_TIMEOUT 250
|
||||
#define MAXIMIZE_TIMEOUT 250
|
||||
#define MAP_TIMEOUT 250
|
||||
@ -291,26 +289,13 @@ on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
|
||||
meta_plugin_switch_workspace_completed (plugin);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
show_stage (MetaPlugin *plugin)
|
||||
{
|
||||
MetaScreen *screen;
|
||||
ClutterActor *stage;
|
||||
|
||||
screen = meta_plugin_get_screen (plugin);
|
||||
stage = meta_get_stage_for_screen (screen);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_monitors_changed (MetaScreen *screen,
|
||||
MetaPlugin *plugin)
|
||||
{
|
||||
MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
|
||||
int i, n;
|
||||
GRand *rand = g_rand_new_with_seed (12345);
|
||||
|
||||
clutter_actor_destroy_all_children (self->priv->background_group);
|
||||
|
||||
@ -333,14 +318,16 @@ on_monitors_changed (MetaScreen *screen,
|
||||
reproducible.
|
||||
*/
|
||||
clutter_color_init (&color,
|
||||
g_random_int () % 255,
|
||||
g_random_int () % 255,
|
||||
g_random_int () % 255,
|
||||
g_rand_int_range (rand, 0, 255),
|
||||
g_rand_int_range (rand, 0, 255),
|
||||
g_rand_int_range (rand, 0, 255),
|
||||
255);
|
||||
clutter_actor_set_background_color (background, &color);
|
||||
|
||||
clutter_actor_add_child (self->priv->background_group, background);
|
||||
}
|
||||
|
||||
g_rand_free (rand);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -357,10 +344,7 @@ start (MetaPlugin *plugin)
|
||||
G_CALLBACK (on_monitors_changed), plugin);
|
||||
on_monitors_changed (screen, plugin);
|
||||
|
||||
meta_later_add (META_LATER_BEFORE_REDRAW,
|
||||
(GSourceFunc) show_stage,
|
||||
plugin,
|
||||
NULL);
|
||||
clutter_actor_show (meta_get_stage_for_screen (screen));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -409,9 +393,11 @@ switch_workspace (MetaPlugin *plugin,
|
||||
MetaWindowActor *window_actor = l->data;
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||
MetaWorkspace *workspace;
|
||||
gint win_workspace;
|
||||
|
||||
win_workspace = meta_window_actor_get_workspace (window_actor);
|
||||
workspace = meta_window_get_workspace (meta_window_actor_get_meta_window (window_actor));
|
||||
win_workspace = meta_workspace_index (workspace);
|
||||
|
||||
if (win_workspace == to || win_workspace == from)
|
||||
{
|
||||
@ -483,8 +469,6 @@ on_minimize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data
|
||||
/* FIXME - we shouldn't assume the original scale, it should be saved
|
||||
* at the start of the effect */
|
||||
clutter_actor_set_scale (data->actor, 1.0, 1.0);
|
||||
clutter_actor_move_anchor_point_from_gravity (data->actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
meta_plugin_minimize_completed (plugin, window_actor);
|
||||
@ -521,9 +505,6 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
|
||||
|
||||
apriv->is_minimized = TRUE;
|
||||
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
animation = clutter_actor_animate (actor,
|
||||
CLUTTER_EASE_IN_SINE,
|
||||
MINIMIZE_TIMEOUT,
|
||||
@ -562,8 +543,6 @@ on_maximize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data
|
||||
|
||||
/* FIXME - don't assume the original scale was 1.0 */
|
||||
clutter_actor_set_scale (data->actor, 1.0, 1.0);
|
||||
clutter_actor_move_anchor_point_from_gravity (data->actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
meta_plugin_maximize_completed (plugin, window_actor);
|
||||
@ -588,10 +567,8 @@ maximize (MetaPlugin *plugin,
|
||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||
MetaWindow *meta_window = meta_window_actor_get_meta_window (window_actor);
|
||||
|
||||
gdouble scale_x = 1.0;
|
||||
gdouble scale_y = 1.0;
|
||||
gfloat anchor_x = 0;
|
||||
gfloat anchor_y = 0;
|
||||
gdouble scale_x = 1.0;
|
||||
gdouble scale_y = 1.0;
|
||||
|
||||
type = meta_window_get_window_type (meta_window);
|
||||
|
||||
@ -615,13 +592,6 @@ maximize (MetaPlugin *plugin,
|
||||
scale_x = (gdouble)end_width / (gdouble) width;
|
||||
scale_y = (gdouble)end_height / (gdouble) height;
|
||||
|
||||
anchor_x = (gdouble)(x - end_x)*(gdouble)width /
|
||||
((gdouble)(end_width - width));
|
||||
anchor_y = (gdouble)(y - end_y)*(gdouble)height /
|
||||
((gdouble)(end_height - height));
|
||||
|
||||
clutter_actor_move_anchor_point (actor, anchor_x, anchor_y);
|
||||
|
||||
animation = clutter_actor_animate (actor,
|
||||
CLUTTER_EASE_IN_SINE,
|
||||
MAXIMIZE_TIMEOUT,
|
||||
@ -676,9 +646,6 @@ on_map_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
|
||||
|
||||
apriv->tml_map = NULL;
|
||||
|
||||
clutter_actor_move_anchor_point_from_gravity (data->actor,
|
||||
CLUTTER_GRAVITY_NORTH_WEST);
|
||||
|
||||
/* Now notify the manager that we are done with this effect */
|
||||
meta_plugin_map_completed (plugin, window_actor);
|
||||
|
||||
@ -704,15 +671,15 @@ map (MetaPlugin *plugin, MetaWindowActor *window_actor)
|
||||
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
clutter_actor_set_scale (actor, 0.0, 0.0);
|
||||
clutter_actor_set_pivot_point (actor, 0.5, 0.5);
|
||||
clutter_actor_set_opacity (actor, 0);
|
||||
clutter_actor_set_scale (actor, 0.5, 0.5);
|
||||
clutter_actor_show (actor);
|
||||
|
||||
animation = clutter_actor_animate (actor,
|
||||
CLUTTER_EASE_IN_SINE,
|
||||
CLUTTER_EASE_OUT_QUAD,
|
||||
MAP_TIMEOUT,
|
||||
"opacity", 255,
|
||||
"scale-x", 1.0,
|
||||
"scale-y", 1.0,
|
||||
NULL);
|
||||
@ -764,14 +731,12 @@ destroy (MetaPlugin *plugin, MetaWindowActor *window_actor)
|
||||
EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
|
||||
clutter_actor_move_anchor_point_from_gravity (actor,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
animation = clutter_actor_animate (actor,
|
||||
CLUTTER_EASE_IN_SINE,
|
||||
CLUTTER_EASE_OUT_QUAD,
|
||||
DESTROY_TIMEOUT,
|
||||
"scale-x", 0.0,
|
||||
"scale-y", 1.0,
|
||||
"opacity", 0,
|
||||
"scale-x", 0.8,
|
||||
"scale-y", 0.8,
|
||||
NULL);
|
||||
apriv->tml_destroy = clutter_animation_get_timeline (animation);
|
||||
data->plugin = plugin;
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "region-utils.h"
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __META_REGION_UTILS_H__
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* The standard cycle-windows keybinding should be the key above the
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_BOXES_PRIVATE_H
|
||||
|
@ -25,9 +25,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "boxes-private.h"
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -1355,7 +1353,6 @@ constrain_titlebar_visible (MetaWindow *window,
|
||||
window->type == META_WINDOW_DOCK ||
|
||||
window->fullscreen ||
|
||||
!window->require_titlebar_visible ||
|
||||
!window->decorated ||
|
||||
unconstrained_user_action)
|
||||
return TRUE;
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_CONSTRAINTS_H
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -283,8 +281,7 @@ meta_core_lower_beneath_grab_window (Display *xdisplay,
|
||||
return;
|
||||
|
||||
changes.stack_mode = Below;
|
||||
changes.sibling = grab_window->frame ? grab_window->frame->xwindow
|
||||
: grab_window->xwindow;
|
||||
changes.sibling = meta_window_get_toplevel_xwindow (grab_window);
|
||||
|
||||
stack_window.any.type = META_WINDOW_CLIENT_TYPE_X11;
|
||||
stack_window.x11.xwindow = xwindow;
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_CORE_H
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE /* for kill() */
|
||||
@ -39,18 +37,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "meta-wayland-surface.h"
|
||||
|
||||
static void meta_window_present_delete_dialog (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
|
||||
static void
|
||||
delete_ping_reply_func (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
delete_ping_reply_func (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
void *user_data)
|
||||
{
|
||||
meta_topic (META_DEBUG_PING,
|
||||
"Got reply to delete ping for %s\n",
|
||||
((MetaWindow*)user_data)->desc);
|
||||
meta_topic (META_DEBUG_PING, "Got reply to delete ping for %s\n", window->desc);
|
||||
|
||||
/* we do nothing */
|
||||
}
|
||||
@ -68,12 +65,10 @@ dialog_exited (GPid pid, int status, gpointer user_data)
|
||||
}
|
||||
|
||||
static void
|
||||
delete_ping_timeout_func (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
delete_ping_timeout_func (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
void *user_data)
|
||||
{
|
||||
MetaWindow *window = user_data;
|
||||
char *window_title;
|
||||
gchar *window_content, *tmp;
|
||||
GPid dialog_pid;
|
||||
@ -137,36 +132,42 @@ void
|
||||
meta_window_check_alive (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_display_ping_window (window->display,
|
||||
window,
|
||||
meta_display_ping_window (window,
|
||||
timestamp,
|
||||
delete_ping_reply_func,
|
||||
delete_ping_timeout_func,
|
||||
window);
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_delete (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_error_trap_push (window->display);
|
||||
if (window->delete_window)
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Deleting %s with delete_window request\n",
|
||||
window->desc);
|
||||
meta_window_send_icccm_message (window,
|
||||
window->display->atom_WM_DELETE_WINDOW,
|
||||
timestamp);
|
||||
meta_error_trap_push (window->display);
|
||||
if (window->delete_window)
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Deleting %s with delete_window request\n",
|
||||
window->desc);
|
||||
meta_window_send_icccm_message (window,
|
||||
window->display->atom_WM_DELETE_WINDOW,
|
||||
timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Deleting %s with explicit kill\n",
|
||||
window->desc);
|
||||
XKillClient (window->display->xdisplay, window->xwindow);
|
||||
}
|
||||
meta_error_trap_pop (window->display);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Deleting %s with explicit kill\n",
|
||||
window->desc);
|
||||
XKillClient (window->display->xdisplay, window->xwindow);
|
||||
meta_wayland_surface_delete (window->surface);
|
||||
}
|
||||
meta_error_trap_pop (window->display);
|
||||
|
||||
meta_window_check_alive (window, timestamp);
|
||||
|
||||
|
@ -19,9 +19,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_DISPLAY_PRIVATE_H
|
||||
@ -57,10 +55,9 @@ typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
|
||||
|
||||
typedef struct MetaEdgeResistanceData MetaEdgeResistanceData;
|
||||
|
||||
typedef void (* MetaWindowPingFunc) (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
guint32 timestamp,
|
||||
gpointer user_data);
|
||||
typedef void (* MetaWindowPingFunc) (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
gpointer user_data);
|
||||
|
||||
typedef enum {
|
||||
META_LIST_DEFAULT = 0, /* normal windows */
|
||||
@ -150,6 +147,14 @@ struct _MetaDisplay
|
||||
*/
|
||||
guint allow_terminal_deactivation : 1;
|
||||
|
||||
/* If true, server->focus_serial refers to us changing the focus; in
|
||||
* this case, we can ignore focus events that have exactly focus_serial,
|
||||
* since we take care to make another request immediately afterwards.
|
||||
* But if focus is being changed by another client, we have to accept
|
||||
* multiple events with the same serial.
|
||||
*/
|
||||
guint focused_by_us : 1;
|
||||
|
||||
guint static_gravity_works : 1;
|
||||
|
||||
/*< private-ish >*/
|
||||
@ -448,14 +453,13 @@ void meta_display_retheme_all (void);
|
||||
void meta_display_set_cursor_theme (const char *theme,
|
||||
int size);
|
||||
|
||||
void meta_display_ping_window (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
void meta_display_ping_window (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
MetaWindowPingFunc ping_reply_func,
|
||||
MetaWindowPingFunc ping_timeout_func,
|
||||
void *user_data);
|
||||
gboolean meta_display_window_has_pending_pings (MetaDisplay *display,
|
||||
MetaWindow *window);
|
||||
void meta_display_pong_for_serial (MetaDisplay *display,
|
||||
guint32 serial);
|
||||
|
||||
int meta_resize_gravity_from_grab_op (MetaGrabOp op);
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -38,6 +36,7 @@
|
||||
#include <meta/main.h>
|
||||
#include "screen-private.h"
|
||||
#include "window-private.h"
|
||||
#include "window-x11.h"
|
||||
#include "window-props.h"
|
||||
#include "group-props.h"
|
||||
#include "frame.h"
|
||||
@ -74,6 +73,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "meta-xwayland-private.h"
|
||||
#include "meta-surface-actor-wayland.h"
|
||||
|
||||
#define GRAB_OP_IS_WINDOW_SWITCH(g) \
|
||||
(g == META_GRAB_OP_KEYBOARD_TABBING_NORMAL || \
|
||||
@ -107,10 +107,9 @@
|
||||
* does or doesn't respond to the ping, we use this information to deal with
|
||||
* these facts; we have a handler function for each.
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
MetaDisplay *display;
|
||||
Window xwindow;
|
||||
MetaWindow *window;
|
||||
guint32 timestamp;
|
||||
MetaWindowPingFunc ping_reply_func;
|
||||
MetaWindowPingFunc ping_timeout_func;
|
||||
@ -172,8 +171,6 @@ static guint32 event_get_time (MetaDisplay *display,
|
||||
XEvent *event);
|
||||
static void process_request_frame_extents (MetaDisplay *display,
|
||||
XEvent *event);
|
||||
static void process_pong_message (MetaDisplay *display,
|
||||
XEvent *event);
|
||||
static void process_selection_request (MetaDisplay *display,
|
||||
XEvent *event);
|
||||
static void process_selection_clear (MetaDisplay *display,
|
||||
@ -353,14 +350,14 @@ remove_pending_pings_for_window (MetaDisplay *display, Window xwindow)
|
||||
GSList *dead;
|
||||
|
||||
/* could obviously be more efficient, don't care */
|
||||
|
||||
|
||||
/* build list to be removed */
|
||||
dead = NULL;
|
||||
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
||||
{
|
||||
MetaPingData *ping_data = tmp->data;
|
||||
|
||||
if (ping_data->xwindow == xwindow)
|
||||
if (ping_data->window->xwindow == xwindow)
|
||||
dead = g_slist_prepend (dead, ping_data);
|
||||
}
|
||||
|
||||
@ -482,7 +479,6 @@ meta_display_open (void)
|
||||
Display *xdisplay;
|
||||
GSList *screens;
|
||||
MetaScreen *screen;
|
||||
GSList *tmp;
|
||||
int i;
|
||||
guint32 timestamp;
|
||||
|
||||
@ -902,12 +898,7 @@ meta_display_open (void)
|
||||
|
||||
screen = meta_screen_new (the_display, i, timestamp);
|
||||
|
||||
if (screen)
|
||||
screens = g_slist_prepend (screens, screen);
|
||||
|
||||
the_display->screens = screens;
|
||||
|
||||
if (screens == NULL)
|
||||
if (!screen)
|
||||
{
|
||||
/* This would typically happen because all the screens already
|
||||
* have window managers.
|
||||
@ -916,36 +907,19 @@ meta_display_open (void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
screens = g_slist_prepend (screens, screen);
|
||||
|
||||
the_display->screens = screens;
|
||||
|
||||
enable_compositor (the_display);
|
||||
|
||||
meta_display_grab (the_display);
|
||||
|
||||
/* Now manage all existing windows */
|
||||
tmp = the_display->screens;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaScreen *screen = tmp->data;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
/* Instead of explicitly enumerating all windows during
|
||||
* initialization, when we run as a wayland compositor we can rely on
|
||||
* xwayland notifying us of all top level windows so we create
|
||||
* MetaWindows when we get those notifications.
|
||||
*
|
||||
* We still want a guard window so we can avoid
|
||||
* unmapping/withdrawing minimized windows for live
|
||||
* thumbnails...
|
||||
*/
|
||||
if (screen->guard_window == None)
|
||||
screen->guard_window =
|
||||
meta_screen_create_guard_window (screen->display->xdisplay, screen);
|
||||
}
|
||||
else
|
||||
meta_screen_manage_all_windows (screen);
|
||||
meta_screen_create_guard_window (screen);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
/* We know that if mutter is running as a Wayland compositor,
|
||||
* we start out with no windows.
|
||||
*/
|
||||
if (!meta_is_wayland_compositor ())
|
||||
meta_screen_manage_all_windows (screen);
|
||||
|
||||
{
|
||||
Window focus;
|
||||
@ -987,8 +961,6 @@ meta_display_open (void)
|
||||
|
||||
meta_idle_monitor_init_dbus ();
|
||||
|
||||
meta_display_ungrab (the_display);
|
||||
|
||||
/* Done opening new display */
|
||||
the_display->display_opening = FALSE;
|
||||
|
||||
@ -1248,7 +1220,18 @@ meta_display_screen_for_x_screen (MetaDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Grab/ungrab routines taken from fvwm */
|
||||
/* Grab/ungrab routines taken from fvwm.
|
||||
* Calling this function will cause X to ignore all other clients until
|
||||
* you ungrab. This may not be quite as bad as it sounds, yet there is
|
||||
* agreement that avoiding server grabs except when they are clearly needed
|
||||
* is a good thing.
|
||||
*
|
||||
* If you do use such grabs, please clearly explain the necessity for their
|
||||
* usage in a comment. Try to keep their scope extremely limited. In
|
||||
* particular, try to avoid emitting any signals or notifications while
|
||||
* a grab is active (if the signal receiver tries to block on an X request
|
||||
* from another client at this point, you will have a deadlock).
|
||||
*/
|
||||
void
|
||||
meta_display_grab (MetaDisplay *display)
|
||||
{
|
||||
@ -1669,7 +1652,7 @@ handle_net_restack_window (MetaDisplay* display,
|
||||
*
|
||||
* Also, unconditionally following these is REALLY stupid--we should
|
||||
* combine this code with the stuff in
|
||||
* meta_window_configure_request() which is smart about whether to
|
||||
* meta_window_x11_configure_request() which is smart about whether to
|
||||
* follow the request or do something else (though not smart enough
|
||||
* and is also too stupid to handle the sibling stuff).
|
||||
*/
|
||||
@ -1696,12 +1679,16 @@ get_window_for_event (MetaDisplay *display,
|
||||
{
|
||||
ClutterActor *source;
|
||||
|
||||
if (display->grab_window)
|
||||
if (display->grab_op != META_GRAB_OP_NONE)
|
||||
return display->grab_window;
|
||||
|
||||
source = clutter_event_get_source (event);
|
||||
if (META_IS_WINDOW_ACTOR (source))
|
||||
return meta_window_actor_get_meta_window (META_WINDOW_ACTOR (source));
|
||||
if (META_IS_SURFACE_ACTOR_WAYLAND (source))
|
||||
{
|
||||
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (META_SURFACE_ACTOR_WAYLAND (source));
|
||||
g_assert (surface != NULL);
|
||||
return surface->window;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -1763,11 +1750,13 @@ update_focus_window (MetaDisplay *display,
|
||||
MetaFocusType type,
|
||||
MetaWindow *window,
|
||||
Window xwindow,
|
||||
gulong serial)
|
||||
gulong serial,
|
||||
gboolean focused_by_us)
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
display->focus_serial = serial;
|
||||
display->focused_by_us = focused_by_us;
|
||||
|
||||
if (display->focus_xwindow == xwindow &&
|
||||
display->focus_type == type &&
|
||||
@ -1799,9 +1788,19 @@ update_focus_window (MetaDisplay *display,
|
||||
|
||||
if (display->focus_window)
|
||||
{
|
||||
ClutterActor *window_actor;
|
||||
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s with serial %lu\n",
|
||||
display->focus_window->desc, serial);
|
||||
meta_window_set_focused_internal (display->focus_window, TRUE);
|
||||
|
||||
/* XXX -- this is sort of a layer violation, but because we
|
||||
* rely on the compositor for event delivery anyway, I don't
|
||||
* think it's too bad... */
|
||||
|
||||
window_actor = CLUTTER_ACTOR (display->focus_window->compositor_private);
|
||||
if (window_actor)
|
||||
clutter_actor_grab_key_focus (window_actor);
|
||||
}
|
||||
else
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL with serial %lu\n", serial);
|
||||
@ -1894,7 +1893,8 @@ request_xserver_input_focus_change (MetaDisplay *display,
|
||||
type,
|
||||
meta_window,
|
||||
xwindow,
|
||||
serial);
|
||||
serial,
|
||||
TRUE);
|
||||
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
@ -2023,33 +2023,53 @@ handle_window_focus_event (MetaDisplay *display,
|
||||
else
|
||||
g_return_if_reached ();
|
||||
|
||||
if (display->server_focus_serial > display->focus_serial)
|
||||
/* If display->focused_by_us, then the focus_serial will be used only
|
||||
* for a focus change we made and have already accounted for.
|
||||
* (See request_xserver_input_focus_change().) Otherwise, we can get
|
||||
* multiple focus events with the same serial.
|
||||
*/
|
||||
if (display->server_focus_serial > display->focus_serial ||
|
||||
(!display->focused_by_us &&
|
||||
display->server_focus_serial == display->focus_serial))
|
||||
{
|
||||
update_focus_window (display,
|
||||
type,
|
||||
focus_window,
|
||||
focus_window ? focus_window->xwindow : None,
|
||||
display->server_focus_serial);
|
||||
display->server_focus_serial,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_has_xwindow (MetaWindow *window,
|
||||
Window xwindow)
|
||||
{
|
||||
if (window->xwindow == xwindow)
|
||||
return TRUE;
|
||||
|
||||
if (window->frame && window->frame->xwindow == xwindow)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_display_handle_event (MetaDisplay *display,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaWindow *window;
|
||||
gboolean bypass_clutter = FALSE, bypass_wayland = FALSE;
|
||||
MetaWaylandCompositor *compositor = NULL;
|
||||
|
||||
/* XXX -- we need to fill this in properly at some point... */
|
||||
gboolean frame_was_receiver = FALSE;
|
||||
#ifdef HAVE_WAYLAND
|
||||
MetaWaylandCompositor *compositor = NULL;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
meta_wayland_compositor_update (compositor, event);
|
||||
}
|
||||
#endif /* HAVE_WAYLAND */
|
||||
|
||||
window = get_window_for_event (display, event);
|
||||
|
||||
@ -2109,8 +2129,9 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
meta_stack_set_positions (window->screen->stack,
|
||||
display->grab_old_window_stacking);
|
||||
}
|
||||
meta_display_end_grab_op (display,
|
||||
event->any.time);
|
||||
meta_display_end_grab_op (display, event->any.time);
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
}
|
||||
else if (window && display->grab_op == META_GRAB_OP_NONE)
|
||||
{
|
||||
@ -2225,20 +2246,8 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
event->button.y,
|
||||
event->button.button,
|
||||
event->any.time);
|
||||
}
|
||||
|
||||
if (!frame_was_receiver && unmodified)
|
||||
{
|
||||
/* This is from our synchronous grab since
|
||||
* it has no modifiers and was on the client window
|
||||
*/
|
||||
|
||||
meta_verbose ("Allowing events time %u\n",
|
||||
(unsigned int) event->any.time);
|
||||
|
||||
/* XXX -- implement this in Wayland */
|
||||
XIAllowEvents (display->xdisplay, META_VIRTUAL_CORE_POINTER_ID,
|
||||
XIReplayDevice, event->any.time);
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
}
|
||||
|
||||
if (begin_move && window->has_move_func)
|
||||
@ -2254,6 +2263,8 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
event->any.time,
|
||||
event->button.x,
|
||||
event->button.y);
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2265,7 +2276,11 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
|
||||
if (display->grab_window == window &&
|
||||
meta_grab_op_is_mouse (display->grab_op))
|
||||
meta_window_handle_mouse_grab_op_event (window, event);
|
||||
{
|
||||
meta_window_handle_mouse_grab_op_event (window, event);
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
}
|
||||
break;
|
||||
case CLUTTER_MOTION:
|
||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||
@ -2273,7 +2288,11 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
|
||||
if (display->grab_window == window &&
|
||||
meta_grab_op_is_mouse (display->grab_op))
|
||||
meta_window_handle_mouse_grab_op_event (window, event);
|
||||
{
|
||||
meta_window_handle_mouse_grab_op_event (window, event);
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLUTTER_KEY_PRESS:
|
||||
@ -2285,22 +2304,26 @@ meta_display_handle_event (MetaDisplay *display,
|
||||
* want to pass the key event to the compositor or Wayland at all.
|
||||
*/
|
||||
if (meta_display_process_key_event (display, window, (ClutterKeyEvent *) event))
|
||||
return TRUE;
|
||||
{
|
||||
bypass_clutter = TRUE;
|
||||
bypass_wayland = TRUE;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
if (compositor && (display->grab_op == META_GRAB_OP_NONE))
|
||||
/* If the compositor has a grab, don't pass that through to Wayland */
|
||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||
bypass_wayland = TRUE;
|
||||
|
||||
if (compositor && !bypass_wayland)
|
||||
{
|
||||
if (meta_wayland_compositor_handle_event (compositor, event))
|
||||
return TRUE;
|
||||
bypass_clutter = TRUE;
|
||||
}
|
||||
#endif /* HAVE_WAYLAND */
|
||||
|
||||
return (display->grab_op != META_GRAB_OP_NONE &&
|
||||
display->grab_op != META_GRAB_OP_COMPOSITOR);
|
||||
return bypass_clutter;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -2308,9 +2331,11 @@ handle_input_xevent (MetaDisplay *display,
|
||||
XIEvent *input_event,
|
||||
gulong serial)
|
||||
{
|
||||
XIDeviceEvent *device_event = (XIDeviceEvent *) input_event;
|
||||
XIEnterEvent *enter_event = (XIEnterEvent *) input_event;
|
||||
Window modified;
|
||||
MetaWindow *window;
|
||||
gboolean frame_was_receiver;
|
||||
|
||||
if (input_event == NULL)
|
||||
return FALSE;
|
||||
@ -2318,8 +2343,242 @@ handle_input_xevent (MetaDisplay *display,
|
||||
modified = xievent_get_modified_window (display, input_event);
|
||||
window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;
|
||||
|
||||
frame_was_receiver = FALSE;
|
||||
if (window &&
|
||||
window->frame &&
|
||||
modified == window->frame->xwindow)
|
||||
{
|
||||
/* Note that if the frame and the client both have an
|
||||
* XGrabButton (as is normal with our setup), the event
|
||||
* goes to the frame.
|
||||
*/
|
||||
frame_was_receiver = TRUE;
|
||||
meta_topic (META_DEBUG_EVENTS, "Frame was receiver of event for %s\n",
|
||||
window->desc);
|
||||
}
|
||||
|
||||
if (window && !window->override_redirect &&
|
||||
(input_event->evtype == XI_KeyPress || input_event->evtype == XI_ButtonPress))
|
||||
{
|
||||
if (CurrentTime == display->current_time)
|
||||
{
|
||||
/* We can't use missing (i.e. invalid) timestamps to set user time,
|
||||
* nor do we want to use them to sanity check other timestamps.
|
||||
* See bug 313490 for more details.
|
||||
*/
|
||||
meta_warning ("Event has no timestamp! You may be using a broken "
|
||||
"program such as xse. Please ask the authors of that "
|
||||
"program to fix it.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_window_set_user_time (window, display->current_time);
|
||||
sanity_check_timestamps (display, display->current_time);
|
||||
}
|
||||
}
|
||||
|
||||
switch (input_event->evtype)
|
||||
{
|
||||
case XI_ButtonPress:
|
||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||
break;
|
||||
|
||||
display->overlay_key_only_pressed = FALSE;
|
||||
|
||||
if (device_event->detail == 4 || device_event->detail == 5)
|
||||
/* Scrollwheel event, do nothing and deliver event to compositor below */
|
||||
break;
|
||||
|
||||
if ((window &&
|
||||
meta_grab_op_is_mouse (display->grab_op) &&
|
||||
(device_event->mods.effective & display->window_grab_modifiers) &&
|
||||
display->grab_button != device_event->detail &&
|
||||
display->grab_window == window) ||
|
||||
grab_op_is_keyboard (display->grab_op))
|
||||
{
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Ending grab op %u on window %s due to button press\n",
|
||||
display->grab_op,
|
||||
(display->grab_window ?
|
||||
display->grab_window->desc :
|
||||
"none"));
|
||||
if (GRAB_OP_IS_WINDOW_SWITCH (display->grab_op))
|
||||
{
|
||||
MetaScreen *screen;
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
"Syncing to old stack positions.\n");
|
||||
screen =
|
||||
meta_display_screen_for_root (display, device_event->event);
|
||||
|
||||
if (screen!=NULL)
|
||||
meta_stack_set_positions (screen->stack,
|
||||
display->grab_old_window_stacking);
|
||||
}
|
||||
meta_display_end_grab_op (display,
|
||||
device_event->time);
|
||||
}
|
||||
else if (window && display->grab_op == META_GRAB_OP_NONE)
|
||||
{
|
||||
gboolean begin_move = FALSE;
|
||||
unsigned int grab_mask;
|
||||
gboolean unmodified;
|
||||
|
||||
grab_mask = display->window_grab_modifiers;
|
||||
if (g_getenv ("MUTTER_DEBUG_BUTTON_GRABS"))
|
||||
grab_mask |= ControlMask;
|
||||
|
||||
/* Two possible sources of an unmodified event; one is a
|
||||
* client that's letting button presses pass through to the
|
||||
* frame, the other is our focus_window_grab on unmodified
|
||||
* button 1. So for all such events we focus the window.
|
||||
*/
|
||||
unmodified = (device_event->mods.effective & grab_mask) == 0;
|
||||
|
||||
if (unmodified ||
|
||||
device_event->detail == 1)
|
||||
{
|
||||
/* don't focus if frame received, will be lowered in
|
||||
* frames.c or special-cased if the click was on a
|
||||
* minimize/close button.
|
||||
*/
|
||||
if (!frame_was_receiver)
|
||||
{
|
||||
if (meta_prefs_get_raise_on_click ())
|
||||
meta_window_raise (window);
|
||||
else
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Not raising window on click due to don't-raise-on-click option\n");
|
||||
|
||||
/* Don't focus panels--they must explicitly request focus.
|
||||
* See bug 160470
|
||||
*/
|
||||
if (window->type != META_WINDOW_DOCK)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focusing %s due to unmodified button %u press (display.c)\n",
|
||||
window->desc, device_event->detail);
|
||||
meta_window_focus (window, device_event->time);
|
||||
}
|
||||
else
|
||||
/* However, do allow terminals to lose focus due to new
|
||||
* window mappings after the user clicks on a panel.
|
||||
*/
|
||||
display->allow_terminal_deactivation = TRUE;
|
||||
}
|
||||
|
||||
/* you can move on alt-click but not on
|
||||
* the click-to-focus
|
||||
*/
|
||||
if (!unmodified)
|
||||
begin_move = TRUE;
|
||||
}
|
||||
else if (!unmodified && device_event->detail == meta_prefs_get_mouse_button_resize())
|
||||
{
|
||||
if (window->has_resize_func)
|
||||
{
|
||||
gboolean north, south;
|
||||
gboolean west, east;
|
||||
MetaRectangle frame_rect;
|
||||
MetaGrabOp op;
|
||||
|
||||
meta_window_get_frame_rect (window, &frame_rect);
|
||||
|
||||
west = device_event->root_x < (frame_rect.x + 1 * frame_rect.width / 3);
|
||||
east = device_event->root_x > (frame_rect.x + 2 * frame_rect.width / 3);
|
||||
north = device_event->root_y < (frame_rect.y + 1 * frame_rect.height / 3);
|
||||
south = device_event->root_y > (frame_rect.y + 2 * frame_rect.height / 3);
|
||||
|
||||
if (north && west)
|
||||
op = META_GRAB_OP_RESIZING_NW;
|
||||
else if (north && east)
|
||||
op = META_GRAB_OP_RESIZING_NE;
|
||||
else if (south && west)
|
||||
op = META_GRAB_OP_RESIZING_SW;
|
||||
else if (south && east)
|
||||
op = META_GRAB_OP_RESIZING_SE;
|
||||
else if (north)
|
||||
op = META_GRAB_OP_RESIZING_N;
|
||||
else if (west)
|
||||
op = META_GRAB_OP_RESIZING_W;
|
||||
else if (east)
|
||||
op = META_GRAB_OP_RESIZING_E;
|
||||
else if (south)
|
||||
op = META_GRAB_OP_RESIZING_S;
|
||||
else /* Middle region is no-op to avoid user triggering wrong action */
|
||||
op = META_GRAB_OP_NONE;
|
||||
|
||||
if (op != META_GRAB_OP_NONE)
|
||||
meta_display_begin_grab_op (display,
|
||||
window->screen,
|
||||
window,
|
||||
op,
|
||||
TRUE,
|
||||
FALSE,
|
||||
device_event->detail,
|
||||
0,
|
||||
device_event->time,
|
||||
device_event->root_x,
|
||||
device_event->root_y);
|
||||
}
|
||||
}
|
||||
else if (device_event->detail == meta_prefs_get_mouse_button_menu())
|
||||
{
|
||||
if (meta_prefs_get_raise_on_click ())
|
||||
meta_window_raise (window);
|
||||
meta_window_show_menu (window,
|
||||
device_event->root_x,
|
||||
device_event->root_y,
|
||||
device_event->detail,
|
||||
device_event->time);
|
||||
}
|
||||
|
||||
if (!frame_was_receiver && unmodified)
|
||||
{
|
||||
/* This is from our synchronous grab since
|
||||
* it has no modifiers and was on the client window
|
||||
*/
|
||||
|
||||
meta_verbose ("Allowing events time %u\n",
|
||||
(unsigned int)device_event->time);
|
||||
|
||||
XIAllowEvents (display->xdisplay, device_event->deviceid,
|
||||
XIReplayDevice, device_event->time);
|
||||
}
|
||||
|
||||
if (begin_move && window->has_move_func)
|
||||
{
|
||||
meta_display_begin_grab_op (display,
|
||||
window->screen,
|
||||
window,
|
||||
META_GRAB_OP_MOVING,
|
||||
TRUE,
|
||||
FALSE,
|
||||
device_event->detail,
|
||||
0,
|
||||
device_event->time,
|
||||
device_event->root_x,
|
||||
device_event->root_y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XI_ButtonRelease:
|
||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||
break;
|
||||
|
||||
display->overlay_key_only_pressed = FALSE;
|
||||
|
||||
if (display->grab_window == window &&
|
||||
meta_grab_op_is_mouse (display->grab_op))
|
||||
meta_window_handle_mouse_grab_op_xevent (window, device_event);
|
||||
break;
|
||||
case XI_Motion:
|
||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||
break;
|
||||
|
||||
if (display->grab_window == window &&
|
||||
meta_grab_op_is_mouse (display->grab_op))
|
||||
meta_window_handle_mouse_grab_op_xevent (window, device_event);
|
||||
break;
|
||||
case XI_Enter:
|
||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||
break;
|
||||
@ -2504,9 +2763,9 @@ handle_other_xevent (MetaDisplay *display,
|
||||
XShapeEvent *sev = (XShapeEvent*) event;
|
||||
|
||||
if (sev->kind == ShapeBounding)
|
||||
meta_window_update_shape_region_x11 (window);
|
||||
meta_window_x11_update_shape_region (window);
|
||||
else if (sev->kind == ShapeInput)
|
||||
meta_window_update_input_region_x11 (window);
|
||||
meta_window_x11_update_input_region (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2595,7 +2854,7 @@ handle_other_xevent (MetaDisplay *display,
|
||||
|
||||
if (display->grab_op != META_GRAB_OP_NONE &&
|
||||
display->grab_window == window &&
|
||||
((window->frame == NULL) || !window->frame->mapped))
|
||||
window->frame == NULL)
|
||||
meta_display_end_grab_op (display, timestamp);
|
||||
|
||||
if (!frame_was_receiver)
|
||||
@ -2628,15 +2887,15 @@ handle_other_xevent (MetaDisplay *display,
|
||||
if (display->compositor && window == NULL
|
||||
&& meta_display_screen_for_root (display, event->xmap.event))
|
||||
{
|
||||
window = meta_window_new (display, event->xmap.window,
|
||||
FALSE);
|
||||
window = meta_window_x11_new (display, event->xmap.window,
|
||||
FALSE, META_COMP_EFFECT_CREATE);
|
||||
}
|
||||
break;
|
||||
case MapRequest:
|
||||
if (window == NULL)
|
||||
{
|
||||
window = meta_window_new (display, event->xmaprequest.window,
|
||||
FALSE);
|
||||
window = meta_window_x11_new (display, event->xmaprequest.window,
|
||||
FALSE, META_COMP_EFFECT_CREATE);
|
||||
}
|
||||
/* if frame was receiver it's some malicious send event or something */
|
||||
else if (!frame_was_receiver && window)
|
||||
@ -2715,7 +2974,7 @@ handle_other_xevent (MetaDisplay *display,
|
||||
else
|
||||
{
|
||||
if (!frame_was_receiver)
|
||||
meta_window_configure_request (window, event);
|
||||
meta_window_x11_configure_request (window, event);
|
||||
}
|
||||
break;
|
||||
case GravityNotify:
|
||||
@ -2732,9 +2991,9 @@ handle_other_xevent (MetaDisplay *display,
|
||||
MetaScreen *screen;
|
||||
|
||||
if (window && !frame_was_receiver)
|
||||
meta_window_property_notify (window, event);
|
||||
meta_window_x11_property_notify (window, event);
|
||||
else if (property_for_window && !frame_was_receiver)
|
||||
meta_window_property_notify (property_for_window, event);
|
||||
meta_window_x11_property_notify (property_for_window, event);
|
||||
|
||||
group = meta_display_lookup_group (display,
|
||||
event->xproperty.window);
|
||||
@ -2805,7 +3064,7 @@ handle_other_xevent (MetaDisplay *display,
|
||||
if (window)
|
||||
{
|
||||
if (!frame_was_receiver)
|
||||
meta_window_client_message (window, event);
|
||||
meta_window_x11_client_message (window, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2887,7 +3146,9 @@ handle_other_xevent (MetaDisplay *display,
|
||||
|
||||
if ((Atom)event->xclient.data.l[0] == display->atom__NET_WM_PING)
|
||||
{
|
||||
process_pong_message (display, event);
|
||||
guint32 timestamp = event->xclient.data.l[1];
|
||||
|
||||
meta_display_pong_for_serial (display, timestamp);
|
||||
|
||||
/* We don't want ping reply events going into
|
||||
* the GTK+ event loop because gtk+ will treat
|
||||
@ -3013,9 +3274,10 @@ meta_display_handle_xevent (MetaDisplay *display,
|
||||
display->current_time = event_get_time (display, event);
|
||||
display->monitor_cache_invalidated = TRUE;
|
||||
|
||||
if (event->xany.serial > display->focus_serial &&
|
||||
if (display->focused_by_us &&
|
||||
event->xany.serial > display->focus_serial &&
|
||||
display->focus_window &&
|
||||
display->focus_window->xwindow != display->server_focus_window)
|
||||
!window_has_xwindow (display->focus_window, display->server_focus_window))
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed\n",
|
||||
display->focus_window->desc);
|
||||
@ -3023,7 +3285,8 @@ meta_display_handle_xevent (MetaDisplay *display,
|
||||
META_FOCUS_NONE,
|
||||
meta_display_lookup_x_window (display, display->server_focus_window),
|
||||
display->server_focus_window,
|
||||
display->server_focus_serial);
|
||||
display->server_focus_serial,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
screen = meta_display_screen_for_root (display, event->xany.window);
|
||||
@ -3938,6 +4201,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
|
||||
{
|
||||
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
|
||||
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
||||
MetaCursor cursor = meta_cursor_for_grab_op (op);
|
||||
|
||||
XISetMask (mask.mask, XI_ButtonPress);
|
||||
XISetMask (mask.mask, XI_ButtonRelease);
|
||||
@ -3952,7 +4216,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
grab_xwindow,
|
||||
timestamp,
|
||||
None,
|
||||
meta_display_create_x_cursor (display, cursor),
|
||||
XIGrabModeAsync, XIGrabModeAsync,
|
||||
False, /* owner_events */
|
||||
&mask) == Success)
|
||||
@ -3971,7 +4235,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
|
||||
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
meta_cursor_tracker_set_grab_cursor (screen->cursor_tracker, meta_cursor_for_grab_op (op));
|
||||
meta_cursor_tracker_set_grab_cursor (screen->cursor_tracker, cursor);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -4034,7 +4298,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
* key grab on the RootWindow.
|
||||
*/
|
||||
if (grab_window)
|
||||
grab_xwindow = grab_window->frame ? grab_window->frame->xwindow : grab_window->xwindow;
|
||||
grab_xwindow = meta_window_get_toplevel_xwindow (grab_window);
|
||||
else
|
||||
grab_xwindow = screen->xroot;
|
||||
|
||||
@ -4667,24 +4931,20 @@ meta_set_syncing (gboolean setting)
|
||||
static gboolean
|
||||
meta_display_ping_timeout (gpointer data)
|
||||
{
|
||||
MetaPingData *ping_data;
|
||||
|
||||
ping_data = data;
|
||||
MetaPingData *ping_data = data;
|
||||
MetaDisplay *display = ping_data->window->display;
|
||||
|
||||
ping_data->ping_timeout_id = 0;
|
||||
|
||||
meta_topic (META_DEBUG_PING,
|
||||
"Ping %u on window %lx timed out\n",
|
||||
ping_data->timestamp, ping_data->xwindow);
|
||||
|
||||
(* ping_data->ping_timeout_func) (ping_data->display, ping_data->xwindow,
|
||||
ping_data->timestamp, ping_data->user_data);
|
||||
"Ping %u on window %s timed out\n",
|
||||
ping_data->timestamp, ping_data->window->desc);
|
||||
|
||||
ping_data->display->pending_pings =
|
||||
g_slist_remove (ping_data->display->pending_pings,
|
||||
ping_data);
|
||||
(* ping_data->ping_timeout_func) (ping_data->window, ping_data->timestamp, ping_data->user_data);
|
||||
|
||||
display->pending_pings = g_slist_remove (display->pending_pings, ping_data);
|
||||
ping_data_free (ping_data);
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -4708,19 +4968,15 @@ meta_display_ping_timeout (gpointer data)
|
||||
* we call the "got a response" callback immediately and return.
|
||||
* This function returns straight away after setting things up;
|
||||
* the callbacks will be called from the event loop.
|
||||
*
|
||||
* FIXME: This should probably be a method on windows, rather than displays
|
||||
* for one of their windows.
|
||||
*
|
||||
*/
|
||||
void
|
||||
meta_display_ping_window (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
meta_display_ping_window (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
MetaWindowPingFunc ping_reply_func,
|
||||
MetaWindowPingFunc ping_timeout_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaDisplay *display = window->display;
|
||||
MetaPingData *ping_data;
|
||||
|
||||
if (timestamp == CurrentTime)
|
||||
@ -4729,17 +4985,16 @@ meta_display_ping_window (MetaDisplay *display,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window->net_wm_ping)
|
||||
if (!window->can_ping)
|
||||
{
|
||||
if (ping_reply_func)
|
||||
(* ping_reply_func) (display, window->xwindow, timestamp, user_data);
|
||||
(* ping_reply_func) (window, timestamp, user_data);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ping_data = g_new (MetaPingData, 1);
|
||||
ping_data->display = display;
|
||||
ping_data->xwindow = window->xwindow;
|
||||
ping_data->window = window;
|
||||
ping_data->timestamp = timestamp;
|
||||
ping_data->ping_reply_func = ping_reply_func;
|
||||
ping_data->ping_timeout_func = ping_timeout_func;
|
||||
@ -4747,15 +5002,19 @@ meta_display_ping_window (MetaDisplay *display,
|
||||
ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
|
||||
meta_display_ping_timeout,
|
||||
ping_data);
|
||||
|
||||
|
||||
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
|
||||
|
||||
meta_topic (META_DEBUG_PING,
|
||||
"Sending ping with timestamp %u to window %s\n",
|
||||
timestamp, window->desc);
|
||||
meta_window_send_icccm_message (window,
|
||||
display->atom__NET_WM_PING,
|
||||
timestamp);
|
||||
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
meta_window_send_icccm_message (window,
|
||||
display->atom__NET_WM_PING,
|
||||
timestamp);
|
||||
else
|
||||
meta_wayland_surface_ping (window->surface, timestamp);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4819,34 +5078,30 @@ process_request_frame_extents (MetaDisplay *display,
|
||||
}
|
||||
|
||||
/**
|
||||
* process_pong_message:
|
||||
* meta_display_pong_for_serial:
|
||||
* @display: the display we got the pong from
|
||||
* @event: the #XEvent which is a pong; we can tell which
|
||||
* ping it corresponds to because it bears the
|
||||
* same timestamp.
|
||||
* @serial: the serial in the pong repsonse
|
||||
*
|
||||
* Process the pong (the response message) from the ping we sent
|
||||
* to the window. This involves removing the timeout, calling the
|
||||
* reply handler function, and freeing memory.
|
||||
*/
|
||||
static void
|
||||
process_pong_message (MetaDisplay *display,
|
||||
XEvent *event)
|
||||
void
|
||||
meta_display_pong_for_serial (MetaDisplay *display,
|
||||
guint32 serial)
|
||||
{
|
||||
GSList *tmp;
|
||||
guint32 timestamp = event->xclient.data.l[1];
|
||||
|
||||
meta_topic (META_DEBUG_PING, "Received a pong with timestamp %u\n",
|
||||
timestamp);
|
||||
|
||||
meta_topic (META_DEBUG_PING, "Received a pong with serial %u\n", serial);
|
||||
|
||||
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
||||
{
|
||||
MetaPingData *ping_data = tmp->data;
|
||||
|
||||
if (timestamp == ping_data->timestamp)
|
||||
|
||||
if (serial == ping_data->timestamp)
|
||||
{
|
||||
meta_topic (META_DEBUG_PING,
|
||||
"Matching ping found for pong %u\n",
|
||||
"Matching ping found for pong %u\n",
|
||||
ping_data->timestamp);
|
||||
|
||||
/* Remove the ping data from the list */
|
||||
@ -4859,13 +5114,12 @@ process_pong_message (MetaDisplay *display,
|
||||
g_source_remove (ping_data->ping_timeout_id);
|
||||
ping_data->ping_timeout_id = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Call callback */
|
||||
(* ping_data->ping_reply_func) (display,
|
||||
ping_data->xwindow,
|
||||
ping_data->timestamp,
|
||||
(* ping_data->ping_reply_func) (ping_data->window,
|
||||
ping_data->timestamp,
|
||||
ping_data->user_data);
|
||||
|
||||
|
||||
ping_data_free (ping_data);
|
||||
|
||||
break;
|
||||
@ -4873,36 +5127,6 @@ process_pong_message (MetaDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_window_has_pending_pings:
|
||||
* @display: The #MetaDisplay of the window.
|
||||
* @window: The #MetaWindow whose pings we want to know about.
|
||||
*
|
||||
* Finds whether a window has any pings waiting on it.
|
||||
*
|
||||
* FIXME: This should probably be a method on windows, rather than displays
|
||||
* for one of their windows.
|
||||
*
|
||||
* Returns: %TRUE if there is at least one ping which has been sent
|
||||
* to the window without getting a response; %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
meta_display_window_has_pending_pings (MetaDisplay *display,
|
||||
MetaWindow *window)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
for (tmp = display->pending_pings; tmp; tmp = tmp->next)
|
||||
{
|
||||
MetaPingData *ping_data = tmp->data;
|
||||
|
||||
if (ping_data->xwindow == window->xwindow)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MetaGroup*
|
||||
get_focussed_group (MetaDisplay *display)
|
||||
{
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_EDGE_RESISTANCE_H
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
@ -52,9 +50,6 @@ meta_window_ensure_frame (MetaWindow *window)
|
||||
if (window->frame)
|
||||
return;
|
||||
|
||||
/* See comment below for why this is required. */
|
||||
meta_display_grab (window->display);
|
||||
|
||||
frame = g_new (MetaFrame, 1);
|
||||
|
||||
frame->window = window;
|
||||
@ -67,7 +62,6 @@ meta_window_ensure_frame (MetaWindow *window)
|
||||
frame->right_width = 0;
|
||||
frame->current_cursor = 0;
|
||||
|
||||
frame->mapped = FALSE;
|
||||
frame->is_flashing = FALSE;
|
||||
frame->borders_cached = FALSE;
|
||||
|
||||
@ -120,14 +114,6 @@ meta_window_ensure_frame (MetaWindow *window)
|
||||
|
||||
meta_display_register_x_window (window->display, &frame->xwindow, window);
|
||||
|
||||
/* Reparent the client window; it may be destroyed,
|
||||
* thus the error trap. We'll get a destroy notify later
|
||||
* and free everything. Comment in FVWM source code says
|
||||
* we need a server grab or the child can get its MapNotify
|
||||
* before we've finished reparenting and getting the decoration
|
||||
* window onscreen, so ensure_frame must be called with
|
||||
* a grab.
|
||||
*/
|
||||
meta_error_trap_push (window->display);
|
||||
if (window->mapped)
|
||||
{
|
||||
@ -171,7 +157,7 @@ meta_window_ensure_frame (MetaWindow *window)
|
||||
/* Move keybindings to frame instead of window */
|
||||
meta_window_grab_keys (window);
|
||||
|
||||
meta_display_ungrab (window->display);
|
||||
meta_ui_map_frame (frame->window->screen->ui, frame->xwindow);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_FRAME_PRIVATE_H
|
||||
@ -49,7 +47,6 @@ struct _MetaFrame
|
||||
int right_width;
|
||||
int bottom_height;
|
||||
|
||||
guint mapped : 1;
|
||||
guint need_reapply_frame_shape : 1;
|
||||
guint is_flashing : 1; /* used by the visual bell flash */
|
||||
guint borders_cached : 1;
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_GROUP_PRIVATE_H
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_GROUP_PROPS_H
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_ICON_CACHE_H
|
||||
|
@ -21,9 +21,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_KEYBINDINGS_PRIVATE_H
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -30,7 +28,6 @@
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#define _SVID_SOURCE /* for putenv() */
|
||||
|
||||
#include <config.h>
|
||||
#include "keybindings-private.h"
|
||||
@ -41,8 +38,10 @@
|
||||
#include "ui.h"
|
||||
#include "frame.h"
|
||||
#include "place.h"
|
||||
#include "screen-private.h"
|
||||
#include <meta/prefs.h>
|
||||
#include "util-private.h"
|
||||
#include "meta-wayland-private.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <string.h>
|
||||
@ -53,10 +52,6 @@
|
||||
#include <X11/XKBlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "meta-wayland-private.h"
|
||||
#endif
|
||||
|
||||
#define SCHEMA_COMMON_KEYBINDINGS "org.gnome.desktop.wm.keybindings"
|
||||
#define SCHEMA_MUTTER_KEYBINDINGS "org.gnome.mutter.keybindings"
|
||||
#define SCHEMA_MUTTER_WAYLAND_KEYBINDINGS "org.gnome.mutter.wayland.keybindings"
|
||||
@ -1277,7 +1272,7 @@ meta_window_grab_keys (MetaWindow *window)
|
||||
}
|
||||
|
||||
meta_window_change_keygrabs (window,
|
||||
window->frame ? window->frame->xwindow : window->xwindow,
|
||||
meta_window_get_toplevel_xwindow (window),
|
||||
TRUE);
|
||||
|
||||
window->keys_grabbed = TRUE;
|
||||
@ -1584,7 +1579,7 @@ meta_window_grab_all_keys (MetaWindow *window,
|
||||
window->desc);
|
||||
meta_window_focus (window, timestamp);
|
||||
|
||||
grabwindow = window->frame ? window->frame->xwindow : window->xwindow;
|
||||
grabwindow = meta_window_get_toplevel_xwindow (window);
|
||||
|
||||
meta_topic (META_DEBUG_KEYBINDINGS,
|
||||
"Grabbing all keys on window %s\n", window->desc);
|
||||
@ -1862,7 +1857,7 @@ process_event (MetaKeyBinding *bindings,
|
||||
MetaKeyHandler *handler = bindings[i].handler;
|
||||
|
||||
if ((!on_window && handler->flags & META_KEY_BINDING_PER_WINDOW) ||
|
||||
bindings[i].keycode != event->keyval ||
|
||||
(event->keyval != bindings[i].keysym) ||
|
||||
(event->modifier_state != bindings[i].mask) ||
|
||||
meta_compositor_filter_keybinding (display->compositor, screen, &bindings[i]))
|
||||
continue;
|
||||
@ -2001,7 +1996,7 @@ process_iso_next_group (MetaDisplay *display,
|
||||
gboolean activate;
|
||||
int i;
|
||||
|
||||
if (event->type != CLUTTER_KEY_RELEASE)
|
||||
if (event->type == CLUTTER_KEY_RELEASE)
|
||||
return FALSE;
|
||||
|
||||
activate = FALSE;
|
||||
@ -3929,6 +3924,26 @@ handle_move_to_workspace (MetaDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_move_to_monitor (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
MetaWindow *window,
|
||||
ClutterKeyEvent *event,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
gint which = binding->handler->data;
|
||||
const MetaMonitorInfo *current, *new;
|
||||
|
||||
current = meta_screen_get_monitor_for_window (screen, window);
|
||||
new = meta_screen_get_monitor_neighbor (screen, current->number, which);
|
||||
|
||||
if (new == NULL)
|
||||
return;
|
||||
|
||||
meta_window_move_to_monitor (window, new->number);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_raise_or_lower (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
@ -4061,7 +4076,6 @@ handle_set_spew_mark (MetaDisplay *display,
|
||||
meta_verbose ("-- MARK MARK MARK MARK --\n");
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
static void
|
||||
handle_switch_vt (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
@ -4070,30 +4084,16 @@ handle_switch_vt (MetaDisplay *display,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
gint vt = binding->handler->data;
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaLauncher *launcher;
|
||||
gint vt = binding->handler->data;
|
||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
||||
GError *error = NULL;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
launcher = meta_wayland_compositor_get_launcher (compositor);
|
||||
|
||||
if (launcher)
|
||||
{
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
if (!meta_launcher_activate_vt (launcher, vt, &error))
|
||||
{
|
||||
g_warning ("Failed to switch VT: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_debug ("Ignoring VT switch keybinding, not running as VT manager");
|
||||
}
|
||||
if (!meta_wayland_compositor_activate_vt (compositor, vt, &error))
|
||||
{
|
||||
g_warning ("Failed to switch VT: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* meta_keybindings_set_custom_handler:
|
||||
@ -4398,7 +4398,6 @@ init_builtin_key_bindings (MetaDisplay *display)
|
||||
META_KEYBINDING_ACTION_SET_SPEW_MARK,
|
||||
handle_set_spew_mark, 0);
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
add_builtin_keybinding (display,
|
||||
@ -4450,7 +4449,6 @@ init_builtin_key_bindings (MetaDisplay *display)
|
||||
META_KEYBINDING_ACTION_NONE,
|
||||
handle_switch_vt, 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef REVERSES_AND_REVERSED
|
||||
|
||||
@ -4670,6 +4668,34 @@ init_builtin_key_bindings (MetaDisplay *display)
|
||||
META_KEYBINDING_ACTION_MOVE_TO_WORKSPACE_DOWN,
|
||||
handle_move_to_workspace, META_MOTION_DOWN);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"move-to-monitor-left",
|
||||
common_keybindings,
|
||||
META_KEY_BINDING_PER_WINDOW,
|
||||
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_LEFT,
|
||||
handle_move_to_monitor, META_SCREEN_LEFT);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"move-to-monitor-right",
|
||||
common_keybindings,
|
||||
META_KEY_BINDING_PER_WINDOW,
|
||||
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_RIGHT,
|
||||
handle_move_to_monitor, META_SCREEN_RIGHT);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"move-to-monitor-down",
|
||||
common_keybindings,
|
||||
META_KEY_BINDING_PER_WINDOW,
|
||||
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_DOWN,
|
||||
handle_move_to_monitor, META_SCREEN_DOWN);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"move-to-monitor-up",
|
||||
common_keybindings,
|
||||
META_KEY_BINDING_PER_WINDOW,
|
||||
META_KEYBINDING_ACTION_MOVE_TO_MONITOR_UP,
|
||||
handle_move_to_monitor, META_SCREEN_UP);
|
||||
|
||||
add_builtin_keybinding (display,
|
||||
"raise-or-lower",
|
||||
common_keybindings,
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -256,19 +254,8 @@ meta_get_option_context (void)
|
||||
bindtextdomain (GETTEXT_PACKAGE, MUTTER_LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
||||
/* We must set the windowing backend here, because Clutter creates the backend
|
||||
object when the first call is made.
|
||||
|
||||
We consider running from mutter-launch equivalent to running from bare metal.
|
||||
*/
|
||||
if (getenv ("WESTON_LAUNCHER_SOCK"))
|
||||
clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL);
|
||||
|
||||
ctx = g_option_context_new (NULL);
|
||||
g_option_context_add_main_entries (ctx, meta_options, GETTEXT_PACKAGE);
|
||||
g_option_context_add_group (ctx, clutter_get_option_group_without_init ());
|
||||
g_option_context_add_group (ctx, cogl_get_option_group ());
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@ -304,8 +291,12 @@ event_dispatch (GSource *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterEvent *event = clutter_event_get ();
|
||||
|
||||
if (event)
|
||||
clutter_do_event (event);
|
||||
{
|
||||
clutter_do_event (event);
|
||||
clutter_event_free (event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -343,16 +334,17 @@ meta_clutter_init (void)
|
||||
* also is %NULL, use the default - :0.0
|
||||
*/
|
||||
static void
|
||||
meta_select_display (gchar *display_name)
|
||||
meta_select_display (char *display_arg)
|
||||
{
|
||||
gchar *envVar = "";
|
||||
const char *display_name;
|
||||
|
||||
if (display_arg)
|
||||
display_name = (const char *) display_arg;
|
||||
else
|
||||
display_name = g_getenv ("MUTTER_DISPLAY");
|
||||
|
||||
if (display_name)
|
||||
envVar = g_strconcat ("DISPLAY=", display_name, NULL);
|
||||
else if (g_getenv ("MUTTER_DISPLAY"))
|
||||
envVar = g_strconcat ("DISPLAY=",
|
||||
g_getenv ("MUTTER_DISPLAY"), NULL);
|
||||
/* DO NOT FREE envVar, putenv() sucks */
|
||||
putenv (envVar);
|
||||
g_setenv ("DISPLAY", display_name, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -387,7 +379,8 @@ meta_init (void)
|
||||
{
|
||||
struct sigaction act;
|
||||
sigset_t empty_mask;
|
||||
|
||||
ClutterSettings *clutter_settings;
|
||||
|
||||
sigemptyset (&empty_mask);
|
||||
act.sa_handler = SIG_IGN;
|
||||
act.sa_mask = empty_mask;
|
||||
@ -408,6 +401,10 @@ meta_init (void)
|
||||
if (g_getenv ("MUTTER_DEBUG"))
|
||||
meta_set_debugging (TRUE);
|
||||
|
||||
/* We consider running from mutter-launch equivalent to running from bare metal. */
|
||||
if (getenv ("WESTON_LAUNCHER_SOCK"))
|
||||
clutter_set_windowing_backend (CLUTTER_WINDOWING_EGL);
|
||||
|
||||
meta_set_is_wayland_compositor (opt_wayland);
|
||||
|
||||
if (g_get_home_dir ())
|
||||
@ -439,7 +436,7 @@ meta_init (void)
|
||||
meta_fatal ("Can't specify both SM save file and SM client id\n");
|
||||
|
||||
meta_main_loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
|
||||
meta_ui_init ();
|
||||
|
||||
/* If we are running with wayland then we don't wait until we have
|
||||
@ -453,6 +450,13 @@ meta_init (void)
|
||||
*/
|
||||
meta_clutter_init ();
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: We cannot handle high dpi scaling yet, so fix the scale to 1
|
||||
* for now.
|
||||
*/
|
||||
clutter_settings = clutter_settings_get_default ();
|
||||
g_object_set (clutter_settings, "window-scaling-factor", 1, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Giovanni Campagna <gcampagn@redhat.com>
|
||||
*/
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Giovanni Campagna <gcampagn@redhat.com>
|
||||
*/
|
||||
@ -124,6 +122,7 @@ static guint signals[LAST_SIGNAL];
|
||||
static void meta_cursor_tracker_set_crtc_has_hw_cursor (MetaCursorTracker *tracker,
|
||||
MetaCRTC *crtc,
|
||||
gboolean has_hw_cursor);
|
||||
static void sync_cursor (MetaCursorTracker *tracker);
|
||||
|
||||
static MetaCursorReference *
|
||||
meta_cursor_reference_ref (MetaCursorReference *self)
|
||||
@ -306,7 +305,6 @@ meta_cursor_reference_from_theme (MetaCursorTracker *tracker,
|
||||
self->texture = cogl_texture_2d_new_from_data (cogl_context,
|
||||
width, height,
|
||||
cogl_format,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
rowstride,
|
||||
(uint8_t*)image->pixels,
|
||||
NULL);
|
||||
@ -366,7 +364,7 @@ meta_cursor_reference_from_buffer (MetaCursorTracker *tracker,
|
||||
ClutterBackend *backend;
|
||||
CoglContext *cogl_context;
|
||||
MetaCursorReference *self;
|
||||
CoglPixelFormat cogl_format, cogl_internal_format;
|
||||
CoglPixelFormat cogl_format;
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
uint32_t gbm_format;
|
||||
|
||||
@ -390,37 +388,31 @@ meta_cursor_reference_from_buffer (MetaCursorTracker *tracker,
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
|
||||
cogl_internal_format = COGL_PIXEL_FORMAT_ANY;
|
||||
gbm_format = GBM_FORMAT_ARGB8888;
|
||||
break;
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888;
|
||||
cogl_internal_format = COGL_PIXEL_FORMAT_RGB_888;
|
||||
gbm_format = GBM_FORMAT_XRGB8888;
|
||||
break;
|
||||
#else
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
cogl_format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
|
||||
cogl_internal_format = COGL_PIXEL_FORMAT_ANY;
|
||||
gbm_format = GBM_FORMAT_ARGB8888;
|
||||
break;
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
cogl_format = COGL_PIXEL_FORMAT_BGRA_8888;
|
||||
cogl_internal_format = COGL_PIXEL_FORMAT_BGR_888;
|
||||
gbm_format = GBM_FORMAT_XRGB8888;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
g_warn_if_reached ();
|
||||
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888;
|
||||
cogl_internal_format = COGL_PIXEL_FORMAT_ANY;
|
||||
gbm_format = GBM_FORMAT_ARGB8888;
|
||||
}
|
||||
|
||||
self->texture = cogl_texture_2d_new_from_data (cogl_context,
|
||||
width, height,
|
||||
cogl_format,
|
||||
cogl_internal_format,
|
||||
rowstride,
|
||||
wl_shm_buffer_get_data (shm_buffer),
|
||||
NULL);
|
||||
@ -476,47 +468,10 @@ meta_cursor_reference_from_buffer (MetaCursorTracker *tracker,
|
||||
|
||||
if (tracker->gbm)
|
||||
{
|
||||
cogl_format = cogl_texture_get_format (COGL_TEXTURE (self->texture));
|
||||
switch (cogl_format)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
|
||||
case COGL_PIXEL_FORMAT_ARGB_8888:
|
||||
gbm_format = GBM_FORMAT_BGRA8888;
|
||||
break;
|
||||
case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
|
||||
case COGL_PIXEL_FORMAT_BGRA_8888:
|
||||
break;
|
||||
case COGL_PIXEL_FORMAT_RGB_888:
|
||||
break;
|
||||
#else
|
||||
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
|
||||
case COGL_PIXEL_FORMAT_ARGB_8888:
|
||||
gbm_format = GBM_FORMAT_ARGB8888;
|
||||
break;
|
||||
case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
|
||||
case COGL_PIXEL_FORMAT_BGRA_8888:
|
||||
gbm_format = GBM_FORMAT_BGRA8888;
|
||||
break;
|
||||
case COGL_PIXEL_FORMAT_RGB_888:
|
||||
gbm_format = GBM_FORMAT_RGB888;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
meta_warning ("Unknown cogl format %d\n", cogl_format);
|
||||
return self;
|
||||
}
|
||||
|
||||
if (gbm_device_is_format_supported (tracker->gbm, gbm_format,
|
||||
GBM_BO_USE_CURSOR_64X64))
|
||||
{
|
||||
self->bo = gbm_bo_import (tracker->gbm, GBM_BO_IMPORT_WL_BUFFER,
|
||||
buffer, GBM_BO_USE_CURSOR_64X64);
|
||||
if (!self->bo)
|
||||
meta_warning ("Importing HW cursor from wl_buffer failed\n");
|
||||
}
|
||||
else
|
||||
meta_warning ("HW cursor for format %d not supported\n", gbm_format);
|
||||
self->bo = gbm_bo_import (tracker->gbm, GBM_BO_IMPORT_WL_BUFFER,
|
||||
buffer, GBM_BO_USE_CURSOR_64X64);
|
||||
if (!self->bo)
|
||||
meta_warning ("Importing HW cursor from wl_buffer failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,9 +570,14 @@ make_wayland_cursor_tracker (MetaScreen *screen)
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
compositor->seat->cursor_tracker = self;
|
||||
|
||||
self->drm_fd = compositor->drm_fd;
|
||||
if (self->drm_fd >= 0)
|
||||
self->gbm = gbm_create_device (compositor->drm_fd);
|
||||
#if defined(CLUTTER_WINDOWING_EGL)
|
||||
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
|
||||
{
|
||||
CoglRenderer *cogl_renderer = cogl_display_get_renderer (cogl_context_get_display (ctx));
|
||||
self->drm_fd = cogl_kms_renderer_get_kms_fd (cogl_renderer);
|
||||
self->gbm = gbm_create_device (self->drm_fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
monitors = meta_monitor_manager_get ();
|
||||
g_signal_connect_object (monitors, "monitors-changed",
|
||||
@ -655,11 +615,9 @@ meta_cursor_tracker_get_for_screen (MetaScreen *screen)
|
||||
if (screen->cursor_tracker)
|
||||
return screen->cursor_tracker;
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
if (meta_is_wayland_compositor ())
|
||||
self = make_wayland_cursor_tracker (screen);
|
||||
else
|
||||
#endif
|
||||
self = make_x11_cursor_tracker (screen);
|
||||
|
||||
screen->cursor_tracker = self;
|
||||
@ -675,6 +633,7 @@ set_window_cursor (MetaCursorTracker *tracker,
|
||||
if (cursor)
|
||||
tracker->window_cursor = meta_cursor_reference_ref (cursor);
|
||||
tracker->has_window_cursor = has_cursor;
|
||||
sync_cursor (tracker);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -694,7 +653,6 @@ meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
||||
return FALSE;
|
||||
|
||||
set_window_cursor (tracker, FALSE, NULL);
|
||||
g_signal_emit (tracker, signals[CURSOR_CHANGED], 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -746,7 +704,6 @@ ensure_xfixes_cursor (MetaCursorTracker *tracker)
|
||||
cursor_image->width,
|
||||
cursor_image->height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
cursor_image->width * 4, /* stride */
|
||||
cursor_data,
|
||||
NULL);
|
||||
@ -839,6 +796,7 @@ meta_cursor_tracker_set_grab_cursor (MetaCursorTracker *tracker,
|
||||
g_clear_pointer (&tracker->grab_cursor, meta_cursor_reference_unref);
|
||||
if (cursor != META_CURSOR_DEFAULT)
|
||||
tracker->grab_cursor = ensure_wayland_cursor (tracker, cursor);
|
||||
sync_cursor (tracker);
|
||||
}
|
||||
|
||||
void
|
||||
@ -882,6 +840,7 @@ meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
|
||||
{
|
||||
g_clear_pointer (&tracker->root_cursor, meta_cursor_reference_unref);
|
||||
tracker->root_cursor = ensure_wayland_cursor (tracker, cursor);
|
||||
sync_cursor (tracker);
|
||||
}
|
||||
}
|
||||
|
||||
@ -966,12 +925,15 @@ sync_displayed_cursor (MetaCursorTracker *tracker)
|
||||
if (displayed_cursor)
|
||||
tracker->displayed_cursor = meta_cursor_reference_ref (displayed_cursor);
|
||||
|
||||
if (displayed_cursor)
|
||||
cogl_pipeline_set_layer_texture (tracker->pipeline, 0, COGL_TEXTURE (displayed_cursor->texture));
|
||||
else
|
||||
cogl_pipeline_set_layer_texture (tracker->pipeline, 0, NULL);
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
if (displayed_cursor)
|
||||
cogl_pipeline_set_layer_texture (tracker->pipeline, 0, COGL_TEXTURE (displayed_cursor->texture));
|
||||
else
|
||||
cogl_pipeline_set_layer_texture (tracker->pipeline, 0, NULL);
|
||||
|
||||
update_hw_cursor (tracker);
|
||||
update_hw_cursor (tracker);
|
||||
}
|
||||
|
||||
g_signal_emit (tracker, signals[CURSOR_CHANGED], 0);
|
||||
}
|
||||
@ -1030,10 +992,13 @@ sync_cursor (MetaCursorTracker *tracker)
|
||||
tracker->current_rect.height = 0;
|
||||
}
|
||||
|
||||
if (tracker->has_hw_cursor)
|
||||
move_hw_cursor (tracker);
|
||||
else
|
||||
meta_cursor_tracker_queue_redraw (tracker);
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
if (tracker->has_hw_cursor)
|
||||
move_hw_cursor (tracker);
|
||||
else
|
||||
meta_cursor_tracker_queue_redraw (tracker);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Adapted from gnome-session/gnome-session/gs-idle-monitor.c and
|
||||
* from gnome-desktop/libgnome-desktop/gnome-idle-monitor.c
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Adapted from gnome-session/gnome-session/gs-idle-monitor.c and
|
||||
* from gnome-desktop/libgnome-desktop/gnome-idle-monitor.c
|
||||
@ -537,7 +535,7 @@ make_watch (MetaIdleMonitor *monitor,
|
||||
watch->timeout_source = source;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (monitor->user_active_alarm != None)
|
||||
{
|
||||
if (timeout_msec != 0)
|
||||
{
|
||||
@ -949,6 +947,8 @@ on_bus_acquired (GDBusConnection *connection,
|
||||
for (iter = devices; iter; iter = iter->next)
|
||||
on_device_added (device_manager, iter->data, manager);
|
||||
|
||||
g_slist_free (devices);
|
||||
|
||||
g_signal_connect_object (device_manager, "device-added",
|
||||
G_CALLBACK (on_device_added), manager, 0);
|
||||
g_signal_connect_object (device_manager, "device-removed",
|
||||
|
@ -13,9 +13,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This file is shared between mutter (src/core/meta-xrandr-shared.h)
|
||||
|
@ -20,9 +20,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -111,8 +111,7 @@ make_output_name (drmModeConnector *connector)
|
||||
};
|
||||
const char *connector_type_name;
|
||||
|
||||
if (connector->connector_type >= 0 &&
|
||||
connector->connector_type < G_N_ELEMENTS (connector_type_names))
|
||||
if (connector->connector_type < G_N_ELEMENTS (connector_type_names))
|
||||
connector_type_name = connector_type_names[connector->connector_type];
|
||||
else
|
||||
connector_type_name = "unknown";
|
||||
|
@ -29,9 +29,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_MONITOR_PRIVATE_H
|
||||
@ -44,9 +42,7 @@
|
||||
#include <meta/screen.h>
|
||||
#include "stack-tracker.h"
|
||||
#include "ui.h"
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include <wayland-server.h>
|
||||
#endif
|
||||
#include "meta-xrandr-shared.h"
|
||||
|
||||
#include "meta-dbus-xrandr.h"
|
||||
@ -56,19 +52,6 @@ typedef struct _MetaMonitorManager MetaMonitorManager;
|
||||
typedef struct _MetaMonitorConfigClass MetaMonitorConfigClass;
|
||||
typedef struct _MetaMonitorConfig MetaMonitorConfig;
|
||||
|
||||
#ifndef HAVE_WAYLAND
|
||||
enum wl_output_transform {
|
||||
WL_OUTPUT_TRANSFORM_NORMAL,
|
||||
WL_OUTPUT_TRANSFORM_90,
|
||||
WL_OUTPUT_TRANSFORM_180,
|
||||
WL_OUTPUT_TRANSFORM_270,
|
||||
WL_OUTPUT_TRANSFORM_FLIPPED,
|
||||
WL_OUTPUT_TRANSFORM_FLIPPED_90,
|
||||
WL_OUTPUT_TRANSFORM_FLIPPED_180,
|
||||
WL_OUTPUT_TRANSFORM_FLIPPED_270
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct _MetaOutput MetaOutput;
|
||||
typedef struct _MetaCRTC MetaCRTC;
|
||||
typedef struct _MetaMonitorMode MetaMonitorMode;
|
||||
|
@ -20,9 +20,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -453,8 +451,10 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
|
||||
XRRFreeCrtcInfo (crtc);
|
||||
}
|
||||
|
||||
meta_error_trap_push (meta_get_display ());
|
||||
primary_output = XRRGetOutputPrimary (manager_xrandr->xdisplay,
|
||||
DefaultRootWindow (manager_xrandr->xdisplay));
|
||||
meta_error_trap_pop (meta_get_display ());
|
||||
|
||||
n_actual_outputs = 0;
|
||||
for (i = 0; i < (unsigned)resources->noutput; i++)
|
||||
@ -691,10 +691,11 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
||||
unsigned int n_outputs)
|
||||
{
|
||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
unsigned i;
|
||||
int width, height, width_mm, height_mm;
|
||||
|
||||
meta_display_grab (meta_get_display ());
|
||||
meta_display_grab (display);
|
||||
|
||||
/* First compute the new size of the screen (framebuffer) */
|
||||
width = 0; height = 0;
|
||||
@ -788,10 +789,10 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
||||
*/
|
||||
width_mm = (width / DPI_FALLBACK) * 25.4 + 0.5;
|
||||
height_mm = (height / DPI_FALLBACK) * 25.4 + 0.5;
|
||||
meta_error_trap_push (meta_get_display ());
|
||||
meta_error_trap_push (display);
|
||||
XRRSetScreenSize (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay),
|
||||
width, height, width_mm, height_mm);
|
||||
meta_error_trap_pop (meta_get_display ());
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
for (i = 0; i < n_crtcs; i++)
|
||||
{
|
||||
@ -848,7 +849,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
||||
goto next;
|
||||
}
|
||||
|
||||
meta_error_trap_push (meta_get_display ());
|
||||
meta_error_trap_push (display);
|
||||
ok = XRRSetCrtcConfig (manager_xrandr->xdisplay,
|
||||
manager_xrandr->resources,
|
||||
(XID)crtc->crtc_id,
|
||||
@ -857,7 +858,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
||||
(XID)mode->mode_id,
|
||||
wl_transform_to_xrandr (crtc_info->transform),
|
||||
outputs, n_outputs);
|
||||
meta_error_trap_pop (meta_get_display ());
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
if (ok != Success)
|
||||
{
|
||||
@ -898,9 +899,11 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
||||
|
||||
if (output_info->is_primary)
|
||||
{
|
||||
meta_error_trap_push (display);
|
||||
XRRSetOutputPrimary (manager_xrandr->xdisplay,
|
||||
DefaultRootWindow (manager_xrandr->xdisplay),
|
||||
(XID)output_info->output->output_id);
|
||||
meta_error_trap_pop (display);
|
||||
}
|
||||
|
||||
output_set_presentation_xrandr (manager_xrandr,
|
||||
@ -926,7 +929,7 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
|
||||
output->is_primary = FALSE;
|
||||
}
|
||||
|
||||
meta_display_ungrab (meta_get_display ());
|
||||
meta_display_ungrab (display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -20,9 +20,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -290,7 +288,7 @@ make_logical_config (MetaMonitorManager *manager)
|
||||
|
||||
for (j = 0; j < monitor_infos->len; j++)
|
||||
{
|
||||
MetaMonitorInfo *info = &g_array_index (monitor_infos, MetaMonitorInfo, i);
|
||||
MetaMonitorInfo *info = &g_array_index (monitor_infos, MetaMonitorInfo, j);
|
||||
if (meta_rectangle_equal (&crtc->rect,
|
||||
&info->rect))
|
||||
{
|
||||
@ -358,19 +356,35 @@ make_logical_config (MetaMonitorManager *manager)
|
||||
static GType
|
||||
get_default_backend (void)
|
||||
{
|
||||
if (meta_is_wayland_compositor ())
|
||||
#if defined(CLUTTER_WINDOWING_EGL)
|
||||
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
|
||||
return META_TYPE_MONITOR_MANAGER_KMS;
|
||||
#endif
|
||||
|
||||
#if defined(CLUTTER_WINDOWING_X11)
|
||||
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
|
||||
if (meta_wayland_compositor_is_native (compositor))
|
||||
return META_TYPE_MONITOR_MANAGER_KMS;
|
||||
else
|
||||
/* If we're a Wayland compositor using the X11 backend,
|
||||
* we're a nested configuration, so return the dummy
|
||||
* monitor setup. */
|
||||
if (meta_is_wayland_compositor ())
|
||||
return META_TYPE_MONITOR_MANAGER;
|
||||
else
|
||||
return META_TYPE_MONITOR_MANAGER_XRANDR;
|
||||
}
|
||||
else
|
||||
return META_TYPE_MONITOR_MANAGER_XRANDR;
|
||||
#endif
|
||||
|
||||
#if defined(CLUTTER_WINDOWING_WAYLAND)
|
||||
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_WAYLAND))
|
||||
{
|
||||
/* Use the dummy implementation on Wayland for now.
|
||||
* In the future, we should support wl_fullscreen_output
|
||||
* which will have CRTC management in the protocol. */
|
||||
return META_TYPE_MONITOR_MANAGER;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static MetaMonitorManager *
|
||||
@ -614,46 +628,60 @@ static char *
|
||||
make_display_name (MetaMonitorManager *manager,
|
||||
MetaOutput *output)
|
||||
{
|
||||
char *inches = NULL;
|
||||
char *vendor_name = NULL;
|
||||
char *ret;
|
||||
|
||||
if (g_str_has_prefix (output->name, "LVDS") ||
|
||||
g_str_has_prefix (output->name, "eDP"))
|
||||
return g_strdup (_("Built-in display"));
|
||||
{
|
||||
ret = g_strdup (_("Built-in display"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (output->width_mm != -1 && output->height_mm != -1)
|
||||
if (output->width_mm > 0 && output->height_mm > 0)
|
||||
{
|
||||
double d = sqrt (output->width_mm * output->width_mm +
|
||||
output->height_mm * output->height_mm);
|
||||
char *inches = diagonal_to_str (d / 25.4);
|
||||
char *vendor_name;
|
||||
char *ret;
|
||||
inches = diagonal_to_str (d / 25.4);
|
||||
}
|
||||
|
||||
if (g_strcmp0 (output->vendor, "unknown") != 0)
|
||||
{
|
||||
if (!manager->pnp_ids)
|
||||
manager->pnp_ids = gnome_pnp_ids_new ();
|
||||
if (g_strcmp0 (output->vendor, "unknown") != 0)
|
||||
{
|
||||
if (!manager->pnp_ids)
|
||||
manager->pnp_ids = gnome_pnp_ids_new ();
|
||||
|
||||
vendor_name = gnome_pnp_ids_get_pnp_id (manager->pnp_ids,
|
||||
output->vendor);
|
||||
vendor_name = gnome_pnp_ids_get_pnp_id (manager->pnp_ids,
|
||||
output->vendor);
|
||||
|
||||
ret = g_strdup_printf ("%s %s", vendor_name, inches);
|
||||
|
||||
g_free (vendor_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TRANSLATORS: this is a monitor name (in case we don't know
|
||||
the vendor), it's Unknown followed by a size in inches,
|
||||
like 'Unknown 15"'
|
||||
*/
|
||||
ret = g_strdup_printf (_("Unknown %s"), inches);
|
||||
}
|
||||
|
||||
g_free (inches);
|
||||
return ret;
|
||||
if (!vendor_name)
|
||||
vendor_name = g_strdup (output->vendor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_strdup (output->vendor);
|
||||
if (inches != NULL)
|
||||
vendor_name = g_strdup (_("Unknown"));
|
||||
else
|
||||
vendor_name = g_strdup (_("Unknown Display"));
|
||||
}
|
||||
|
||||
if (inches != NULL)
|
||||
{
|
||||
/* TRANSLATORS: this is a monitor vendor name, followed by a
|
||||
* size in inches, like 'Dell 15"'
|
||||
*/
|
||||
ret = g_strdup_printf (_("%s %s"), vendor_name, inches);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = g_strdup (vendor_name);
|
||||
}
|
||||
|
||||
out:
|
||||
g_free (inches);
|
||||
g_free (vendor_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -14,9 +14,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -19,9 +19,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_PLACE_H
|
||||
|
@ -17,9 +17,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -25,9 +25,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_SCREEN_PRIVATE_H
|
||||
@ -243,7 +241,7 @@ void meta_screen_workspace_switched (MetaScreen *screen,
|
||||
|
||||
void meta_screen_set_active_workspace_hint (MetaScreen *screen);
|
||||
|
||||
Window meta_screen_create_guard_window (Display *xdisplay, MetaScreen *screen);
|
||||
void meta_screen_create_guard_window (MetaScreen *screen);
|
||||
|
||||
gboolean meta_screen_handle_xevent (MetaScreen *screen,
|
||||
XEvent *xevent);
|
||||
|
@ -19,9 +19,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -391,6 +389,8 @@ int
|
||||
meta_screen_monitor_index_to_xinerama_index (MetaScreen *screen,
|
||||
int index)
|
||||
{
|
||||
g_return_val_if_fail (index >= 0 && index < screen->n_monitor_infos, -1);
|
||||
|
||||
meta_screen_ensure_xinerama_indices (screen);
|
||||
|
||||
return screen->monitor_infos[index].xinerama_index;
|
||||
@ -447,17 +447,16 @@ reload_monitor_infos (MetaScreen *screen)
|
||||
* should effectively be forwarded to events on the background actor,
|
||||
* providing that the scene graph is set up correctly.
|
||||
*/
|
||||
Window
|
||||
meta_screen_create_guard_window (Display *xdisplay, MetaScreen *screen)
|
||||
static Window
|
||||
create_guard_window (Display *xdisplay, MetaScreen *screen)
|
||||
{
|
||||
XSetWindowAttributes attributes;
|
||||
Window guard_window;
|
||||
gulong create_serial;
|
||||
MetaStackWindow stack_window;
|
||||
|
||||
|
||||
attributes.event_mask = NoEventMask;
|
||||
attributes.override_redirect = True;
|
||||
attributes.background_pixel = BlackPixel (xdisplay, screen->number);
|
||||
|
||||
/* We have to call record_add() after we have the new window ID,
|
||||
* so save the serial for the CreateWindow request until then */
|
||||
@ -470,10 +469,10 @@ meta_screen_create_guard_window (Display *xdisplay, MetaScreen *screen)
|
||||
screen->rect.width,
|
||||
screen->rect.height,
|
||||
0, /* border width */
|
||||
CopyFromParent, /* depth */
|
||||
CopyFromParent, /* class */
|
||||
0, /* depth */
|
||||
InputOnly, /* class */
|
||||
CopyFromParent, /* visual */
|
||||
CWEventMask|CWOverrideRedirect|CWBackPixel,
|
||||
CWEventMask|CWOverrideRedirect,
|
||||
&attributes);
|
||||
|
||||
{
|
||||
@ -880,83 +879,34 @@ meta_screen_free (MetaScreen *screen,
|
||||
meta_display_ungrab (display);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
void
|
||||
meta_screen_create_guard_window (MetaScreen *screen)
|
||||
{
|
||||
Window xwindow;
|
||||
XWindowAttributes attrs;
|
||||
} WindowInfo;
|
||||
|
||||
static GList *
|
||||
list_windows (MetaScreen *screen)
|
||||
{
|
||||
Window ignored1, ignored2;
|
||||
Window *children;
|
||||
guint n_children, i;
|
||||
GList *result;
|
||||
|
||||
XQueryTree (screen->display->xdisplay,
|
||||
screen->xroot,
|
||||
&ignored1, &ignored2, &children, &n_children);
|
||||
|
||||
result = NULL;
|
||||
for (i = 0; i < n_children; ++i)
|
||||
{
|
||||
WindowInfo *info = g_new0 (WindowInfo, 1);
|
||||
|
||||
meta_error_trap_push_with_return (screen->display);
|
||||
|
||||
XGetWindowAttributes (screen->display->xdisplay,
|
||||
children[i], &info->attrs);
|
||||
|
||||
if (meta_error_trap_pop_with_return (screen->display))
|
||||
{
|
||||
meta_verbose ("Failed to get attributes for window 0x%lx\n",
|
||||
children[i]);
|
||||
g_free (info);
|
||||
}
|
||||
else
|
||||
{
|
||||
info->xwindow = children[i];
|
||||
}
|
||||
|
||||
result = g_list_prepend (result, info);
|
||||
}
|
||||
|
||||
if (children)
|
||||
XFree (children);
|
||||
|
||||
return g_list_reverse (result);
|
||||
if (screen->guard_window == None)
|
||||
screen->guard_window = create_guard_window (screen->display->xdisplay, screen);
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_manage_all_windows (MetaScreen *screen)
|
||||
{
|
||||
GList *windows;
|
||||
GList *list;
|
||||
|
||||
meta_display_grab (screen->display);
|
||||
|
||||
if (screen->guard_window == None)
|
||||
screen->guard_window =
|
||||
meta_screen_create_guard_window (screen->display->xdisplay, screen);
|
||||
|
||||
windows = list_windows (screen);
|
||||
MetaStackWindow *_children;
|
||||
MetaStackWindow *children;
|
||||
int n_children, i;
|
||||
|
||||
meta_stack_freeze (screen->stack);
|
||||
for (list = windows; list != NULL; list = list->next)
|
||||
meta_stack_tracker_get_stack (screen->stack_tracker, &_children, &n_children);
|
||||
|
||||
/* Copy the stack as it will be modified as part of the loop */
|
||||
children = g_memdup (_children, sizeof (MetaStackWindow) * n_children);
|
||||
|
||||
for (i = 0; i < n_children; ++i)
|
||||
{
|
||||
WindowInfo *info = list->data;
|
||||
|
||||
meta_window_new_with_attrs (screen->display, info->xwindow, TRUE,
|
||||
META_COMP_EFFECT_NONE,
|
||||
&info->attrs);
|
||||
meta_window_x11_new (screen->display, children[i].x11.xwindow, TRUE,
|
||||
META_COMP_EFFECT_NONE);
|
||||
}
|
||||
|
||||
g_free (children);
|
||||
meta_stack_thaw (screen->stack);
|
||||
|
||||
g_list_foreach (windows, (GFunc)g_free, NULL);
|
||||
g_list_free (windows);
|
||||
|
||||
meta_display_ungrab (screen->display);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,9 +18,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -23,9 +23,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_SESSION_H
|
||||
|
@ -29,9 +29,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -28,9 +28,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_STACK_TRACKER_H
|
||||
|
@ -22,9 +22,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_STACK_H
|
||||
|
@ -16,9 +16,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "boxes-private.h"
|
||||
|
@ -15,9 +15,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -26,9 +26,7 @@
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef META_WINDOW_PRIVATE_H
|
||||
@ -81,9 +79,7 @@ struct _MetaWindow
|
||||
const MetaMonitorInfo *monitor;
|
||||
MetaWorkspace *workspace;
|
||||
MetaWindowClientType client_type;
|
||||
#ifdef HAVE_WAYLAND
|
||||
MetaWaylandSurface *surface;
|
||||
#endif
|
||||
Window xwindow;
|
||||
/* may be NULL! not all windows get decorated */
|
||||
MetaFrame *frame;
|
||||
@ -102,7 +98,7 @@ struct _MetaWindow
|
||||
|
||||
MetaWindowType type;
|
||||
Atom type_atom;
|
||||
|
||||
|
||||
/* NOTE these five are not in UTF-8, we just treat them as random
|
||||
* binary data
|
||||
*/
|
||||
@ -242,7 +238,7 @@ struct _MetaWindow
|
||||
/* These are the flags from WM_PROTOCOLS */
|
||||
guint take_focus : 1;
|
||||
guint delete_window : 1;
|
||||
guint net_wm_ping : 1;
|
||||
guint can_ping : 1;
|
||||
/* Globally active / No input */
|
||||
guint input : 1;
|
||||
|
||||
@ -351,6 +347,10 @@ struct _MetaWindow
|
||||
/* whether or not the window is from a program running on another machine */
|
||||
guint is_remote : 1;
|
||||
|
||||
/* Used for Wayland -- surfaces can behave as if they were unmapped if
|
||||
* they have a NULL buffer attached... */
|
||||
guint surface_mapped;
|
||||
|
||||
/* if non-NULL, the bounds of the window frame */
|
||||
cairo_region_t *frame_bounds;
|
||||
|
||||
@ -363,6 +363,9 @@ struct _MetaWindow
|
||||
/* the input shape region for picking */
|
||||
cairo_region_t *input_region;
|
||||
|
||||
/* _NET_WM_WINDOW_OPACITY */
|
||||
guint opacity;
|
||||
|
||||
/* if TRUE, the we have the new form of sync request counter which
|
||||
* also handles application frames */
|
||||
guint extended_sync_request_counter : 1;
|
||||
@ -499,18 +502,22 @@ struct _MetaWindowClass
|
||||
#define META_WINDOW_ALLOWS_HORIZONTAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_width < (w)->size_hints.max_width)
|
||||
#define META_WINDOW_ALLOWS_VERTICAL_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && (w)->size_hints.min_height < (w)->size_hints.max_height)
|
||||
|
||||
MetaWindow* meta_window_new (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
gboolean must_be_viewable);
|
||||
MetaWindow* meta_window_new_with_attrs (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
gboolean must_be_viewable,
|
||||
MetaCompEffect effect,
|
||||
XWindowAttributes *attrs);
|
||||
MetaWindow *meta_window_new_for_wayland (MetaDisplay *display,
|
||||
int width,
|
||||
int height,
|
||||
MetaWindow * _meta_window_shared_new (MetaDisplay *display,
|
||||
MetaScreen *screen,
|
||||
MetaWindowClientType client_type,
|
||||
MetaWaylandSurface *surface,
|
||||
Window xwindow,
|
||||
gulong existing_wm_state,
|
||||
MetaCompEffect effect,
|
||||
XWindowAttributes *attrs);
|
||||
|
||||
MetaWindow * meta_window_x11_new (MetaDisplay *display,
|
||||
Window xwindow,
|
||||
gboolean must_be_viewable,
|
||||
MetaCompEffect effect);
|
||||
MetaWindow * meta_window_wayland_new (MetaDisplay *display,
|
||||
MetaWaylandSurface *surface);
|
||||
|
||||
void meta_window_unmanage (MetaWindow *window,
|
||||
guint32 timestamp);
|
||||
void meta_window_calc_showing (MetaWindow *window);
|
||||
@ -614,12 +621,6 @@ void meta_window_move_resize_wayland (MetaWindow *window,
|
||||
int height,
|
||||
int dx,
|
||||
int dy);
|
||||
gboolean meta_window_configure_request (MetaWindow *window,
|
||||
XEvent *event);
|
||||
gboolean meta_window_property_notify (MetaWindow *window,
|
||||
XEvent *event);
|
||||
gboolean meta_window_client_message (MetaWindow *window,
|
||||
XEvent *event);
|
||||
void meta_window_set_focused_internal (MetaWindow *window,
|
||||
gboolean focused);
|
||||
|
||||
@ -644,8 +645,10 @@ void meta_window_update_sync_request_counter (MetaWindow *window,
|
||||
gint64 new_counter_value);
|
||||
#endif /* HAVE_XSYNC */
|
||||
|
||||
void meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||
const ClutterEvent *event);
|
||||
void meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||
const ClutterEvent *event);
|
||||
void meta_window_handle_mouse_grab_op_xevent (MetaWindow *window,
|
||||
XIDeviceEvent *xevent);
|
||||
|
||||
GList* meta_window_get_workspaces (MetaWindow *window);
|
||||
|
||||
@ -694,8 +697,6 @@ void meta_window_set_user_time (MetaWindow *window,
|
||||
|
||||
void meta_window_update_icon_now (MetaWindow *window);
|
||||
|
||||
void meta_window_update_role (MetaWindow *window);
|
||||
void meta_window_update_net_wm_type (MetaWindow *window);
|
||||
void meta_window_update_for_monitors_changed (MetaWindow *window);
|
||||
void meta_window_update_on_all_workspaces (MetaWindow *window);
|
||||
|
||||
@ -709,18 +710,6 @@ void meta_window_compute_tile_match (MetaWindow *window);
|
||||
|
||||
gboolean meta_window_updates_are_frozen (MetaWindow *window);
|
||||
|
||||
void meta_window_set_opaque_region (MetaWindow *window,
|
||||
cairo_region_t *region);
|
||||
void meta_window_update_opaque_region_x11 (MetaWindow *window);
|
||||
|
||||
void meta_window_set_input_region (MetaWindow *window,
|
||||
cairo_region_t *region);
|
||||
void meta_window_update_input_region_x11 (MetaWindow *window);
|
||||
|
||||
void meta_window_set_shape_region (MetaWindow *window,
|
||||
cairo_region_t *region);
|
||||
void meta_window_update_shape_region_x11 (MetaWindow *window);
|
||||
|
||||
void meta_window_set_title (MetaWindow *window,
|
||||
const char *title);
|
||||
void meta_window_set_wm_class (MetaWindow *window,
|
||||
@ -737,9 +726,25 @@ void meta_window_set_gtk_dbus_properties (MetaWindow *window,
|
||||
void meta_window_set_transient_for (MetaWindow *window,
|
||||
MetaWindow *parent);
|
||||
|
||||
void meta_window_set_opacity (MetaWindow *window,
|
||||
guint opacity);
|
||||
|
||||
void meta_window_set_custom_frame_extents (MetaWindow *window,
|
||||
GtkBorder *extents);
|
||||
|
||||
void meta_window_handle_enter (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
guint root_x,
|
||||
guint root_y);
|
||||
|
||||
void meta_window_set_surface_mapped (MetaWindow *window,
|
||||
gboolean surface_mapped);
|
||||
|
||||
Window meta_window_get_toplevel_xwindow (MetaWindow *window);
|
||||
|
||||
void meta_window_activate_full (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
MetaClientType source_indication,
|
||||
MetaWorkspace *workspace);
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user