Compare commits

..

2 Commits

Author SHA1 Message Date
Ryan Lortie
393a80d434 Add _DBUS_UNIQUE_NAME and _OBJECT_PATH properties
https://bugzilla.gnome.org/show_bug.cgi?id=664851
2011-12-05 12:54:29 -05:00
Colin Walters
a2f95e115c Load _DBUS_APPLICATION_ID property, expose it via API
This is used to associate GtkApplication -> X window, and will
be consumed by gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=664851
2011-12-05 12:52:29 -05:00
38 changed files with 5280 additions and 3522 deletions

1
.gitignore vendored
View File

@@ -19,7 +19,6 @@ libtool
ltmain.sh
missing
.deps
src/50-mutter-windows.xml
src/mutter-wm.desktop
src/mutter.desktop
*.o

47
NEWS
View File

@@ -1,50 +1,3 @@
3.3.5
=====
* MetaShapedTexture no longer is a ClutterTexture subclass [Jasper; #660941]
* Add meta_shaped_texture_get_image() [Jasper; #660941]
* Cleanups [Rui, Jasper; #657639]
* Depend on GTK+ 3.3.7 [Rico]
Contributors:
Rui Matos, Jasper St. Pierre, Rico Tzschichholz
Translations:
Kjartan Maraas [nb], Chao-Hsiung Liao [zh_HK, zh_TW]
3.3.4
=====
* Adapt to changes in GtkStateFlags [Owen]
* Redo properties for applications menu corresponding to GTK+ changes -
they are now _GTK_* not DBUS_*. [Ryan]
* Fix crash on gnome-shell restart when a modal dialog is open [Owen; #668299]
* Code cleanup [Florian; #666039]
Contributors:
Ryan Lortie, Florian Müllner, Owen Taylor
Translations:
Alexander Shopov [bg], Fran Diéguez [gl]
3.3.3
=====
* Add keybindings for tiling to left or right [Florian; #648700]
* Support GTK+'s hide-titlebar-when-maximized hint [Florian; #665617]
* Load _DBUS_APPLICATION_ID, _DBUS_UNIQUE_NAME, _DBUS_OBJECT_PATH
property [Colin, Ryan; #664851]
* Handle changes to workspaces-only-on-primary GSetting [Florian; #664853]
* Don't use the Clutter default stage [Jasper; #664028]
* Fix compilation with --disable-introspection [Lionel; #661871]
* Fix problem where stage could end up mis-sized on startup with
multiple monitors [Lionel]
* Misc bug fixes [Adel, Lionel, Jasper; #666015]
Contributors:
Adel Gadllah, Lionel Landwerlin, Florian Müllner, Jasper St. Pierre
Translations:
Daniel Mustieles [es], Yaron Shahrabani [he], Kjartan Maraas [nb],
Matej Urbančič [sk], Muhammet Kara [tr]
3.3.2
=====

View File

@@ -2,7 +2,7 @@ AC_PREREQ(2.50)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [3])
m4_define([mutter_micro_version], [5])
m4_define([mutter_micro_version], [2])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])
@@ -61,7 +61,7 @@ AC_CHECK_SIZEOF(__int64)
## byte order
AC_C_BIGENDIAN
GTK_MIN_VERSION=3.3.7
GTK_MIN_VERSION=3.3.3
GIO_MIN_VERSION=2.25.10
CANBERRA_GTK=libcanberra-gtk3
CANBERRA_GTK_VERSION=0.26
@@ -470,7 +470,7 @@ if test "$enable_compile_warnings" != no ; then
if test "$enable_compile_warnings" = error; then
case " $CFLAGS " in
*[\ \ ]-Werror[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Werror -Wno-error=deprecated-declarations" ;;
*) CFLAGS="$CFLAGS -Werror" ;;
esac
fi
fi

View File

@@ -1,6 +1,5 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
src/50-mutter-windows.xml.in
src/compositor/compositor.c
src/core/bell.c
src/core/core.c

1020
po/bg.po

File diff suppressed because it is too large Load Diff

517
po/es.po

File diff suppressed because it is too large Load Diff

1062
po/gl.po

File diff suppressed because it is too large Load Diff

1417
po/he.po

File diff suppressed because it is too large Load Diff

198
po/nb.po
View File

@@ -1,13 +1,13 @@
# Norwegian bokmål translation of mutter.
# Norwegian (bokmål) translation of mutter.
# Copyright © 2002-2004 Free Software Foundation, Inc.
# Kjartan Maraas <kmaraas@gnome.org>, 2002-2012.
# Kjartan Maraas <kmaraas@gnome.org>, 2002-2011.
#
msgid ""
msgstr ""
"Project-Id-Version: mutter 3.3.x\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-01-28 17:38+0100\n"
"PO-Revision-Date: 2012-01-28 17:38+0100\n"
"POT-Creation-Date: 2011-12-01 20:27+0100\n"
"PO-Revision-Date: 2011-12-01 20:29+0100\n"
"Last-Translator: Kjartan Maraas <kmaraas@gnome.org>\n"
"Language-Team: Norwegian bokmål <i18n-no@lister.ping.uio.no>\n"
"Language: \n"
@@ -15,18 +15,6 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/50-mutter-windows.xml.in.h:1
msgid "Windows"
msgstr "Vinduer"
#: ../src/50-mutter-windows.xml.in.h:2
msgid "View split on left"
msgstr "Visning delt til venstre"
#: ../src/50-mutter-windows.xml.in.h:3
msgid "View split on right"
msgstr "Visning delt til høyre"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: ../src/compositor/compositor.c:492
@@ -70,12 +58,12 @@ msgstr "_Vent"
msgid "_Force Quit"
msgstr "_Tvungen nedstenging"
#: ../src/core/display.c:361
#: ../src/core/display.c:365
#, c-format
msgid "Missing %s extension required for compositing"
msgstr "Mangler utvidelsen %s som kreves for komposittfunksjon"
#: ../src/core/display.c:427
#: ../src/core/display.c:431
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Feil under åpning av X Window System skjerm «%s»\n"
@@ -126,7 +114,7 @@ msgstr ""
"Kunne ikke finne et tema! Sjekk at %s eksisterer og inneholder de vanlige "
"temaene.\n"
#: ../src/core/mutter.c:40
#: ../src/core/mutter.c:42
#, c-format
msgid ""
"mutter %s\n"
@@ -140,15 +128,15 @@ msgstr ""
"Dette er fri programvare; se i kildekoden for kopibetingelser.\n"
"Det gis INGEN garanti.\n"
#: ../src/core/mutter.c:54
#: ../src/core/mutter.c:56
msgid "Print version"
msgstr "Skriv versjonsnummer"
#: ../src/core/mutter.c:60
#: ../src/core/mutter.c:62
msgid "Comma-separated list of compositor plugins"
msgstr "Kommaseparert liste av tillegg for compositor"
#: ../src/core/prefs.c:1069
#: ../src/core/prefs.c:1067
msgid ""
"Workarounds for broken applications disabled. Some applications may not "
"behave properly.\n"
@@ -156,12 +144,12 @@ msgstr ""
"Funksjonalitet for å gå rundt ødelagte programmer er deaktivert. Noen "
"programmer vil kanskje ikke oppføre seg korrekt.\n"
#: ../src/core/prefs.c:1144
#: ../src/core/prefs.c:1142
#, c-format
msgid "Could not parse font description \"%s\" from GSettings key %s\n"
msgstr "Kunne ikke tolke skriftbeskrivelsen «%s» fra GSettings-nøkkel %s\n"
#: ../src/core/prefs.c:1210
#: ../src/core/prefs.c:1208
#, c-format
msgid ""
"\"%s\" found in configuration database is not a valid value for mouse button "
@@ -170,7 +158,7 @@ msgstr ""
"«%s» funnet i konfigurasjonsdatabasen er ikke en gyldig verdi for endring av "
"musknapp\n"
#: ../src/core/prefs.c:1722
#: ../src/core/prefs.c:1720
#, c-format
msgid ""
"\"%s\" found in configuration database is not a valid value for keybinding "
@@ -179,17 +167,17 @@ msgstr ""
"«%s» funnet i konfigurasjonsdatabasen er ikke en gyldig verdi for "
"tastaturbinding «%s»\n"
#: ../src/core/prefs.c:1819
#: ../src/core/prefs.c:1817
#, c-format
msgid "Workspace %d"
msgstr "Arbeidsområde %d"
#: ../src/core/screen.c:730
#: ../src/core/screen.c:741
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Skjerm %d på display «%s» er ugyldig\n"
#: ../src/core/screen.c:746
#: ../src/core/screen.c:757
#, c-format
msgid ""
"Screen %d on display \"%s\" already has a window manager; try using the --"
@@ -198,19 +186,19 @@ msgstr ""
"Skjerm %d på display «%s» har allerede en vindushåndterer; prøv å bruke "
"flagget --replace for å erstatte aktiv vindushåndterer.\n"
#: ../src/core/screen.c:773
#: ../src/core/screen.c:784
#, c-format
msgid ""
"Could not acquire window manager selection on screen %d display \"%s\"\n"
msgstr ""
"Kunne ikke hente utvalg fra vinduhåndterer på skjerm %d, display «%s»\n"
#: ../src/core/screen.c:828
#: ../src/core/screen.c:839
#, c-format
msgid "Screen %d on display \"%s\" already has a window manager\n"
msgstr "Skjerm %d på display «%s» har allerede en vinduhåndterer\n"
#: ../src/core/screen.c:1013
#: ../src/core/screen.c:1024
#, c-format
msgid "Could not release screen %d on display \"%s\"\n"
msgstr "Kunne ikke slippe skjerm %d på display «%s»\n"
@@ -307,7 +295,7 @@ msgid "Window manager error: "
msgstr "Feil i vindushåndterer: "
#. first time through
#: ../src/core/window.c:7219
#: ../src/core/window.c:7141
#, c-format
msgid ""
"Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER "
@@ -323,7 +311,7 @@ msgstr ""
#. * MWM but not WM_NORMAL_HINTS are basically broken. We complain
#. * about these apps but make them work.
#.
#: ../src/core/window.c:7882
#: ../src/core/window.c:7804
#, c-format
msgid ""
"Window %s sets an MWM hint indicating it isn't resizable, but sets min size "
@@ -386,10 +374,77 @@ msgid "Mutter"
msgstr "Mutter"
#: ../src/org.gnome.mutter.gschema.xml.in.h:1
msgid "Attach modal dialogs"
msgstr "Fest modale dialoger"
#: ../src/org.gnome.mutter.gschema.xml.in.h:2
msgid "Cancel tab popup"
msgstr "Avbryt tabulatordialog"
#: ../src/org.gnome.mutter.gschema.xml.in.h:3
msgid ""
"Determines whether hidden windows (i.e., minimized windows and windows on "
"other workspaces than the current one) should be kept alive."
msgstr ""
"Bestemmer om skjulte vinduer, f.eks minimerte vinduer og vinduer på andre "
"arbeidsområder enn aktivt arbeidsområde, skal holdes i live."
#: ../src/org.gnome.mutter.gschema.xml.in.h:4
msgid ""
"Determines whether the use of popup and highlight frame should be disabled "
"for window cycling."
msgstr ""
"Bestemmer om bruk av dialog og uthevingsramme skal slås av for bytting "
"mellom vinduer."
#: ../src/org.gnome.mutter.gschema.xml.in.h:5
msgid ""
"Determines whether workspace switching should happen for windows on all "
"monitors or only for windows on the primary monitor."
msgstr ""
"Bestemmer om bytting mellom arbeidsområder skal skje for vinduer på alle "
"skjermer eller kun på primær skjerm."
#: ../src/org.gnome.mutter.gschema.xml.in.h:6
msgid "Draggable border width"
msgstr "Bredde på drakant"
#: ../src/org.gnome.mutter.gschema.xml.in.h:7
msgid "Enable edge tiling when dropping windows on screen edges"
msgstr "Slå på kantflising ved slipp av vinduer på skjermkantene"
#: ../src/org.gnome.mutter.gschema.xml.in.h:8
msgid ""
"If enabled, dropping windows on vertical screen edges maximizes them "
"vertically and resizes them horizontally to cover half of the available "
"area. Dropping windows on the top screen edge maximizes them completely."
msgstr "Maksimerer vinduer vertikalt og endrer størrelse horisontalt slik at de dekker halve det tilgjengeligeområdet hvis de slippes på vertikale skjermkanter. Hvis vindu slippes på øverste kant av skjermen maksimeres de fullstendig."
#: ../src/org.gnome.mutter.gschema.xml.in.h:9
msgid "Live Hidden Windows"
msgstr "Levende skjulte vinduer"
#: ../src/org.gnome.mutter.gschema.xml.in.h:10
msgid "Modifier to use for extended window management operations"
msgstr "Endringstast som skal brukes for utvidede vindushåndteringsoperasjoner"
#: ../src/org.gnome.mutter.gschema.xml.in.h:2
#: ../src/org.gnome.mutter.gschema.xml.in.h:11
msgid "No tab popup"
msgstr "Ingen tabulatordialog"
#: ../src/org.gnome.mutter.gschema.xml.in.h:12
msgid "Select window from tab popup"
msgstr "Fjern vindu fra tabulatordialog"
#: ../src/org.gnome.mutter.gschema.xml.in.h:13
msgid ""
"The amount of total draggable borders. If the theme's visible borders are "
"not enough, invisible borders will be added to meet this value."
msgstr ""
"Total mengde med drakant. Hvis temas synlige kanter ikke er nok vil usynlige "
"kanter legges til for å imøtekomme denne verdien."
#: ../src/org.gnome.mutter.gschema.xml.in.h:14
msgid ""
"This key will initiate the \"overlay\", which is a combination window "
"overview and application launching system. The default is intended to be the "
@@ -401,11 +456,7 @@ msgstr ""
"tasten» på PC-maskinvare. Det forventes at denne bindingen er satt til "
"forvalg eller en tom streng."
#: ../src/org.gnome.mutter.gschema.xml.in.h:3
msgid "Attach modal dialogs"
msgstr "Fest modale dialoger"
#: ../src/org.gnome.mutter.gschema.xml.in.h:4
#: ../src/org.gnome.mutter.gschema.xml.in.h:15
msgid ""
"When true, instead of having independent titlebars, modal dialogs appear "
"attached to the titlebar of the parent window and are moved together with "
@@ -415,77 +466,10 @@ msgstr ""
"tittellinjen på opphavsvinduet og flyttes sammen med dette i stedet for å ha "
"individuelle tittellinjer."
#: ../src/org.gnome.mutter.gschema.xml.in.h:5
msgid "Live Hidden Windows"
msgstr "Levende skjulte vinduer"
#: ../src/org.gnome.mutter.gschema.xml.in.h:6
msgid ""
"Determines whether hidden windows (i.e., minimized windows and windows on "
"other workspaces than the current one) should be kept alive."
msgstr ""
"Bestemmer om skjulte vinduer, f.eks minimerte vinduer og vinduer på andre "
"arbeidsområder enn aktivt arbeidsområde, skal holdes i live."
#: ../src/org.gnome.mutter.gschema.xml.in.h:7
msgid "Enable edge tiling when dropping windows on screen edges"
msgstr "Slå på kantflising ved slipp av vinduer på skjermkantene"
#: ../src/org.gnome.mutter.gschema.xml.in.h:8
msgid ""
"If enabled, dropping windows on vertical screen edges maximizes them "
"vertically and resizes them horizontally to cover half of the available "
"area. Dropping windows on the top screen edge maximizes them completely."
msgstr ""
"Maksimerer vinduer vertikalt og endrer størrelse horisontalt slik at de "
"dekker halve det tilgjengeligeområdet hvis de slippes på vertikale "
"skjermkanter. Hvis vindu slippes på øverste kant av skjermen maksimeres de "
"fullstendig."
#: ../src/org.gnome.mutter.gschema.xml.in.h:9
#: ../src/org.gnome.mutter.gschema.xml.in.h:16
msgid "Workspaces only on primary"
msgstr "Arbeidsområder kun på primær skjerm"
#: ../src/org.gnome.mutter.gschema.xml.in.h:10
msgid ""
"Determines whether workspace switching should happen for windows on all "
"monitors or only for windows on the primary monitor."
msgstr ""
"Bestemmer om bytting mellom arbeidsområder skal skje for vinduer på alle "
"skjermer eller kun på primær skjerm."
#: ../src/org.gnome.mutter.gschema.xml.in.h:11
msgid "No tab popup"
msgstr "Ingen tabulatordialog"
#: ../src/org.gnome.mutter.gschema.xml.in.h:12
msgid ""
"Determines whether the use of popup and highlight frame should be disabled "
"for window cycling."
msgstr ""
"Bestemmer om bruk av dialog og uthevingsramme skal slås av for bytting "
"mellom vinduer."
#: ../src/org.gnome.mutter.gschema.xml.in.h:13
msgid "Draggable border width"
msgstr "Bredde på drakant"
#: ../src/org.gnome.mutter.gschema.xml.in.h:14
msgid ""
"The amount of total draggable borders. If the theme's visible borders are "
"not enough, invisible borders will be added to meet this value."
msgstr ""
"Total mengde med drakant. Hvis temas synlige kanter ikke er nok vil usynlige "
"kanter legges til for å imøtekomme denne verdien."
#: ../src/org.gnome.mutter.gschema.xml.in.h:15
msgid "Select window from tab popup"
msgstr "Fjern vindu fra tabulatordialog"
#: ../src/org.gnome.mutter.gschema.xml.in.h:16
msgid "Cancel tab popup"
msgstr "Avbryt tabulatordialog"
#: ../src/tools/mutter-message.c:123
#, c-format
msgid "Usage: %s\n"

View File

@@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=mutter&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2011-12-16 13:21+0000\n"
"PO-Revision-Date: 2011-12-16 21:47+0100\n"
"POT-Creation-Date: 2011-11-22 00:22+0000\n"
"PO-Revision-Date: 2011-11-25 20:53+0100\n"
"Last-Translator: Matej Urbančič <mateju@svn.gnome.org>\n"
"Language-Team: Slovenian GNOME Translation Team <gnome-si@googlegroups.com>\n"
"Language: \n"
@@ -23,18 +23,6 @@ msgstr ""
"X-Poedit-Country: SLOVENIA\n"
"X-Poedit-SourceCharset: utf-8\n"
#: ../src/50-mutter-windows.xml.in.h:1
msgid "View split on left"
msgstr "Poglej razdelek na levi"
#: ../src/50-mutter-windows.xml.in.h:2
msgid "View split on right"
msgstr "Poglej razdelek na desni"
#: ../src/50-mutter-windows.xml.in.h:3
msgid "Windows"
msgstr "Okna"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: ../src/compositor/compositor.c:492
@@ -72,12 +60,12 @@ msgstr "_Počakaj"
msgid "_Force Quit"
msgstr "_Vsili konec"
#: ../src/core/display.c:361
#: ../src/core/display.c:365
#, c-format
msgid "Missing %s extension required for compositing"
msgstr "Manjka razširitev %s, ki je ključna za sestavljanje"
#: ../src/core/display.c:427
#: ../src/core/display.c:431
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "Ni mogoče odpreti zaslona '%s' okenskega sistema X\n"
@@ -122,7 +110,7 @@ msgstr "Ni mogoče preiskati mape tem: %s\n"
msgid "Could not find a theme! Be sure %s exists and contains the usual themes.\n"
msgstr "Ni mogoče najti teme! Prepričajte se, da %s obstaja in vsebuje običajni zapis teme.\n"
#: ../src/core/mutter.c:40
#: ../src/core/mutter.c:42
#, c-format
msgid ""
"mutter %s\n"
@@ -135,11 +123,11 @@ msgstr ""
"To je prosta programska oprema; za pogoje kopiranja si poglejte izvorno kodo.\n"
"Program je na voljo BREZ KAKRŠNIHKOLI ZAGOTOVIL.\n"
#: ../src/core/mutter.c:54
#: ../src/core/mutter.c:56
msgid "Print version"
msgstr "Izpiši različico"
#: ../src/core/mutter.c:60
#: ../src/core/mutter.c:62
msgid "Comma-separated list of compositor plugins"
msgstr "Z vejico ločen seznam vstavkov sestavljanja"
@@ -168,27 +156,27 @@ msgstr "\"%s\", najden v podatkovni zbirki nastavitev, ni veljaven ključ za tip
msgid "Workspace %d"
msgstr "Delovna površina %d"
#: ../src/core/screen.c:730
#: ../src/core/screen.c:741
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "Zaslon %d na prikazu '%s' ni veljaven\n"
#: ../src/core/screen.c:746
#: ../src/core/screen.c:757
#, c-format
msgid "Screen %d on display \"%s\" already has a window manager; try using the --replace option to replace the current window manager.\n"
msgstr "Zaslon %d na prikazu \"%s\" je že upravljan z upravljalnikom oken; poskušajte uporabiti možnost --replace za zamenjavo trenutnega.\n"
#: ../src/core/screen.c:773
#: ../src/core/screen.c:784
#, c-format
msgid "Could not acquire window manager selection on screen %d display \"%s\"\n"
msgstr "Ni mogoče dobiti izbire upravljalnika oken na zaslonu %d prikaza \"%s\"\n"
#: ../src/core/screen.c:828
#: ../src/core/screen.c:839
#, c-format
msgid "Screen %d on display \"%s\" already has a window manager\n"
msgstr "Zaslon %d na prikazu \"%s\" je že upravljan z upravljalnikom oken\n"
#: ../src/core/screen.c:1013
#: ../src/core/screen.c:1024
#, c-format
msgid "Could not release screen %d on display \"%s\"\n"
msgstr "Ni mogoče opustiti zaslona %d na prikazu \"%s\"\n"
@@ -288,7 +276,7 @@ msgid "Window manager error: "
msgstr "Napaka upravljalnika oken: "
#. first time through
#: ../src/core/window.c:7180
#: ../src/core/window.c:7124
#, c-format
msgid "Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER window as specified in the ICCCM.\n"
msgstr "Okno %s nastavi svoj SM_CLIENT_ID, namesto, da bi nastavilo WM_CLIENT_LEADER kot je zavedeno v ICCCM.\n"
@@ -300,7 +288,7 @@ msgstr "Okno %s nastavi svoj SM_CLIENT_ID, namesto, da bi nastavilo WM_CLIENT_LE
#. * MWM but not WM_NORMAL_HINTS are basically broken. We complain
#. * about these apps but make them work.
#.
#: ../src/core/window.c:7843
#: ../src/core/window.c:7787
#, c-format
msgid "Window %s sets an MWM hint indicating it isn't resizable, but sets min size %d x %d and max size %d x %d; this doesn't make much sense.\n"
msgstr "Okno %s določi namig MWM, ki pove, da ni mogoče spremeniti velikosti, hkrati pa določi najmanjšo velikost na %d x %d in največjo na %d x %d; vrednost ni smiselna.\n"

981
po/tr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<KeyListEntries schema="org.gnome.mutter.keybindings"
group="system"
_name="Windows"
wm_name="Mutter"
package="mutter">
<KeyListEntry name="toggle-tiled-left"
_description="View split on left"/>
<KeyListEntry name="toggle-tiled-right"
_description="View split on right"/>
</KeyListEntries>

View File

@@ -27,6 +27,8 @@ INCLUDES= \
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"
mutter_built_sources = \
mutter-marshal.h \
mutter-marshal.c \
mutter-enum-types.h \
mutter-enum-types.c
@@ -52,6 +54,7 @@ libmutter_la_SOURCES = \
compositor/meta-shadow-factory.c \
compositor/meta-shadow-factory-private.h \
compositor/meta-shaped-texture.c \
compositor/meta-shaped-texture.h \
compositor/meta-texture-rectangle.c \
compositor/meta-texture-rectangle.h \
compositor/meta-texture-tower.c \
@@ -171,7 +174,6 @@ libmutterinclude_base_headers = \
meta/main.h \
meta/meta-background-actor.h \
meta/meta-plugin.h \
meta/meta-shaped-texture.h \
meta/meta-shadow-factory.h \
meta/meta-window-actor.h \
meta/prefs.h \
@@ -259,11 +261,6 @@ wmproperties_in_files=mutter-wm.desktop.in
wmproperties_files=$(wmproperties_in_files:.desktop.in=.desktop)
wmproperties_DATA = $(wmproperties_files)
xmldir = @GNOME_KEYBINDINGS_KEYSDIR@
xml_in_files = \
50-mutter-windows.xml.in
xml_DATA = $(xml_in_files:.xml.in=.xml)
gsettings_SCHEMAS = org.gnome.mutter.gschema.xml
@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@
@@ -282,7 +279,6 @@ CLEANFILES = \
mutter.desktop \
mutter-wm.desktop \
org.gnome.mutter.gschema.xml \
$(xml_DATA) \
$(mutter_built_sources) \
$(typelib_DATA) \
$(gir_DATA)
@@ -299,18 +295,38 @@ EXTRA_DIST=$(desktopfiles_files) \
$(IMAGES) \
$(desktopfiles_in_files) \
$(wmproperties_in_files) \
$(xml_in_files) \
org.gnome.mutter.gschema.xml.in \
mutter-schemas.convert \
libmutter.pc.in \
mutter-plugins.pc.in \
mutter-enum-types.h.in \
mutter-enum-types.c.in
mutter-enum-types.c.in \
mutter-marshal.list
BUILT_SOURCES += $(mutter_built_sources)
MUTTER_STAMP_FILES = stamp-mutter-enum-types.h
MUTTER_STAMP_FILES = stamp-mutter-marshal.h stamp-mutter-enum-types.h
CLEANFILES += $(MUTTER_STAMP_FILES)
mutter-marshal.h: stamp-mutter-marshal.h
@true
stamp-mutter-marshal.h: Makefile mutter-marshal.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) \
--prefix=_mutter_marshal \
--header \
$(srcdir)/mutter-marshal.list > xgen-tmh && \
(cmp -s xgen-tmh mutter-marshal.h || cp -f xgen-tmh mutter-marshal.h) && \
rm -f xgen-tmh && \
echo timestamp > $(@F)
mutter-marshal.c: Makefile mutter-marshal.list
$(AM_V_GEN) (echo "#include \"mutter-marshal.h\"" ; \
$(GLIB_GENMARSHAL) \
--prefix=_mutter_marshal \
--body \
$(srcdir)/mutter-marshal.list ) > xgen-tmc && \
cp -f xgen-tmc mutter-marshal.c && \
rm -f xgen-tmc
mutter-enum-types.h: stamp-mutter-enum-types.h Makefile
@true
stamp-mutter-enum-types.h: $(libmutterinclude_base_headers) mutter-enum-types.h.in

View File

@@ -515,15 +515,13 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
meta_screen_set_cm_selection (screen);
info->stage = clutter_stage_new ();
info->stage = clutter_stage_get_default ();
meta_screen_get_size (screen, &width, &height);
clutter_actor_realize (info->stage);
clutter_actor_set_size (info->stage, width, height);
xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
XResizeWindow (xdisplay, xwin, width, height);
event_mask = FocusChangeMask |
ExposureMask |
EnterWindowMask | LeaveWindowMask |
@@ -1141,18 +1139,12 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor,
guint width,
guint height)
{
MetaDisplay *display = meta_screen_get_display (screen);
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
Display *xdisplay;
Window xwin;
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
DEBUG_TRACE ("meta_compositor_sync_screen_size\n");
g_return_if_fail (info);
xdisplay = meta_display_get_xdisplay (display);
xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
XResizeWindow (xdisplay, xwin, width, height);
clutter_actor_set_size (info->stage, width, height);
meta_background_actor_screen_size_changed (screen);

View File

@@ -442,7 +442,8 @@ meta_shadow_factory_class_init (MetaShadowFactoryClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}

View File

@@ -25,37 +25,32 @@
#include <config.h>
#include <meta/meta-shaped-texture.h>
#include "meta-shaped-texture.h"
#include "meta-texture-tower.h"
#include "meta-texture-rectangle.h"
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#define COGL_ENABLE_EXPERIMENTAL_API
#include <cogl/cogl-texture-pixmap-x11.h>
#include <gdk/gdk.h> /* for gdk_rectangle_intersect() */
#include <string.h>
static void meta_shaped_texture_dispose (GObject *object);
static void meta_shaped_texture_notify (GObject *object,
GParamSpec *pspec);
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,
gfloat *min_width_p,
gfloat *natural_width_p);
static void meta_shaped_texture_get_preferred_height (ClutterActor *self,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p);
static void meta_shaped_texture_update_area (ClutterX11TexturePixmap *texture,
int x,
int y,
int width,
int height);
static void meta_shaped_texture_dirty_mask (MetaShapedTexture *stex);
G_DEFINE_TYPE (MetaShapedTexture, meta_shaped_texture,
CLUTTER_TYPE_ACTOR);
CLUTTER_X11_TYPE_TEXTURE_PIXMAP);
#define META_SHAPED_TEXTURE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \
@@ -64,8 +59,6 @@ G_DEFINE_TYPE (MetaShapedTexture, meta_shaped_texture,
struct _MetaShapedTexturePrivate
{
MetaTextureTower *paint_tower;
Pixmap pixmap;
CoglHandle texture;
CoglHandle mask_texture;
CoglHandle material;
CoglHandle material_unshaped;
@@ -76,7 +69,8 @@ struct _MetaShapedTexturePrivate
cairo_region_t *overlay_region;
cairo_path_t *overlay_path;
guint tex_width, tex_height;
cairo_region_t *visible_pixels_region;
guint mask_width, mask_height;
guint create_mipmaps : 1;
@@ -87,14 +81,16 @@ meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
ClutterActorClass *actor_class = (ClutterActorClass *) klass;
ClutterX11TexturePixmapClass *x11_texture_class = (ClutterX11TexturePixmapClass *) klass;
gobject_class->dispose = meta_shaped_texture_dispose;
gobject_class->notify = meta_shaped_texture_notify;
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;
x11_texture_class->update_area = meta_shaped_texture_update_area;
g_type_class_add_private (klass, sizeof (MetaShapedTexturePrivate));
}
@@ -108,8 +104,8 @@ meta_shaped_texture_init (MetaShapedTexture *self)
priv->shape_region = NULL;
priv->overlay_path = NULL;
priv->overlay_region = NULL;
priv->visible_pixels_region = NULL;
priv->paint_tower = meta_texture_tower_new ();
priv->texture = COGL_INVALID_HANDLE;
priv->mask_texture = COGL_INVALID_HANDLE;
priv->create_mipmaps = TRUE;
}
@@ -136,11 +132,6 @@ meta_shaped_texture_dispose (GObject *object)
cogl_handle_unref (priv->material_unshaped);
priv->material_unshaped = COGL_INVALID_HANDLE;
}
if (priv->texture != COGL_INVALID_HANDLE)
{
cogl_handle_unref (priv->texture);
priv->texture = COGL_INVALID_HANDLE;
}
meta_shaped_texture_set_shape_region (self, NULL);
meta_shaped_texture_set_clip_region (self, NULL);
@@ -149,19 +140,114 @@ meta_shaped_texture_dispose (GObject *object)
G_OBJECT_CLASS (meta_shaped_texture_parent_class)->dispose (object);
}
static void
meta_shaped_texture_notify (GObject *object,
GParamSpec *pspec)
{
if (G_OBJECT_CLASS (meta_shaped_texture_parent_class)->notify)
G_OBJECT_CLASS (meta_shaped_texture_parent_class)->notify (object, pspec);
/* It seems like we could just do this out of update_area(), but unfortunately,
* clutter_glx_texture_pixmap() doesn't call through the vtable on the
* initial update_area, so we need to look for changes to the texture
* explicitly.
*/
if (strcmp (pspec->name, "cogl-texture") == 0)
{
MetaShapedTexture *stex = (MetaShapedTexture *) object;
MetaShapedTexturePrivate *priv = stex->priv;
meta_shaped_texture_clear (stex);
if (priv->create_mipmaps)
meta_texture_tower_set_base_texture (priv->paint_tower,
clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex)));
}
}
static void
meta_shaped_texture_dirty_mask (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv = stex->priv;
if (priv->mask_texture != COGL_INVALID_HANDLE)
if (priv->visible_pixels_region != NULL)
{
cogl_handle_unref (priv->mask_texture);
priv->mask_texture = COGL_INVALID_HANDLE;
}
cairo_region_destroy (priv->visible_pixels_region);
priv->visible_pixels_region = NULL;
if (priv->material != COGL_INVALID_HANDLE)
cogl_material_set_layer (priv->material, 1, COGL_INVALID_HANDLE);
if (priv->mask_texture != COGL_INVALID_HANDLE)
{
cogl_handle_unref (priv->mask_texture);
priv->mask_texture = COGL_INVALID_HANDLE;
}
if (priv->material != COGL_INVALID_HANDLE)
cogl_material_set_layer (priv->material, 1, COGL_INVALID_HANDLE);
}
}
static void
scan_visible_region (MetaShapedTexture *stex,
guchar *mask_data,
int stride)
{
MetaShapedTexturePrivate *priv = stex->priv;
cairo_region_t *visible_pixels_region;
cairo_region_t *overlay_region;
int i, n_rects;
/* The visible pixels region contains all pixel values above 0.
* This is somewhat complicated when there's an overlay: we
* need to scan all regions potentially modified by it.
*/
if (priv->visible_pixels_region)
cairo_region_destroy (priv->visible_pixels_region);
priv->visible_pixels_region = cairo_region_copy (priv->shape_region);
visible_pixels_region = priv->visible_pixels_region;
overlay_region = priv->overlay_region;
/* With no overlay region, the visible region is defined
* by the mask region, so we don't need to scan anything. */
if (overlay_region == NULL)
return;
/* Subtract all the rectangles in the overlay region so that we can
* scan all the pixels potentially added by the overlay path. */
cairo_region_subtract (visible_pixels_region, overlay_region);
n_rects = cairo_region_num_rectangles (overlay_region);
for (i = 0; i < n_rects; i++)
{
int x, y;
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (overlay_region, i, &rect);
for (y = rect.y; y < (rect.y + rect.height); y++)
{
for (x = rect.x; x < (rect.x + rect.width); x++)
{
int w = x;
while (mask_data[y * stride + w] > 0 && w < (rect.x + rect.width))
w++;
if (w > 0)
{
cairo_rectangle_int_t tmp;
tmp.x = x;
tmp.y = y;
tmp.width = w - x;
tmp.height = 1;
cairo_region_union_rectangle (visible_pixels_region, &tmp);
x = w;
}
}
}
}
}
static void
@@ -224,7 +310,7 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
CoglHandle paint_tex;
guint tex_width, tex_height;
paint_tex = priv->texture;
paint_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex));
if (paint_tex == COGL_INVALID_HANDLE)
return;
@@ -239,7 +325,7 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
meta_shaped_texture_dirty_mask (stex);
/* If we don't have a mask texture yet then create one */
if (priv->mask_texture == COGL_INVALID_HANDLE)
if (priv->visible_pixels_region == NULL)
{
guchar *mask_data;
int i;
@@ -253,6 +339,10 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
(priv->overlay_region == NULL ||
cairo_region_num_rectangles (priv->overlay_region) == 0))
{
/* With no mask, the visible region is just
* {0, 0, tex_width, tex_height}. */
cairo_rectangle_int_t rect = { 0, 0, tex_width, tex_height };
priv->visible_pixels_region = cairo_region_create_rectangle (&rect);
return;
}
@@ -287,6 +377,7 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
}
install_overlay_path (stex, mask_data, tex_width, tex_height, stride);
scan_visible_region (stex, mask_data, stride);
cogl_texture_get_gl_texture (paint_tex, NULL, &paint_gl_target);
@@ -360,13 +451,13 @@ meta_shaped_texture_paint (ClutterActor *actor)
if (priv->create_mipmaps)
paint_tex = meta_texture_tower_get_paint_texture (priv->paint_tower);
else
paint_tex = priv->texture;
paint_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex));
if (paint_tex == COGL_INVALID_HANDLE)
return;
tex_width = priv->tex_width;
tex_height = priv->tex_height;
tex_width = cogl_texture_get_width (paint_tex);
tex_height = cogl_texture_get_height (paint_tex);
if (tex_width == 0 || tex_height == 0) /* no contents yet */
return;
@@ -421,7 +512,6 @@ meta_shaped_texture_paint (ClutterActor *actor)
{
int n_rects;
int i;
cairo_rectangle_int_t tex_rect = { 0, 0, tex_width, tex_height };
/* Limit to how many separate rectangles we'll draw; beyond this just
* fall back and draw the whole thing */
@@ -439,9 +529,6 @@ meta_shaped_texture_paint (ClutterActor *actor)
cairo_region_get_rectangle (priv->clip_region, i, &rect);
if (!gdk_rectangle_intersect (&tex_rect, &rect, &rect))
continue;
x1 = rect.x;
y1 = rect.y;
x2 = rect.x + rect.width;
@@ -487,7 +574,7 @@ meta_shaped_texture_pick (ClutterActor *actor,
ClutterActorBox alloc;
guint tex_width, tex_height;
paint_tex = priv->texture;
paint_tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex));
if (paint_tex == COGL_INVALID_HANDLE)
return;
@@ -515,41 +602,19 @@ meta_shaped_texture_pick (ClutterActor *actor,
}
static void
meta_shaped_texture_get_preferred_width (ClutterActor *self,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
meta_shaped_texture_update_area (ClutterX11TexturePixmap *texture,
int x,
int y,
int width,
int height)
{
MetaShapedTexturePrivate *priv;
MetaShapedTexture *stex = (MetaShapedTexture *) texture;
MetaShapedTexturePrivate *priv = stex->priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (self));
CLUTTER_X11_TEXTURE_PIXMAP_CLASS (meta_shaped_texture_parent_class)->update_area (texture,
x, y, width, height);
priv = META_SHAPED_TEXTURE (self)->priv;
if (min_width_p)
*min_width_p = 0;
if (natural_width_p)
*natural_width_p = priv->tex_width;
}
static void
meta_shaped_texture_get_preferred_height (ClutterActor *self,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
MetaShapedTexturePrivate *priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (self));
priv = META_SHAPED_TEXTURE (self)->priv;
if (min_height_p)
*min_height_p = 0;
if (natural_height_p)
*natural_height_p = priv->tex_height;
meta_texture_tower_update_area (priv->paint_tower, x, y, width, height);
}
ClutterActor *
@@ -575,13 +640,50 @@ meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
if (create_mipmaps != priv->create_mipmaps)
{
CoglHandle base_texture;
priv->create_mipmaps = create_mipmaps;
base_texture = create_mipmaps ?
priv->texture : COGL_INVALID_HANDLE;
clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (stex)) : COGL_INVALID_HANDLE;
meta_texture_tower_set_base_texture (priv->paint_tower, base_texture);
}
}
/* This is a workaround for deficiencies in the hack tower:
*
* When we call clutter_x11_texture_pixmap_set_pixmap(tp, None),
* ClutterX11TexturePixmap knows that it has to get rid of the old texture, but
* clutter_texture_set_cogl_texture(texture, COGL_INVALID_HANDLE) isn't allowed, so
* it grabs the material for the texture and manually sets the texture in it. This means
* that the "cogl-texture" property isn't notified, so we don't find out about it.
*
* And if we keep the CoglX11TexturePixmap around after the X pixmap is freed, then
* we'll trigger X errors when we actually try to free it.
*
* The only correct thing to do here is to change our code to derive
* from ClutterActor and get rid of the inheritance hack tower. Once
* we want to depend on Clutter-1.4 (which has CoglTexturePixmapX11),
* that will be very easy to do.
*/
void
meta_shaped_texture_clear (MetaShapedTexture *stex)
{
MetaShapedTexturePrivate *priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
meta_texture_tower_set_base_texture (priv->paint_tower, COGL_INVALID_HANDLE);
if (priv->material != COGL_INVALID_HANDLE)
cogl_material_set_layer (priv->material, 0, COGL_INVALID_HANDLE);
if (priv->material_unshaped != COGL_INVALID_HANDLE)
cogl_material_set_layer (priv->material_unshaped, 0, COGL_INVALID_HANDLE);
}
void
meta_shaped_texture_set_shape_region (MetaShapedTexture *stex,
cairo_region_t *region)
@@ -608,115 +710,22 @@ meta_shaped_texture_set_shape_region (MetaShapedTexture *stex,
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
}
void
meta_shaped_texture_update_area (MetaShapedTexture *stex,
int x,
int y,
int width,
int height)
{
MetaShapedTexturePrivate *priv;
const cairo_rectangle_int_t clip = { x, y, width, height };
priv = stex->priv;
if (priv->texture == COGL_INVALID_HANDLE)
return;
cogl_texture_pixmap_x11_update_area (priv->texture, x, y, width, height);
meta_texture_tower_update_area (priv->paint_tower, x, y, width, height);
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &clip);
}
static void
set_cogl_texture (MetaShapedTexture *stex,
CoglHandle cogl_tex)
{
MetaShapedTexturePrivate *priv;
guint width, height;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
if (priv->texture != COGL_INVALID_HANDLE)
cogl_handle_unref (priv->texture);
priv->texture = cogl_tex;
if (priv->material != COGL_INVALID_HANDLE)
cogl_material_set_layer (priv->material, 0, cogl_tex);
if (priv->material_unshaped != COGL_INVALID_HANDLE)
cogl_material_set_layer (priv->material_unshaped, 0, cogl_tex);
if (cogl_tex != COGL_INVALID_HANDLE)
{
width = cogl_texture_get_width (cogl_tex);
height = cogl_texture_get_height (cogl_tex);
if (width != priv->tex_width ||
height != priv->tex_height)
{
priv->tex_width = width;
priv->tex_height = height;
clutter_actor_queue_relayout (CLUTTER_ACTOR (stex));
}
}
else
{
/* size changed to 0 going to an invalid handle */
priv->tex_width = 0;
priv->tex_height = 0;
clutter_actor_queue_relayout (CLUTTER_ACTOR (stex));
}
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
}
/**
* meta_shaped_texture_set_pixmap:
* @stex: The #MetaShapedTexture
* @pixmap: The pixmap you want the stex to assume
*/
void
meta_shaped_texture_set_pixmap (MetaShapedTexture *stex,
Pixmap pixmap)
{
MetaShapedTexturePrivate *priv;
g_return_if_fail (META_IS_SHAPED_TEXTURE (stex));
priv = stex->priv;
if (priv->pixmap == pixmap)
return;
priv->pixmap = pixmap;
if (pixmap != None)
set_cogl_texture (stex, cogl_texture_pixmap_x11_new (pixmap, FALSE));
else
set_cogl_texture (stex, COGL_INVALID_HANDLE);
if (priv->create_mipmaps)
meta_texture_tower_set_base_texture (priv->paint_tower, priv->texture);
}
/**
* meta_shaped_texture_get_texture:
* @stex: The #MetaShapedTexture
* meta_shaped_texture_get_visible_pixels_region:
* @stex: a #MetaShapedTexture
*
* Returns: (transfer none): the unshaped texture
* Return a region enclosing only visible pixels: those with
* alpha values above 0.
*
* Returns: a #cairo_region_t
*/
CoglHandle
meta_shaped_texture_get_texture (MetaShapedTexture *stex)
cairo_region_t *
meta_shaped_texture_get_visible_pixels_region (MetaShapedTexture *stex)
{
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), COGL_INVALID_HANDLE);
return stex->priv->texture;
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
meta_shaped_texture_ensure_mask (stex);
return stex->priv->visible_pixels_region;
}
/**
@@ -725,7 +734,7 @@ meta_shaped_texture_get_texture (MetaShapedTexture *stex)
* @overlay_region: A region containing the parts of the mask to overlay.
* All rectangles in this region are wiped clear to full transparency,
* and the overlay path is clipped to this region.
* @overlay_path: (transfer full): This path will be painted onto the mask
* @overlay_path (transfer full): This path will be painted onto the mask
* texture with a fully opaque source. Due to the lack of refcounting
* in #cairo_path_t, ownership of the path is assumed.
*/
@@ -763,9 +772,10 @@ meta_shaped_texture_set_overlay_path (MetaShapedTexture *stex,
/**
* meta_shaped_texture_set_clip_region:
* @stex: a #MetaShapedTexture
* @frame: a #MetaShapedTexture
* @clip_region: (transfer full): the region of the texture that
* is visible and should be painted.
* is visible and should be painted. OWNERSHIP IS ASSUMED BY
* THE FUNCTION (for efficiency to avoid a copy.)
*
* Provides a hint to the texture about what areas of the texture
* are not completely obscured and thus need to be painted. This
@@ -791,106 +801,5 @@ meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
priv->clip_region = NULL;
}
if (clip_region)
priv->clip_region = cairo_region_copy (clip_region);
else
priv->clip_region = NULL;
}
/**
* meta_shaped_texture_get_image:
* @stex: A #MetaShapedTexture
* @clip: A clipping rectangle, to help prevent extra processing.
* In the case that the clipping rectangle is partially or fully
* outside the bounds of the texture, the rectangle will be clipped.
*
* Flattens the two layers of the shaped texture into one ARGB32
* image by alpha blending the two images, and returns the flattened
* image.
*
* Returns: (transfer full): a new cairo surface to be freed with
* cairo_surface_destroy().
*/
cairo_surface_t *
meta_shaped_texture_get_image (MetaShapedTexture *stex,
cairo_rectangle_int_t *clip)
{
CoglHandle texture, mask_texture;
cairo_rectangle_int_t texture_rect = { 0, 0, 0, 0 };
cairo_surface_t *surface;
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
texture = stex->priv->texture;
if (texture == NULL)
return NULL;
texture_rect.width = cogl_texture_get_width (texture);
texture_rect.height = cogl_texture_get_height (texture);
if (clip != NULL)
{
/* GdkRectangle is just a typedef of cairo_rectangle_int_t,
* so we can use the gdk_rectangle_* APIs on these. */
if (!gdk_rectangle_intersect (&texture_rect, clip, clip))
return NULL;
}
if (clip != NULL)
texture = cogl_texture_new_from_sub_texture (texture,
clip->x,
clip->y,
clip->width,
clip->height);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
cogl_texture_get_width (texture),
cogl_texture_get_height (texture));
cogl_texture_get_data (texture, CLUTTER_CAIRO_FORMAT_ARGB32,
cairo_image_surface_get_stride (surface),
cairo_image_surface_get_data (surface));
cairo_surface_mark_dirty (surface);
if (clip != NULL)
cogl_object_unref (texture);
mask_texture = stex->priv->mask_texture;
if (mask_texture != COGL_INVALID_HANDLE)
{
cairo_t *cr;
cairo_surface_t *mask_surface;
if (clip != NULL)
mask_texture = cogl_texture_new_from_sub_texture (mask_texture,
clip->x,
clip->y,
clip->width,
clip->height);
mask_surface = cairo_image_surface_create (CAIRO_FORMAT_A8,
cogl_texture_get_width (mask_texture),
cogl_texture_get_height (mask_texture));
cogl_texture_get_data (mask_texture, COGL_PIXEL_FORMAT_A_8,
cairo_image_surface_get_stride (mask_surface),
cairo_image_surface_get_data (mask_surface));
cairo_surface_mark_dirty (mask_surface);
cr = cairo_create (surface);
cairo_set_source_surface (cr, mask_surface, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_DEST_IN);
cairo_paint (cr);
cairo_destroy (cr);
cairo_surface_destroy (mask_surface);
if (clip != NULL)
cogl_object_unref (mask_texture);
}
return surface;
priv->clip_region = clip_region;
}

View File

@@ -26,8 +26,10 @@
#ifndef __META_SHAPED_TEXTURE_H__
#define __META_SHAPED_TEXTURE_H__
#include <config.h>
#include <clutter/clutter.h>
#include <X11/Xlib.h>
#include <clutter/x11/clutter-x11.h>
G_BEGIN_DECLS
@@ -44,12 +46,12 @@ typedef struct _MetaShapedTexturePrivate MetaShapedTexturePrivate;
struct _MetaShapedTextureClass
{
ClutterActorClass parent_class;
ClutterX11TexturePixmapClass parent_class;
};
struct _MetaShapedTexture
{
ClutterActor parent;
ClutterX11TexturePixmap parent;
MetaShapedTexturePrivate *priv;
};
@@ -61,20 +63,13 @@ ClutterActor *meta_shaped_texture_new (void);
void meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
gboolean create_mipmaps);
void meta_shaped_texture_update_area (MetaShapedTexture *stex,
int x,
int y,
int width,
int height);
void meta_shaped_texture_set_pixmap (MetaShapedTexture *stex,
Pixmap pixmap);
CoglHandle meta_shaped_texture_get_texture (MetaShapedTexture *stex);
void meta_shaped_texture_clear (MetaShapedTexture *stex);
void meta_shaped_texture_set_shape_region (MetaShapedTexture *stex,
cairo_region_t *region);
cairo_region_t *meta_shaped_texture_get_visible_pixels_region (MetaShapedTexture *stex);
void meta_shaped_texture_set_overlay_path (MetaShapedTexture *stex,
cairo_region_t *overlay_region,
cairo_path_t *overlay_path);
@@ -83,9 +78,6 @@ void meta_shaped_texture_set_overlay_path (MetaShapedTexture *stex,
void meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
cairo_region_t *clip_region);
cairo_surface_t * meta_shaped_texture_get_image (MetaShapedTexture *stex,
cairo_rectangle_int_t *clip);
G_END_DECLS
#endif /* __META_SHAPED_TEXTURE_H__ */

View File

@@ -18,11 +18,11 @@
#include <meta/errors.h>
#include "frame.h"
#include <meta/window.h>
#include <meta/meta-shaped-texture.h>
#include "xprops.h"
#include "compositor-private.h"
#include "meta-shadow-factory-private.h"
#include "meta-shaped-texture.h"
#include "meta-window-actor-private.h"
enum {
@@ -232,13 +232,15 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] =
g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
@@ -944,20 +946,26 @@ static void
meta_window_actor_damage_all (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;
CoglHandle texture;
ClutterX11TexturePixmap *texture_x11 = CLUTTER_X11_TEXTURE_PIXMAP (priv->actor);
guint pixmap_width = 0;
guint pixmap_height = 0;
if (!priv->needs_damage_all)
return;
texture = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
g_object_get (texture_x11,
"pixmap-width", &pixmap_width,
"pixmap-height", &pixmap_height,
NULL);
if (!priv->mapped || priv->needs_pixmap)
return;
meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
0, 0,
cogl_texture_get_width (texture),
cogl_texture_get_height (texture));
clutter_x11_texture_pixmap_update_area (texture_x11,
0,
0,
pixmap_width,
pixmap_height);
priv->needs_damage_all = FALSE;
}
@@ -1196,8 +1204,9 @@ meta_window_actor_detach (MetaWindowActor *self)
* 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_pixmap (META_SHAPED_TEXTURE (priv->actor),
None);
clutter_x11_texture_pixmap_set_pixmap (CLUTTER_X11_TEXTURE_PIXMAP (priv->actor),
None);
meta_shaped_texture_clear (META_SHAPED_TEXTURE (priv->actor));
cogl_flush();
XFreePixmap (xdisplay, priv->back_pixmap);
@@ -1246,24 +1255,19 @@ void
meta_window_actor_set_redirected (MetaWindowActor *self, gboolean state)
{
MetaWindow *metaWindow = meta_window_actor_get_meta_window (self);
MetaDisplay *display = meta_window_get_display (metaWindow);
Display *xdisplay = meta_display_get_xdisplay (display);
Display *xdisplay = meta_display_get_xdisplay (meta_window_get_display (metaWindow));
Window xwin = meta_window_actor_get_x_window (self);
if (state)
{
meta_error_trap_push (display);
XCompositeRedirectWindow (xdisplay, xwin, CompositeRedirectManual);
meta_error_trap_pop (display);
meta_window_actor_queue_create_pixmap (self);
self->priv->unredirected = FALSE;
}
else
{
meta_error_trap_push (display);
XCompositeUnredirectWindow (xdisplay, xwin, CompositeRedirectManual);
meta_error_trap_pop (display);
self->priv->unredirected = TRUE;
}
}
@@ -1749,9 +1753,22 @@ meta_window_actor_set_visible_region (MetaWindowActor *self,
cairo_region_t *visible_region)
{
MetaWindowActorPrivate *priv = self->priv;
cairo_region_t *texture_clip_region = NULL;
/* Get the area of the window texture that would be drawn if
* we weren't obscured at all
*/
texture_clip_region = meta_shaped_texture_get_visible_pixels_region (META_SHAPED_TEXTURE (priv->actor));
texture_clip_region = cairo_region_copy (texture_clip_region);
/* Then intersect that with the visible region to get the region
* that we actually need to redraw.
*/
cairo_region_intersect (texture_clip_region, visible_region);
/* Assumes ownership */
meta_shaped_texture_set_clip_region (META_SHAPED_TEXTURE (priv->actor),
visible_region);
texture_clip_region);
}
/**
@@ -1803,6 +1820,19 @@ meta_window_actor_reset_visible_regions (MetaWindowActor *self)
meta_window_actor_clear_shadow_clip (self);
}
static gboolean
texture_pixmap_using_extension (ClutterX11TexturePixmap *texture)
{
ClutterTexture *self = CLUTTER_TEXTURE (texture);
CoglHandle handle;
handle = clutter_texture_get_cogl_texture (self);
return handle != NULL &&
cogl_is_texture_pixmap_x11 (handle) &&
cogl_texture_pixmap_x11_is_using_tfp_extension (handle);
}
static void
check_needs_pixmap (MetaWindowActor *self)
{
@@ -1836,7 +1866,7 @@ check_needs_pixmap (MetaWindowActor *self)
if (priv->back_pixmap == None)
{
CoglHandle texture;
gint pxm_width, pxm_height;
meta_error_trap_push (display);
@@ -1865,22 +1895,23 @@ check_needs_pixmap (MetaWindowActor *self)
meta_shaped_texture_set_create_mipmaps (META_SHAPED_TEXTURE (priv->actor),
FALSE);
meta_shaped_texture_set_pixmap (META_SHAPED_TEXTURE (priv->actor),
priv->back_pixmap);
texture = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
clutter_x11_texture_pixmap_set_pixmap
(CLUTTER_X11_TEXTURE_PIXMAP (priv->actor),
priv->back_pixmap);
/*
* This only works *after* actually setting the pixmap, so we have to
* do it here.
* See: http://bugzilla.clutter-project.org/show_bug.cgi?id=2236
*/
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (texture)))
if (G_UNLIKELY (!texture_pixmap_using_extension (CLUTTER_X11_TEXTURE_PIXMAP (priv->actor))))
g_warning ("NOTE: Not using GLX TFP!\n");
meta_window_actor_update_bounding_region_and_borders (self,
cogl_texture_get_width (texture),
cogl_texture_get_height (texture));
g_object_get (priv->actor,
"pixmap-width", &pxm_width,
"pixmap-height", &pxm_height,
NULL);
meta_window_actor_update_bounding_region_and_borders (self, pxm_width, pxm_height);
}
priv->needs_pixmap = FALSE;
@@ -1973,6 +2004,7 @@ meta_window_actor_process_damage (MetaWindowActor *self,
XDamageNotifyEvent *event)
{
MetaWindowActorPrivate *priv = self->priv;
ClutterX11TexturePixmap *texture_x11 = CLUTTER_X11_TEXTURE_PIXMAP (priv->actor);
priv->received_damage = TRUE;
@@ -2003,11 +2035,11 @@ meta_window_actor_process_damage (MetaWindowActor *self,
if (!priv->mapped || priv->needs_pixmap)
return;
meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
event->area.x,
event->area.y,
event->area.width,
event->area.height);
clutter_x11_texture_pixmap_update_area (texture_x11,
event->area.x,
event->area.y,
event->area.width,
event->area.height);
}
void

View File

@@ -439,13 +439,9 @@ setup_constraint_info (ConstraintInfo *info,
monitor_info->number);
/* Workaround braindead legacy apps that don't know how to
* fullscreen themselves properly - don't get fooled by
* windows which hide their titlebar when maximized; that's
* not the same as fullscreen, even if there are no struts
* making the workarea smaller than the monitor.
* fullscreen themselves properly.
*/
if (meta_prefs_get_force_fullscreen() &&
!window->hide_titlebar_when_maximized &&
meta_rectangle_equal (new, &monitor_info->rect) &&
window->has_fullscreen_func &&
!window->fullscreen)

View File

@@ -230,7 +230,8 @@ meta_display_class_init (MetaDisplayClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
display_signals[WINDOW_CREATED] =
@@ -238,7 +239,8 @@ meta_display_class_init (MetaDisplayClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, META_TYPE_WINDOW);
display_signals[WINDOW_DEMANDS_ATTENTION] =
@@ -246,7 +248,8 @@ meta_display_class_init (MetaDisplayClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, META_TYPE_WINDOW);
display_signals[WINDOW_MARKED_URGENT] =
@@ -254,7 +257,8 @@ meta_display_class_init (MetaDisplayClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
META_TYPE_WINDOW);
@@ -5025,21 +5029,12 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
winlist = meta_display_list_windows (display,
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
winlist = g_slist_sort (winlist, meta_display_stack_cmp);
g_slist_foreach (winlist, (GFunc)g_object_ref, NULL);
/* Unmanage all windows */
tmp = winlist;
while (tmp != NULL)
{
MetaWindow *window = tmp->data;
/* Check if already unmanaged for safety - in particular, catch
* the case where unmanaging a parent window can cause attached
* dialogs to be (temporarily) unmanaged.
*/
if (!window->unmanaging)
meta_window_unmanage (window, timestamp);
g_object_unref (window);
meta_window_unmanage (tmp->data, timestamp);
tmp = tmp->next;
}

View File

@@ -3232,46 +3232,6 @@ handle_toggle_above (MetaDisplay *display,
meta_window_make_above (window);
}
static void
handle_toggle_tiled (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
MetaTileMode mode = binding->handler->data;
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
{
window->tile_monitor_number = window->saved_maximize ? window->monitor->number
: -1;
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE;
if (window->saved_maximize)
meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL);
else
meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL);
}
else if (meta_window_can_tile_side_by_side (window))
{
window->tile_monitor_number = window->monitor->number;
window->tile_mode = mode;
/* Maximization constraints beat tiling constraints, so if the window
* is maximized, tiling won't have any effect unless we unmaximize it
* horizontally first; rather than calling meta_window_unmaximize(),
* we just set the flag and rely on meta_window_tile() syncing it to
* save an additional roundtrip.
*/
window->maximized_horizontally = FALSE;
meta_window_tile (window);
}
}
static void
handle_toggle_maximized (MetaDisplay *display,
MetaScreen *screen,
@@ -3929,20 +3889,6 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
handle_toggle_maximized, 0);
add_builtin_keybinding (display,
"toggle-tiled-left",
SCHEMA_MUTTER_KEYBINDINGS,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
handle_toggle_tiled, META_TILE_LEFT);
add_builtin_keybinding (display,
"toggle-tiled-right",
SCHEMA_MUTTER_KEYBINDINGS,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
handle_toggle_tiled, META_TILE_RIGHT);
add_builtin_keybinding (display,
"toggle-above",
SCHEMA_COMMON_KEYBINDINGS,

View File

@@ -25,7 +25,9 @@
#include <meta/main.h>
#include <meta/util.h>
#ifdef HAVE_INTROSPECTION
#include "meta-plugin-manager.h"
#endif
#include <glib.h>

View File

@@ -914,8 +914,6 @@ do_override (char *key,
detailed_signal = g_strdup_printf ("changed::%s", key);
handler_id = g_signal_connect (settings, detailed_signal,
G_CALLBACK (settings_changed), NULL);
g_free (detailed_signal);
g_object_set_data (G_OBJECT (settings), key, GUINT_TO_POINTER (handler_id));
settings_changed (settings, key, NULL);

View File

@@ -39,6 +39,7 @@
#include "stack.h"
#include "xprops.h"
#include <meta/compositor.h>
#include "mutter-marshal.h"
#include "mutter-enum-types.h"
#ifdef HAVE_SOLARIS_XINERAMA
@@ -161,7 +162,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaScreenClass, restacked),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
pspec = g_param_spec_int ("n-workspaces",
@@ -175,7 +177,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE,
1,
G_TYPE_INT);
@@ -185,7 +188,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE,
1,
G_TYPE_INT);
@@ -195,7 +199,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
_mutter_marshal_VOID__INT_INT_ENUM,
G_TYPE_NONE,
3,
G_TYPE_INT,
@@ -207,7 +212,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
_mutter_marshal_VOID__INT_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_INT,
META_TYPE_WINDOW);
@@ -217,7 +223,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
_mutter_marshal_VOID__INT_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_INT,
META_TYPE_WINDOW);
@@ -227,7 +234,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
screen_signals[TOGGLE_RECORDING] =
@@ -235,7 +243,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
screen_signals[WORKAREAS_CHANGED] =
@@ -243,7 +252,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaScreenClass, workareas_changed),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
screen_signals[MONITORS_CHANGED] =
@@ -251,7 +261,8 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaScreenClass, monitors_changed),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_object_class_install_property (object_class,
@@ -1554,7 +1565,7 @@ static void
update_num_workspaces (MetaScreen *screen,
guint32 timestamp)
{
int new_num, old_num;
int new_num;
GList *tmp;
int i;
GList *extras;
@@ -1584,7 +1595,6 @@ update_num_workspaces (MetaScreen *screen,
++i;
tmp = tmp->next;
}
old_num = i;
g_assert (last_remaining);
@@ -1619,22 +1629,22 @@ update_num_workspaces (MetaScreen *screen,
g_assert (w->windows == NULL);
meta_workspace_remove (w);
tmp = tmp->next;
}
g_list_free (extras);
for (i = old_num; i < new_num; i++)
meta_workspace_new (screen);
while (i < new_num)
{
meta_workspace_new (screen);
++i;
}
set_number_of_spaces_hint (screen, new_num);
meta_screen_queue_workarea_recalc (screen);
for (i = old_num; i < new_num; i++)
g_signal_emit (screen, screen_signals[WORKSPACE_ADDED], 0, i);
g_object_notify (G_OBJECT (screen), "n-workspaces");
}
@@ -1925,6 +1935,7 @@ meta_screen_tile_preview_update_timeout (gpointer data)
{
MetaScreen *screen = data;
MetaWindow *window = screen->display->grab_window;
gboolean composited = screen->display->compositor != NULL;
gboolean needs_preview = FALSE;
screen->tile_preview_timeout_id = 0;
@@ -1934,7 +1945,8 @@ meta_screen_tile_preview_update_timeout (gpointer data)
Window xwindow;
gulong create_serial;
screen->tile_preview = meta_tile_preview_new (screen->number);
screen->tile_preview = meta_tile_preview_new (screen->number,
composited);
xwindow = meta_tile_preview_get_xwindow (screen->tile_preview,
&create_serial);
meta_stack_tracker_record_add (screen->stack_tracker,
@@ -2980,7 +2992,7 @@ meta_screen_resize (MetaScreen *screen,
g_free (old_monitor_infos);
g_slist_free (windows);
g_signal_emit (screen, screen_signals[MONITORS_CHANGED], 0);
g_signal_emit (screen, screen_signals[MONITORS_CHANGED], 0, index);
}
void

View File

@@ -101,14 +101,10 @@ struct _MetaWindow
char *startup_id;
char *mutter_hints;
char *gtk_theme_variant;
char *gtk_application_id;
char *gtk_unique_bus_name;
char *gtk_application_object_path;
char *gtk_window_object_path;
char *gtk_app_menu_object_path;
char *gtk_menubar_object_path;
char *dbus_application_id;
char *dbus_unique_name;
char *dbus_object_path;
int hide_titlebar_when_maximized;
int net_wm_pid;
Window xtransient_for;
@@ -137,9 +133,6 @@ struct _MetaWindow
* this is the current mode. If not, it is the mode which will be
* requested after the window grab is released */
guint tile_mode : 2;
/* The last "full" maximized/unmaximized state. We need to keep track of
* that to toggle between normal/tiled or maximized/tiled states. */
guint saved_maximize : 1;
int tile_monitor_number;
/* Whether we're shaded */
@@ -661,6 +654,5 @@ void meta_window_propagate_focus_appearance (MetaWindow *window,
gboolean focused);
gboolean meta_window_should_attach_to_parent (MetaWindow *window);
gboolean meta_window_can_tile_side_by_side (MetaWindow *window);
#endif

View File

@@ -1578,11 +1578,14 @@ reload_gtk_theme_variant (MetaWindow *window,
requested_variant, window->desc);
}
if (g_strcmp0 (requested_variant, current_variant) != 0)
if (g_strcmp0 (requested_variant, current_variant))
{
g_free (current_variant);
window->gtk_theme_variant = g_strdup (requested_variant);
if (requested_variant)
window->gtk_theme_variant = g_strdup (requested_variant);
else
window->gtk_theme_variant = NULL;
if (window->frame)
meta_ui_update_frame_style (window->screen->ui, window->frame->xwindow);
@@ -1590,57 +1593,76 @@ reload_gtk_theme_variant (MetaWindow *window,
}
static void
reload_gtk_hide_titlebar_when_maximized (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
reload_dbus_application_id (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
gboolean requested_value = FALSE;
gboolean current_value = window->hide_titlebar_when_maximized;
char *new_id = NULL;
char *current_id = window->dbus_application_id;
if (value->type != META_PROP_VALUE_INVALID)
new_id = value->v.str;
if (g_strcmp0 (new_id, current_id))
{
requested_value = ((int) value->v.cardinal == 1);
meta_verbose ("Request to hide titlebar for window %s.\n", window->desc);
}
g_free (current_id);
if (requested_value == current_value)
return;
if (new_id)
window->dbus_application_id = g_strdup (new_id);
else
window->dbus_application_id = NULL;
window->hide_titlebar_when_maximized = requested_value;
if (META_WINDOW_MAXIMIZED (window))
{
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
if (window->frame)
meta_ui_update_frame_style (window->screen->ui, window->frame->xwindow);
g_object_notify ((GObject*)window, "dbus-application-id");
}
}
#define RELOAD_STRING(var_name, propname) \
static void \
reload_ ## var_name (MetaWindow *window, \
MetaPropValue *value, \
gboolean initial) \
{ \
g_free (window->var_name); \
\
if (value->type != META_PROP_VALUE_INVALID) \
window->var_name = g_strdup (value->v.str); \
else \
window->var_name = NULL; \
\
g_object_notify (G_OBJECT (window), propname); \
}
static void
reload_dbus_unique_name (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
char *new_id = NULL;
char *current_id = window->dbus_unique_name;
RELOAD_STRING (gtk_unique_bus_name, "gtk-unique-bus-name")
RELOAD_STRING (gtk_application_id, "gtk-application-id")
RELOAD_STRING (gtk_application_object_path, "gtk-application-object-path")
RELOAD_STRING (gtk_window_object_path, "gtk-window-object-path")
RELOAD_STRING (gtk_app_menu_object_path, "gtk-app-menu-object-path")
RELOAD_STRING (gtk_menubar_object_path, "gtk-menubar-object-path")
if (value->type != META_PROP_VALUE_INVALID)
new_id = value->v.str;
#undef RELOAD_STRING
if (g_strcmp0 (new_id, current_id))
{
g_free (current_id);
if (new_id)
window->dbus_unique_name = g_strdup (new_id);
else
window->dbus_unique_name = NULL;
g_object_notify ((GObject*)window, "dbus-unique-name");
}
}
static void
reload_dbus_object_path (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
char *new_path = NULL;
char *current_path = window->dbus_object_path;
if (value->type != META_PROP_VALUE_INVALID)
new_path = value->v.str;
if (g_strcmp0 (new_path, current_path))
{
g_free (current_path);
if (new_path)
window->dbus_object_path = g_strdup (new_path);
else
window->dbus_object_path = NULL;
g_object_notify ((GObject*)window, "dbus-object-path");
}
}
/**
* Initialises the property hooks system. Each row in the table named "hooks"
@@ -1695,13 +1717,9 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, TRUE, FALSE },
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, TRUE, FALSE },
{ display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, TRUE, FALSE },
{ display->atom__GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED, META_PROP_VALUE_CARDINAL, reload_gtk_hide_titlebar_when_maximized, TRUE, FALSE },
{ display->atom__GTK_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_gtk_application_id, TRUE, FALSE },
{ display->atom__GTK_UNIQUE_BUS_NAME, META_PROP_VALUE_UTF8, reload_gtk_unique_bus_name, TRUE, FALSE },
{ display->atom__GTK_APPLICATION_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_application_object_path, TRUE, FALSE },
{ display->atom__GTK_WINDOW_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_window_object_path, TRUE, FALSE },
{ display->atom__GTK_APP_MENU_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_app_menu_object_path, TRUE, FALSE },
{ display->atom__GTK_MENUBAR_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_gtk_menubar_object_path, TRUE, FALSE },
{ display->atom__DBUS_APPLICATION_ID, META_PROP_VALUE_UTF8, reload_dbus_application_id, TRUE, FALSE },
{ display->atom__DBUS_UNIQUE_NAME, META_PROP_VALUE_UTF8, reload_dbus_unique_name, TRUE, FALSE },
{ display->atom__DBUS_OBJECT_PATH, META_PROP_VALUE_UTF8, reload_dbus_object_path, TRUE, FALSE },
{ display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, FALSE },
{ display->atom_WM_STATE, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE },
{ display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, FALSE, FALSE },

View File

@@ -165,12 +165,9 @@ enum {
PROP_RESIZEABLE,
PROP_ABOVE,
PROP_WM_CLASS,
PROP_GTK_APPLICATION_ID,
PROP_GTK_UNIQUE_BUS_NAME,
PROP_GTK_APPLICATION_OBJECT_PATH,
PROP_GTK_WINDOW_OBJECT_PATH,
PROP_GTK_APP_MENU_OBJECT_PATH,
PROP_GTK_MENUBAR_OBJECT_PATH
PROP_DBUS_APPLICATION_ID,
PROP_DBUS_UNIQUE_NAME,
PROP_DBUS_OBJECT_PATH
};
enum
@@ -227,12 +224,9 @@ meta_window_finalize (GObject *object)
g_free (window->icon_name);
g_free (window->desc);
g_free (window->gtk_theme_variant);
g_free (window->gtk_application_id);
g_free (window->gtk_unique_bus_name);
g_free (window->gtk_application_object_path);
g_free (window->gtk_window_object_path);
g_free (window->gtk_app_menu_object_path);
g_free (window->gtk_menubar_object_path);
g_free (window->dbus_application_id);
g_free (window->dbus_unique_name);
g_free (window->dbus_object_path);
}
static void
@@ -296,23 +290,14 @@ meta_window_get_property(GObject *object,
case PROP_ABOVE:
g_value_set_boolean (value, win->wm_state_above);
break;
case PROP_GTK_APPLICATION_ID:
g_value_set_string (value, win->gtk_application_id);
case PROP_DBUS_APPLICATION_ID:
g_value_set_string (value, win->dbus_application_id);
break;
case PROP_GTK_UNIQUE_BUS_NAME:
g_value_set_string (value, win->gtk_unique_bus_name);
case PROP_DBUS_UNIQUE_NAME:
g_value_set_string (value, win->dbus_unique_name);
break;
case PROP_GTK_APPLICATION_OBJECT_PATH:
g_value_set_string (value, win->gtk_application_object_path);
break;
case PROP_GTK_WINDOW_OBJECT_PATH:
g_value_set_string (value, win->gtk_window_object_path);
break;
case PROP_GTK_APP_MENU_OBJECT_PATH:
g_value_set_string (value, win->gtk_app_menu_object_path);
break;
case PROP_GTK_MENUBAR_OBJECT_PATH:
g_value_set_string (value, win->gtk_menubar_object_path);
case PROP_DBUS_OBJECT_PATH:
g_value_set_string (value, win->dbus_object_path);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -481,50 +466,26 @@ meta_window_class_init (MetaWindowClass *klass)
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GTK_APPLICATION_ID,
g_param_spec_string ("gtk-application-id",
"_GTK_APPLICATION_ID",
"Contents of the _GTK_APPLICATION_ID property of this window",
PROP_DBUS_APPLICATION_ID,
g_param_spec_string ("dbus-application-id",
"_DBUS_APPLICATION_ID",
"Contents of the _DBUS_APPLICATION_ID property of this window",
NULL,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GTK_UNIQUE_BUS_NAME,
g_param_spec_string ("gtk-unique-bus-name",
"_GTK_UNIQUE_BUS_NAME",
"Contents of the _GTK_UNIQUE_BUS_NAME property of this window",
PROP_DBUS_UNIQUE_NAME,
g_param_spec_string ("dbus-unique-name",
"_DBUS_UNIQUE_NAME",
"Contents of the _DBUS_UNIQUE_NAME property of this window",
NULL,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GTK_APPLICATION_OBJECT_PATH,
g_param_spec_string ("gtk-application-object-path",
"_GTK_APPLICATION_OBJECT_PATH",
"Contents of the _GTK_APPLICATION_OBJECT_PATH property of this window",
NULL,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GTK_WINDOW_OBJECT_PATH,
g_param_spec_string ("gtk-window-object-path",
"_GTK_WINDOW_OBJECT_PATH",
"Contents of the _GTK_WINDOW_OBJECT_PATH property of this window",
NULL,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GTK_APP_MENU_OBJECT_PATH,
g_param_spec_string ("gtk-app-menu-object-path",
"_GTK_APP_MENU_OBJECT_PATH",
"Contents of the _GTK_APP_MENU_OBJECT_PATH property of this window",
NULL,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_GTK_MENUBAR_OBJECT_PATH,
g_param_spec_string ("gtk-menubar-object-path",
"_GTK_MENUBAR_OBJECT_PATH",
"Contents of the _GTK_MENUBAR_OBJECT_PATH property of this window",
PROP_DBUS_OBJECT_PATH,
g_param_spec_string ("dbus-object-path",
"_DBUS_OBJECT_PATH",
"Contents of the _DBUS_OBJECT_PATH property of this window",
NULL,
G_PARAM_READABLE));
@@ -533,7 +494,8 @@ meta_window_class_init (MetaWindowClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaWindowClass, workspace_changed),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1,
G_TYPE_INT);
@@ -542,7 +504,8 @@ meta_window_class_init (MetaWindowClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaWindowClass, focus),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
window_signals[RAISED] =
@@ -550,7 +513,8 @@ meta_window_class_init (MetaWindowClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaWindowClass, raised),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
window_signals[UNMANAGED] =
@@ -558,7 +522,8 @@ meta_window_class_init (MetaWindowClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MetaWindowClass, unmanaged),
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
@@ -3493,9 +3458,6 @@ meta_window_maximize_internal (MetaWindow *window,
else
meta_window_save_rect (window);
if (maximize_horizontally && maximize_vertically)
window->saved_maximize = TRUE;
window->maximized_horizontally =
window->maximized_horizontally || maximize_horizontally;
window->maximized_vertically =
@@ -3658,10 +3620,6 @@ meta_window_tile (MetaWindow *window)
window,
&old_rect,
&new_rect);
if (window->frame)
meta_ui_queue_frame_draw (window->screen->ui,
window->frame->xwindow);
}
else
{
@@ -3674,10 +3632,16 @@ meta_window_tile (MetaWindow *window)
static gboolean
meta_window_can_tile_maximized (MetaWindow *window)
{
return window->has_maximize_func;
if (!META_WINDOW_ALLOWS_RESIZE (window))
return FALSE;
if (!window->has_maximize_func)
return FALSE;
return TRUE;
}
gboolean
static gboolean
meta_window_can_tile_side_by_side (MetaWindow *window)
{
const MetaMonitorInfo *monitor;
@@ -3756,9 +3720,6 @@ meta_window_unmaximize_internal (MetaWindow *window,
unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL;
g_assert (unmaximize_horizontally || unmaximize_vertically);
if (unmaximize_horizontally && unmaximize_vertically)
window->saved_maximize = FALSE;
/* Only do something if the window isn't already maximized in the
* given direction(s).
*/
@@ -10290,75 +10251,39 @@ meta_window_get_wm_class_instance (MetaWindow *window)
}
/**
* meta_window_get_gtk_application_id:
* meta_window_get_dbus_application_id:
* @window: a #MetaWindow
*
* Return value: (transfer none): the application ID
**/
const char *
meta_window_get_gtk_application_id (MetaWindow *window)
meta_window_get_dbus_application_id (MetaWindow *window)
{
return window->gtk_application_id;
return window->dbus_application_id;
}
/**
* meta_window_get_gtk_unique_bus_name:
* meta_window_get_dbus_unique_name:
* @window: a #MetaWindow
*
* Return value: (transfer none): the unique name
**/
const char *
meta_window_get_gtk_unique_bus_name (MetaWindow *window)
meta_window_get_dbus_unique_name (MetaWindow *window)
{
return window->gtk_unique_bus_name;
return window->dbus_unique_name;
}
/**
* meta_window_get_gtk_application_object_path:
* meta_window_get_dbus_object_path:
* @window: a #MetaWindow
*
* Return value: (transfer none): the object path
**/
const char *
meta_window_get_gtk_application_object_path (MetaWindow *window)
meta_window_get_dbus_object_path (MetaWindow *window)
{
return window->gtk_application_object_path;
}
/**
* meta_window_get_gtk_window_object_path:
* @window: a #MetaWindow
*
* Return value: (transfer none): the object path
**/
const char *
meta_window_get_gtk_window_object_path (MetaWindow *window)
{
return window->gtk_window_object_path;
}
/**
* meta_window_get_gtk_app_menu_object_path:
* @window: a #MetaWindow
*
* Return value: (transfer none): the object path
**/
const char *
meta_window_get_gtk_app_menu_object_path (MetaWindow *window)
{
return window->gtk_app_menu_object_path;
}
/**
* meta_window_get_gtk_menubar_object_path:
* @window: a #MetaWindow
*
* Return value: (transfer none): the object path
**/
const char *
meta_window_get_gtk_menubar_object_path (MetaWindow *window)
{
return window->gtk_menubar_object_path;
return window->dbus_object_path;
}
/**
@@ -10614,8 +10539,7 @@ meta_window_get_frame_type (MetaWindow *window)
/* can't add border if undecorated */
return META_FRAME_TYPE_LAST;
}
else if ((window->border_only && base_type != META_FRAME_TYPE_ATTACHED) ||
(window->hide_titlebar_when_maximized && META_WINDOW_MAXIMIZED (window)))
else if (window->border_only && base_type != META_FRAME_TYPE_ATTACHED)
{
/* override base frame type */
return META_FRAME_TYPE_BORDER;

View File

@@ -121,14 +121,16 @@ meta_workspace_class_init (MetaWorkspaceClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
META_TYPE_WINDOW);
signals[WINDOW_REMOVED] = g_signal_new ("window-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
META_TYPE_WINDOW);

View File

@@ -59,13 +59,9 @@ item(_MUTTER_SET_KEYBINDINGS_MESSAGE)
item(_MUTTER_TOGGLE_VERBOSE)
item(_MUTTER_HINTS)
item(_GTK_THEME_VARIANT)
item(_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED)
item(_GTK_APPLICATION_ID)
item(_GTK_UNIQUE_BUS_NAME)
item(_GTK_APPLICATION_OBJECT_PATH)
item(_GTK_WINDOW_OBJECT_PATH)
item(_GTK_APP_MENU_OBJECT_PATH)
item(_GTK_MENUBAR_OBJECT_PATH)
item(_DBUS_APPLICATION_ID)
item(_DBUS_UNIQUE_NAME)
item(_DBUS_OBJECT_PATH)
item(_GNOME_WM_KEYBINDINGS)
item(_GNOME_PANEL_ACTION)
item(_GNOME_PANEL_ACTION_MAIN_MENU)

View File

@@ -191,8 +191,6 @@ typedef enum _MetaKeyBindingAction
META_KEYBINDING_ACTION_ACTIVATE_WINDOW_MENU,
META_KEYBINDING_ACTION_TOGGLE_FULLSCREEN,
META_KEYBINDING_ACTION_TOGGLE_MAXIMIZED,
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
META_KEYBINDING_ACTION_TOGGLE_ABOVE,
META_KEYBINDING_ACTION_MAXIMIZE,
META_KEYBINDING_ACTION_UNMAXIMIZE,

View File

@@ -95,12 +95,9 @@ const char * meta_window_get_wm_class (MetaWindow *window);
const char * meta_window_get_wm_class_instance (MetaWindow *window);
gboolean meta_window_showing_on_its_workspace (MetaWindow *window);
const char * meta_window_get_gtk_application_id (MetaWindow *window);
const char * meta_window_get_gtk_unique_bus_name (MetaWindow *window);
const char * meta_window_get_gtk_application_object_path (MetaWindow *window);
const char * meta_window_get_gtk_window_object_path (MetaWindow *window);
const char * meta_window_get_gtk_app_menu_object_path (MetaWindow *window);
const char * meta_window_get_gtk_menubar_object_path (MetaWindow *window);
const char * meta_window_get_dbus_application_id (MetaWindow *window);
const char * meta_window_get_dbus_unique_name (MetaWindow *window);
const char * meta_window_get_dbus_object_path (MetaWindow *window);
void meta_window_move(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw);
void meta_window_move_frame(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw);

2
src/mutter-marshal.list Normal file
View File

@@ -0,0 +1,2 @@
VOID:INT,INT,ENUM
VOID:INT,OBJECT

View File

@@ -83,14 +83,6 @@
<default><![CDATA[['<Control><Shift><Alt>r']]]></default>
</key>
<key name="toggle-tiled-left" type="as">
<default><![CDATA[['<Super>Left']]]></default>
</key>
<key name="toggle-tiled-right" type="as">
<default><![CDATA[['<Super>Right']]]></default>
</key>
<key name="tab-popup-select" type="as">
<default>[]</default>
<_summary>Select window from tab popup</_summary>

View File

@@ -6403,8 +6403,8 @@ meta_gtk_state_from_string (const char *str)
return GTK_STATE_FLAG_INCONSISTENT;
else if (g_ascii_strcasecmp ("focused", str) == 0)
return GTK_STATE_FLAG_FOCUSED;
else if (g_ascii_strcasecmp ("backdrop", str) == 0)
return GTK_STATE_FLAG_BACKDROP;
else if (g_ascii_strcasecmp ("window-unfocused", str) == 0)
return GTK_STATE_FLAG_WINDOW_UNFOCUSED;
else
return -1; /* hack */
}
@@ -6428,8 +6428,8 @@ meta_gtk_state_to_string (GtkStateFlags state)
return "INCONSISTENT";
case GTK_STATE_FLAG_FOCUSED:
return "FOCUSED";
case GTK_STATE_FLAG_BACKDROP:
return "BACKDROP";
case GTK_STATE_FLAG_WINDOW_UNFOCUSED:
return "WINDOW_UNFOCUSED";
}
return "<unknown>";

View File

@@ -39,6 +39,8 @@ struct _MetaTilePreview {
GdkRGBA *preview_color;
MetaRectangle tile_rect;
gboolean has_alpha: 1;
};
static gboolean
@@ -50,17 +52,30 @@ meta_tile_preview_draw (GtkWidget *widget,
cairo_set_line_width (cr, 1.0);
/* Fill the preview area with a transparent color */
gdk_cairo_set_source_rgba (cr, preview->preview_color);
if (preview->has_alpha)
{
/* Fill the preview area with a transparent color */
gdk_cairo_set_source_rgba (cr, preview->preview_color);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* Use the opaque color for the border */
cairo_set_source_rgb (cr,
preview->preview_color->red,
preview->preview_color->green,
preview->preview_color->blue);
/* Use the opaque color for the border */
cairo_set_source_rgb (cr,
preview->preview_color->red,
preview->preview_color->green,
preview->preview_color->blue);
}
else
{
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_rectangle (cr,
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
preview->tile_rect.width - 2 * (OUTLINE_WIDTH - 1) - 1,
preview->tile_rect.height - 2 * (OUTLINE_WIDTH - 1) - 1);
cairo_stroke (cr);
}
cairo_rectangle (cr,
0.5, 0.5,
@@ -72,13 +87,11 @@ meta_tile_preview_draw (GtkWidget *widget,
}
MetaTilePreview *
meta_tile_preview_new (int screen_number)
meta_tile_preview_new (int screen_number,
gboolean composited)
{
MetaTilePreview *preview;
GdkScreen *screen;
GtkStyleContext *context;
GtkWidgetPath *path;
guchar selection_alpha = 0xFF;
screen = gdk_display_get_screen (gdk_display_get_default (), screen_number);
@@ -94,34 +107,44 @@ meta_tile_preview_new (int screen_number)
preview->tile_rect.x = preview->tile_rect.y = 0;
preview->tile_rect.width = preview->tile_rect.height = 0;
gtk_widget_set_visual (preview->preview_window,
gdk_screen_get_rgba_visual (screen));
preview->has_alpha = composited &&
(gdk_screen_get_rgba_visual (screen) != NULL);
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
if (preview->has_alpha)
{
GtkStyleContext *context;
GtkWidgetPath *path;
guchar selection_alpha = 0xFF;
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_add_class (context,
GTK_STYLE_CLASS_RUBBERBAND);
gtk_widget_set_visual (preview->preview_window,
gdk_screen_get_rgba_visual (screen));
gtk_widget_path_free (path);
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
"background-color", &preview->preview_color,
NULL);
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_add_class (context,
GTK_STYLE_CLASS_RUBBERBAND);
/* The background-color for the .rubberband class should probably
* contain the correct alpha value - unfortunately, at least for now
* it doesn't. Hopefully the following workaround can be removed
* when GtkIconView gets ported to GtkStyleContext.
*/
gtk_style_context_get_style (context,
"selection-box-alpha", &selection_alpha,
NULL);
preview->preview_color->alpha = (double)selection_alpha / 0xFF;
gtk_widget_path_free (path);
g_object_unref (context);
gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
"background-color", &preview->preview_color,
NULL);
/* The background-color for the .rubberband class should probably
* contain the correct alpha value - unfortunately, at least for now
* it doesn't. Hopefully the following workaround can be removed
* when GtkIconView gets ported to GtkStyleContext.
*/
gtk_style_context_get_style (context,
"selection-box-alpha", &selection_alpha,
NULL);
preview->preview_color->alpha = (double)selection_alpha / 0xFF;
g_object_unref (context);
}
/* We make an assumption that XCreateWindow will be the first operation
* when calling gtk_widget_realize() (via gdk_window_new()), or that it
@@ -177,6 +200,33 @@ meta_tile_preview_show (MetaTilePreview *preview,
gdk_window_move_resize (window,
preview->tile_rect.x, preview->tile_rect.y,
preview->tile_rect.width, preview->tile_rect.height);
if (!preview->has_alpha)
{
cairo_region_t *outer_region, *inner_region;
GdkRectangle outer_rect, inner_rect;
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
gdk_window_set_background_rgba (window, &black);
outer_rect.x = outer_rect.y = 0;
outer_rect.width = preview->tile_rect.width;
outer_rect.height = preview->tile_rect.height;
inner_rect.x = OUTLINE_WIDTH;
inner_rect.y = OUTLINE_WIDTH;
inner_rect.width = outer_rect.width - 2 * OUTLINE_WIDTH;
inner_rect.height = outer_rect.height - 2 * OUTLINE_WIDTH;
outer_region = cairo_region_create_rectangle (&outer_rect);
inner_region = cairo_region_create_rectangle (&inner_rect);
cairo_region_subtract (outer_region, inner_region);
cairo_region_destroy (inner_region);
gdk_window_shape_combine_region (window, outer_region, 0, 0);
cairo_region_destroy (outer_region);
}
}
void

View File

@@ -27,7 +27,8 @@
typedef struct _MetaTilePreview MetaTilePreview;
MetaTilePreview *meta_tile_preview_new (int screen_number);
MetaTilePreview *meta_tile_preview_new (int screen_number,
gboolean composited);
void meta_tile_preview_free (MetaTilePreview *preview);
void meta_tile_preview_show (MetaTilePreview *preview,
MetaRectangle *rect);