Compare commits

..

31 Commits

Author SHA1 Message Date
Carlos Garnacho
25bbb4cc40 backends: Allow multiple "SW" cursor overlays on the stage
All the upper layers are prepared for multiple onscreen cursors, but
this. All MetaCursorRenderers created would poke the same internal
MetaOverlay in the stage.

This will lead to multiple cursor renderers resorting to the "SW"
rendering paths (as it can be seen with tablet support) to reuse the
same overlay, thus leading to flickering when a different
MetaCursorRenderer takes over the overlay.

Fix this by allowing per-cursor-renderer overlays, their lifetime
is attached to the cursor renderer, so is expected to be tear down
if the relevant device (eg. tablet) disappears.
2016-05-02 13:49:13 +02:00
Carlos Garnacho
3a963d95db wayland: Ensure each MetaWaylandSeat gets its MetaWaylandTabletSeat
Those need to be created in advance in order to handle properly the
events, even on lack of requesting clients.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
212a170ae2 core: Update tablet cursors
On wayland, tablets have their standalone pointer, which must be updated
on events from the corresponding device.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
17f2b4ea43 wayland: Add methods to update the position of different tools' cursors 2016-05-02 12:26:50 +02:00
Carlos Garnacho
4ce4f4eac9 wayland: Implement tool notification
Those must be notified to clients before proximity_in, only if the client
didn't have a resource for this tool previously.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
d7b8db3c96 wayland: Let MetaWaylandTabletManager process tablet events
meta_wayland_tablet_manager_update()/handle_event() are called before
the MetaWaylandSeat counterparts. If the event comes from a device
managed by MetaWaylandTabletManager, the event will be exclusively handled
by it.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
754a4bf287 wayland: Implement wl_tablet_tool.set_cursor
Each tool has its own MetaCursorRenderer instance, which is created/destroyed
upon proximity, and possibly updated through focus and set_cursor calls in
between.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
d46586e383 wayland: Implement wl_tablet_tool device event emission
This takes care of the emission of motion/down/up/button, in addition
to the extra distance/pressure/tilt axes.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
38bff73d30 wayland: Add focus management to MetaWaylandTabletTool
Tools can now switch between surfaces, which implies the emission
of wl_tablet_tool.proximity_in/out events.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
aaa59ab6a7 wayland: Initialize the MetaWaylandTabletManager 2016-05-02 12:26:50 +02:00
Carlos Garnacho
dff045963a wayland: Add MetaWaylandTabletManager
This struct keeps the server side information for the wl_tablet_manager
global resource. It keeps the clients requesting this interface, and
does keep track of the plugged tablet devices, so
wl_tablet_manager.device_added is emitted on the expected clients.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
6bbd6d2948 wayland: Add MetaWaylandTabletSeat
This object groups all the tablets/tools pertaining to a given seat.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
2ea01aa428 wayland: Add MetaWaylandTabletTool
This struct holds the server-side information of a wl_tablet_tool, which
represents an specific tool of an specific tablet, and is unique as such.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
1a31721e57 wayland: Add MetaWaylandTablet
This (very basic at the moment) struct keeps server-side information
for wl_tablet resources.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
033c78a7a2 protocol: Generate code for the tablet protocol
This is provided by wayland-protocols
2016-05-02 12:26:50 +02:00
Carlos Garnacho
f1afc604d9 backend: Realize cursor on default MetaCursorRenderer paths
The cursor is realized on x11/native subclasses, but not if a base
MetaCursorRenderer is created.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
c89edb29f9 wayland: Refactor MetaWaylandSurfaceRoleCursor
Move into a standalone meta-wayland-surface-role-cursor.[ch], and
make generic enough to work for pointe and additional (eg. tablet)
cursors.

Most notably, the sprite is now kept completely internal to the
cursor role, and updates are routed through the given
MetaCursorRenderer (which may be the default one for the pointer,
or something else).

The way cursor updates after cursor surface destruction has also
been reworked, the pointer will just keep track of the last cursor
surface, so older surfaces being destroyed don't trigger pointer
rechecks/updates.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
c28fc68df1 wayland: Add MetaWaylandSurface::destroy signal
There's places where it would be convenient to add listeners to this,
so add the signal. The signal is only emitted once during destruction,
it is convenient for the places where we want notifications at a time
the object is still alive, as opposed to weak refs which notify after
the fact.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
5774875ab9 evdev: Avoid updating seat pointer position on tablet events 2016-05-02 12:26:50 +02:00
Carlos Garnacho
422284e0cd evdev: Implement ClutterInputDevice::update_from_tool
This vfunc pokes the libinput_tool in order to find out the currently
available axes, and updates the device as such.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
c72ad23b84 main: Allow updating device axes from the current tool
This way devices are ensured the proper axis status at the time
of processing the events.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
d0d343352c evdev: Implement tablet events
Tablet proximity, motion and button events are translated into ClutterEvents,
and the device state is updated accordingly.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
feff353081 evdev: Implement ClutterInputDeviceTool
This will be backed by a libinput_tool, the type and serial are
fetched from there.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
216298dfad events: Add proximity events
These events will be sent on tool proximity of tablet events.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
efd90eb471 event: Add ClutterInputDeviceTool information to clutter events
These can be used to determine the tool that's being in use for a given event
2016-05-02 12:26:50 +02:00
Carlos Garnacho
63b1a55283 input-device: Add ClutterInputDeviceTool
This is an unique opaque struct that identifies a given tool of
a given device.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
aa0eea9814 enums: Add rotation/slider axes
These will be useful for the tablet tools that have these features.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
fe5f12ddb5 evdev: Map LIBINPUT_DEVICE_CAP_TABLET to CLUTTER_TABLET_DEVICE
This is so tablet devices have the correct ClutterInputDeviceType
2016-05-02 12:26:50 +02:00
Carlos Garnacho
8110197df4 evdev: Pass axis parameters when notifying absolute motion events
This will be useful for tablet support, NULL is given in the current
callers.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
8d290f182a input-device: Disconnect signals on actors where the device has a cursor
Otherwise the signals are left dangling if the device is removed, causing
possible invalid memory accesses afterwards.
2016-05-02 12:26:50 +02:00
Carlos Garnacho
9d06421c1f evdev: Use device name rather than sysname
The device name is something more natural, similar to what's seen
in X11, the sysname is rather the event node basename, which may
also vary depending on device insertion/detection time.
2016-05-02 12:26:50 +02:00
41 changed files with 1397 additions and 2402 deletions

15
NEWS
View File

@@ -1,18 +1,3 @@
3.21.2
======
* Clean up surface <-> shell interaction [Jonas; #763431]
* Fix grabbing random keys for disabled shortcuts [Rui; #766270]
* Fix stacking of hidden windows on wayland [Rui; #764844]
* Misc. bug fixes [Victor, Florian, Marek, Rui; #766306, #766326, #751847,
#763832, #766528]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Marek Chalupa, Matthias Clasen,
Carlos Garnacho, Rui Matos, Florian Müllner, Victor Toso
Translations:
Tiago Santos [pt], Cédric Valmary [oc], Muhammet Kara [tr]
3.21.1
======
* Notify clients of pending modifier state changes [Rui; #748526]

View File

@@ -4044,10 +4044,6 @@ clutter_text_class_init (ClutterTextClass *klass)
CLUTTER_KEY_a, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_select_all),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "select-all",
CLUTTER_KEY_A, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_select_all),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-next",
CLUTTER_KEY_Delete, 0,

View File

@@ -2,7 +2,7 @@ AC_PREREQ(2.62)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [21])
m4_define([mutter_micro_version], [2])
m4_define([mutter_micro_version], [1])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])
@@ -52,7 +52,7 @@ AC_HEADER_STDC
PKG_PROG_PKG_CONFIG([0.21])
# Sets GLIB_GENMARSHAL and GLIB_MKENUMS
AM_PATH_GLIB_2_0([2.49.0])
AM_PATH_GLIB_2_0()
CANBERRA_GTK=libcanberra-gtk3
CANBERRA_GTK_VERSION=0.26

View File

@@ -28,7 +28,6 @@ clutter/clutter/clutter-gesture-action.c
clutter/clutter/clutter-grid-layout.c
clutter/clutter/clutter-image.c
clutter/clutter/clutter-input-device.c
clutter/clutter/clutter-input-device-tool.c
clutter/clutter/clutter-interval.c
clutter/clutter/clutter-layout-manager.c
clutter/clutter/clutter-layout-meta.c

View File

@@ -8,8 +8,8 @@ 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: 2016-04-29 13:18+0000\n"
"PO-Revision-Date: 2016-05-08 18:48+0200\n"
"POT-Creation-Date: 2016-02-28 13:37+0000\n"
"PO-Revision-Date: 2016-02-28 17:25+0200\n"
"Last-Translator: Cédric Valmary (totenoc.eu) <cvalmary@yahoo.fr>\n"
"Language-Team: Tot En Òc\n"
"Language: oc\n"
@@ -50,7 +50,7 @@ msgstr "Desplaçar la fenèstra d'un espaci de trabalh cap a esquèrra"
#: ../data/50-mutter-navigation.xml.in.h:8
msgid "Move window one workspace to the right"
msgstr "Desplaçar la fenèstra d'un espaci de trabalh cap a dreita"
msgstr "Desplaçar la fenèstra d'un espaci de trabalh cap a drecha"
#: ../data/50-mutter-navigation.xml.in.h:9
msgid "Move window one workspace up"
@@ -66,7 +66,7 @@ msgstr "Desplaçar la fenèstra d'un ecran cap a esquèrra"
#: ../data/50-mutter-navigation.xml.in.h:12
msgid "Move window one monitor to the right"
msgstr "Desplaçar la fenèstra d'un ecran cap a dreita"
msgstr "Desplaçar la fenèstra d'un ecran cap a drecha"
#: ../data/50-mutter-navigation.xml.in.h:13
msgid "Move window one monitor up"
@@ -162,7 +162,7 @@ msgstr "Desplaçar cap a l'espaci de trabalh d'esquèrra"
#: ../data/50-mutter-navigation.xml.in.h:36
msgid "Move to workspace right"
msgstr "Desplaçar cap a l'espaci de trabalh de dreita"
msgstr "Desplaçar cap a l'espaci de trabalh de drecha"
#: ../data/50-mutter-navigation.xml.in.h:37
msgid "Move to workspace above"
@@ -258,7 +258,7 @@ msgstr "Vista devesida a esquèrra"
#: ../data/50-mutter-windows.xml.in.h:19
msgid "View split on right"
msgstr "Vista devesida a dreita"
msgstr "Vista devesida a drecha"
#: ../data/mutter.desktop.in.h:1
msgid "Mutter"
@@ -460,22 +460,22 @@ msgstr "Passar a l'emulator de terminal 11"
msgid "Switch to VT 12"
msgstr "Passar a l'emulator de terminal 12"
#: ../src/backends/meta-monitor-manager.c:515
#: ../src/backends/meta-monitor-manager.c:518
msgid "Built-in display"
msgstr "Afichatge integrat"
#: ../src/backends/meta-monitor-manager.c:538
#: ../src/backends/meta-monitor-manager.c:544
msgid "Unknown"
msgstr "Desconegut"
#: ../src/backends/meta-monitor-manager.c:540
#: ../src/backends/meta-monitor-manager.c:546
msgid "Unknown Display"
msgstr "Afichatge desconegut"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:548
#: ../src/backends/meta-monitor-manager.c:554
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -491,7 +491,7 @@ msgstr ""
"Un autre gestionari de composicion es ja aviat sus l'ecran %i de l'afichatge "
"« %s »."
#: ../src/core/bell.c:194
#: ../src/core/bell.c:185
msgid "Bell event"
msgstr "Eveniment sonòr"
@@ -543,7 +543,7 @@ msgstr "Afichatge X d'utilizar"
#: ../src/core/main.c:204
msgid "Initialize session from savefile"
msgstr "Inicializar la session dempuèi lo fichièr de salvament"
msgstr "Inicializar la session dempuèi lo fichier de salvament"
#: ../src/core/main.c:210
msgid "Make X calls synchronous"
@@ -554,6 +554,7 @@ msgid "Run as a wayland compositor"
msgstr "Aviar coma un compositor wayland"
#: ../src/core/main.c:223
#| msgid "Run as a wayland compositor"
msgid "Run as a nested compositor"
msgstr ""
@@ -572,7 +573,7 @@ msgid ""
msgstr ""
"mutter %s\n"
"Copyright © 2001-%d Havoc Pennington, Red Hat, Inc., e autres.\n"
"Aquò es un logicial liure ; consultatz lo còdi font per las\n"
"Aquò es un logicial liure ; consultatz lo còde font per las\n"
"condicions de còpia.\n"
"I a PAS CAP DE garantida ; quitament pas de VALOR MERCANDA o\n"
"d'ADEQÜACION A UN USATGE PARTICULAR.\n"

View File

@@ -6,22 +6,22 @@
# Baris Cicek <baris@teamforce.name.tr>, 2004, 2005, 2008, 2009.
# İlker DAĞLI <ilker@ilkerdagli.info>, 2011.
# Muhammed EKEN <gnome@m-eken.com>, 2011.
# Muhammet Kara <muhammetk@gmail.com>, 2011, 2012, 2014, 2015, 2016.
# Muhammet Kara <muhammetk@gmail.com>, 2011, 2012, 2014, 2015.
#
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: 2016-05-10 20:26+0000\n"
"PO-Revision-Date: 2016-05-26 22:25+0300\n"
"POT-Creation-Date: 2015-03-21 23:08+0000\n"
"PO-Revision-Date: 2015-03-22 15:57+0200\n"
"Last-Translator: Muhammet Kara <muhammetk@gmail.com>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.6\n"
"X-Generator: Gtranslator 2.91.6\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../data/50-mutter-navigation.xml.in.h:1
@@ -73,10 +73,12 @@ msgid "Move window one monitor to the right"
msgstr "Pencereyi sağdaki monitöre taşı"
#: ../data/50-mutter-navigation.xml.in.h:13
#| msgid "Move window one workspace up"
msgid "Move window one monitor up"
msgstr "Pencereyi üstteki monitöre taşı"
#: ../data/50-mutter-navigation.xml.in.h:14
#| msgid "Move window one workspace down"
msgid "Move window one monitor down"
msgstr "Pencereyi alttaki monitöre taşı"
@@ -97,10 +99,12 @@ msgid "Switch to previous window"
msgstr "Önceki pencereye geç"
#: ../data/50-mutter-navigation.xml.in.h:19
#| msgid "Move between windows of an application immediately"
msgid "Switch windows of an application"
msgstr "Uygulamanın pencereleri arasında geçiş yap"
#: ../data/50-mutter-navigation.xml.in.h:20
#| msgid "Move between windows of an application immediately"
msgid "Switch to previous window of an application"
msgstr "Uygulamanın bir önceki penceresine geç"
@@ -121,6 +125,7 @@ msgid "Switch directly to previous window"
msgstr "Önceki pencereye doğrudan geç"
#: ../data/50-mutter-navigation.xml.in.h:25
#| msgid "Move between windows of an application immediately"
msgid "Switch windows of an app directly"
msgstr "Uygulamanın pencereleri arasında anında geçiş yap"
@@ -137,6 +142,7 @@ msgid "Switch directly to previous system control"
msgstr "Önceki sistem denetimine doğrudan geç"
#: ../data/50-mutter-navigation.xml.in.h:29
#| msgid "Hide all normal windows and set focus to the desktop"
msgid "Hide all normal windows"
msgstr "Tüm normal pencereleri gizle"
@@ -157,22 +163,27 @@ msgid "Switch to workspace 4"
msgstr "Çalışma alanı 4'e geç"
#: ../data/50-mutter-navigation.xml.in.h:34
#| msgid "Switch to workspace 1"
msgid "Switch to last workspace"
msgstr "Son çalışma alanına geç"
#: ../data/50-mutter-navigation.xml.in.h:35
#| msgid "Move to Workspace _Left"
msgid "Move to workspace left"
msgstr "Soldaki çalışma alanına taşı"
#: ../data/50-mutter-navigation.xml.in.h:36
#| msgid "Move to Workspace R_ight"
msgid "Move to workspace right"
msgstr "Sağdaki çalışma alanına taşı"
#: ../data/50-mutter-navigation.xml.in.h:37
#| msgid "Move to Workspace _Left"
msgid "Move to workspace above"
msgstr "Üstteki çalışma alanına taşı"
#: ../data/50-mutter-navigation.xml.in.h:38
#| msgid "Move to Workspace _Down"
msgid "Move to workspace below"
msgstr "Alttaki çalışma alanına taşı"
@@ -181,6 +192,7 @@ msgid "System"
msgstr "Sistem"
#: ../data/50-mutter-system.xml.in.h:2
#| msgid "Show the panel's main menu"
msgid "Show the run command prompt"
msgstr "Komut çalıştırma istemini göster"
@@ -233,12 +245,14 @@ msgid "Resize window"
msgstr "Pencereyi yeniden boyutlandır"
#: ../data/50-mutter-windows.xml.in.h:12
#| msgid "Toggle whether window is on all workspaces or just one"
msgid "Toggle window on all workspaces or one"
msgstr ""
"Pencerenin tüm çalışma alanlarında veya sadece bir tanesi üzerinde olmasını "
"seç"
#: ../data/50-mutter-windows.xml.in.h:13
#| msgid "Raise window if it's covered by another window, otherwise lower it"
msgid "Raise window if covered, otherwise lower it"
msgstr ""
"Pencere eğer başkası tarafından kapatılmışsa yukarı çıkar, yoksa aşağıya it"
@@ -360,6 +374,11 @@ msgid "Delay focus changes until the pointer stops moving"
msgstr "Odak değişikliklerini işaretçi hareketi durana kadar ertele"
#: ../data/org.gnome.mutter.gschema.xml.in.h:14
#| msgid ""
#| "If set to true, and the focus mode is either \"sloppy\" or \"mouse\" then "
#| "the focused window will be automatically raised after a delay specified "
#| "by the auto_raise_delay key. This is not related to clicking on a window "
#| "to raise it, nor to entering a window during drag-and-drop."
msgid ""
"If set to true, and the focus mode is either \"sloppy\" or \"mouse\" then "
"the focus will not be changed immediately when entering a window, but only "
@@ -414,69 +433,81 @@ msgid "Cancel tab popup"
msgstr "Sekmeyi yeni pencerede açmayı iptal et"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:1
#| msgid "Switch to workspace 1"
msgid "Switch to VT 1"
msgstr "VT 1'e geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:2
#| msgid "Switch to workspace 2"
msgid "Switch to VT 2"
msgstr "VT 2'ye geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:3
#| msgid "Switch to workspace 3"
msgid "Switch to VT 3"
msgstr "VT 3'e geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:4
#| msgid "Switch to workspace 4"
msgid "Switch to VT 4"
msgstr "VT 4'e geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:5
#| msgid "Switch to workspace 5"
msgid "Switch to VT 5"
msgstr "VT 5'e geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:6
#| msgid "Switch to workspace 6"
msgid "Switch to VT 6"
msgstr "VT 6'ya geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:7
#| msgid "Switch to workspace 7"
msgid "Switch to VT 7"
msgstr "VT 7'ye geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:8
#| msgid "Switch to workspace 1"
msgid "Switch to VT 8"
msgstr "VT 8'e geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:9
#| msgid "Switch to workspace 1"
msgid "Switch to VT 9"
msgstr "VT 9'a geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:10
#| msgid "Switch to workspace 1"
msgid "Switch to VT 10"
msgstr "VT 10'a geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:11
#| msgid "Switch to workspace 1"
msgid "Switch to VT 11"
msgstr "VT 11'e geç"
#: ../data/org.gnome.mutter.wayland.gschema.xml.in.h:12
#| msgid "Switch to workspace 1"
msgid "Switch to VT 12"
msgstr "VT 12'ye geç"
#: ../src/backends/meta-monitor-manager.c:515
#: ../src/backends/meta-monitor-manager.c:364
msgid "Built-in display"
msgstr "Yerleşik ekran"
#: ../src/backends/meta-monitor-manager.c:538
#: ../src/backends/meta-monitor-manager.c:391
msgid "Unknown"
msgstr "Bilinmiyor"
#: ../src/backends/meta-monitor-manager.c:540
#: ../src/backends/meta-monitor-manager.c:393
msgid "Unknown Display"
msgstr "Bilinmeyen Ekran"
#. TRANSLATORS: this is a monitor vendor name, followed by a
#. * size in inches, like 'Dell 15"'
#.
#: ../src/backends/meta-monitor-manager.c:548
#: ../src/backends/meta-monitor-manager.c:401
#, c-format
msgid "%s %s"
msgstr "%s %s"
@@ -492,7 +523,7 @@ msgstr ""
"\"%2$s\" monitöründeki %1$i ekranında zaten başka bir birleştirme yöneticisi "
"çalışıyor."
#: ../src/core/bell.c:194
#: ../src/core/bell.c:185
msgid "Bell event"
msgstr "Etkinlik zili"
@@ -521,44 +552,40 @@ msgstr "_Bekle"
msgid "_Force Quit"
msgstr "_Sonlandır"
#: ../src/core/display.c:555
#: ../src/core/display.c:562
#, c-format
msgid "Failed to open X Window System display '%s'\n"
msgstr "X Pencere Sistemi '%s' ekranıılamadı\n"
#: ../src/core/main.c:181
#: ../src/core/main.c:176
msgid "Disable connection to session manager"
msgstr "Ortam yöneticisine olan bağlantıyı kapat"
#: ../src/core/main.c:187
#: ../src/core/main.c:182
msgid "Replace the running window manager"
msgstr "Çalışan pencere yöneticisinin yerini al"
#: ../src/core/main.c:193
#: ../src/core/main.c:188
msgid "Specify session management ID"
msgstr "Ortam yönetim ID'sini belirtin"
#: ../src/core/main.c:198
#: ../src/core/main.c:193
msgid "X Display to use"
msgstr "Kullanılacak X Ekranı"
#: ../src/core/main.c:204
#: ../src/core/main.c:199
msgid "Initialize session from savefile"
msgstr "Ortamı kayıtlı dosyadan başlat"
#: ../src/core/main.c:210
#: ../src/core/main.c:205
msgid "Make X calls synchronous"
msgstr "X çağrılarını eşazamanlı yap"
#: ../src/core/main.c:217
#: ../src/core/main.c:212
msgid "Run as a wayland compositor"
msgstr "Bir wayland dizgicisi olarak çalıştır"
#: ../src/core/main.c:223
msgid "Run as a nested compositor"
msgstr "Yuvalanmış dizgici olarak çalıştır"
#: ../src/core/main.c:231
#: ../src/core/main.c:220
msgid "Run as a full display server, rather than nested"
msgstr "İç içe değil tam ekran sunucusu olarak çalıştır"
@@ -584,13 +611,16 @@ msgstr "Sürümü yazdır"
msgid "Mutter plugin to use"
msgstr "Kullanılacak Mutter eklentisi"
#: ../src/core/prefs.c:1997
#: ../src/core/prefs.c:2004
#, c-format
msgid "Workspace %d"
msgstr "Çalışma Alanı %d"
#: ../src/core/screen.c:521
#: ../src/core/screen.c:525
#, 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"
msgid ""
"Display \"%s\" already has a window manager; try using the --replace option "
"to replace the current window manager."
@@ -599,12 +629,12 @@ msgstr ""
"yöneticisinin yerine bir başkasını koymak için --replace seçeneğini "
"kullanmayı deneyin."
#: ../src/core/screen.c:603
#: ../src/core/screen.c:607
#, c-format
msgid "Screen %d on display '%s' is invalid\n"
msgstr "'%2$s' X oturumundaki ekran %1$d geçersiz\n"
#: ../src/core/util.c:121
#: ../src/core/util.c:118
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter, ayrıntılı kip desteği olmadan derlenmiş\n"

View File

@@ -314,10 +314,6 @@ libmutter_la_SOURCES += \
wayland/meta-wayland-outputs.h \
wayland/meta-window-wayland.c \
wayland/meta-window-wayland.h \
wayland/meta-wayland-xdg-shell.c \
wayland/meta-wayland-xdg-shell.h \
wayland/meta-wayland-wl-shell.c \
wayland/meta-wayland-wl-shell.h \
$(NULL)
endif
@@ -506,7 +502,6 @@ $(dbus_display_config_built_sources) : Makefile.am org.gnome.Mutter.DisplayConfi
--interface-prefix org.gnome.Mutter \
--c-namespace MetaDBus \
--generate-c-code meta-dbus-display-config \
--c-generate-autocleanup all \
$(srcdir)/org.gnome.Mutter.DisplayConfig.xml
$(dbus_idle_built_sources) : Makefile.am org.gnome.Mutter.IdleMonitor.xml
@@ -515,7 +510,6 @@ $(dbus_idle_built_sources) : Makefile.am org.gnome.Mutter.IdleMonitor.xml
--c-namespace MetaDBus \
--generate-c-code meta-dbus-idle-monitor \
--c-generate-object-manager \
--c-generate-autocleanup all \
$(srcdir)/org.gnome.Mutter.IdleMonitor.xml
dbus_login1_built_sources = meta-dbus-login1.c meta-dbus-login1.h
@@ -525,7 +519,6 @@ $(dbus_login1_built_sources) : Makefile.am org.freedesktop.login1.xml
--interface-prefix org.freedesktop.login1 \
--c-namespace Login1 \
--generate-c-code meta-dbus-login1 \
--c-generate-autocleanup all \
$(srcdir)/org.freedesktop.login1.xml
.SECONDEXPANSION:

View File

@@ -190,7 +190,6 @@ struct _MetaMonitorMode
int width;
int height;
float refresh_rate;
guint32 flags;
gpointer driver_private;
GDestroyNotify driver_notify;

View File

@@ -590,7 +590,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
g_variant_builder_init (&crtc_builder, G_VARIANT_TYPE ("a(uxiiiiiuaua{sv})"));
g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiausauaua{sv})"));
g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuudu)"));
g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuud)"));
for (i = 0; i < manager->n_crtcs; i++)
{
@@ -714,13 +714,12 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
{
MetaMonitorMode *mode = &manager->modes[i];
g_variant_builder_add (&mode_builder, "(uxuudu)",
g_variant_builder_add (&mode_builder, "(uxuud)",
i, /* ID */
(gint64)mode->mode_id,
(guint32)mode->width,
(guint32)mode->height,
(double)mode->refresh_rate,
(guint32)mode->flags);
(double)mode->refresh_rate);
}
meta_dbus_display_config_complete_get_resources (skeleton,

View File

@@ -49,6 +49,8 @@
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevClient, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUdevEnumerator, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Login1Session, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Login1Seat, g_object_unref)
struct _MetaLauncher
{

View File

@@ -632,7 +632,6 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
meta_mode->name = g_strndup (mode->name, DRM_DISPLAY_MODE_LEN);
meta_mode->width = mode->hdisplay;
meta_mode->height = mode->vdisplay;
meta_mode->flags = mode->flags;
/* Calculate refresh rate in milliHz first for extra precision. */
meta_mode->refresh_rate = (mode->clock * 1000000LL) / mode->htotal;

View File

@@ -788,7 +788,6 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
mode->height = xmode->height;
mode->refresh_rate = (xmode->dotClock /
((float)xmode->hTotal * xmode->vTotal));
mode->flags = xmode->modeFlags;
mode->name = get_xmode_name (xmode);
}

View File

@@ -93,13 +93,15 @@ meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor)
}
double
meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *self)
meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *actor)
{
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (actor);
MetaWaylandSurface *surface = priv->surface;
MetaWindow *window;
int output_scale = 1;
g_assert (surface);
if (!surface)
return 1;
window = meta_wayland_surface_get_toplevel_window (surface);
@@ -107,7 +109,7 @@ meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *self)
if (window && window->client_type != META_WINDOW_CLIENT_TYPE_X11)
output_scale = meta_window_wayland_get_main_monitor_scale (window);
return (double) output_scale / (double) surface->scale;
return (double)output_scale / (double)priv->surface->scale;
}
static void
@@ -119,8 +121,6 @@ logical_to_actor_position (MetaSurfaceActorWayland *self,
MetaWindow *toplevel_window;
int monitor_scale = 1;
g_assert (surface);
toplevel_window = meta_wayland_surface_get_toplevel_window (surface);
if (toplevel_window)
monitor_scale = meta_window_wayland_get_main_monitor_scale (toplevel_window);
@@ -137,14 +137,11 @@ meta_surface_actor_wayland_get_subsurface_rect (MetaSurfaceActorWayland *self,
{
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface);
CoglTexture *texture;
CoglTexture *texture = buffer->texture;
MetaWindow *toplevel_window;
int monitor_scale;
float x, y;
g_assert (surface);
texture = buffer->texture;
toplevel_window = meta_wayland_surface_get_toplevel_window (surface);
monitor_scale = meta_window_wayland_get_main_monitor_scale (toplevel_window);
@@ -165,8 +162,6 @@ meta_surface_actor_wayland_sync_subsurface_state (MetaSurfaceActorWayland *self)
int x = surface->offset_x + surface->sub.x;
int y = surface->offset_y + surface->sub.y;
g_assert (surface);
window = meta_wayland_surface_get_toplevel_window (surface);
if (window && window->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
@@ -189,8 +184,6 @@ meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
double texture_scale;
g_assert (surface);
/* Given the surface's window type and what output the surface actor has the
* largest region, scale the actor with the determined scale. */
texture_scale = meta_surface_actor_wayland_get_scale (self);
@@ -245,12 +238,9 @@ void
meta_surface_actor_wayland_sync_state_recursive (MetaSurfaceActorWayland *self)
{
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
MetaWindow *window;
MetaWindow *window = meta_wayland_surface_get_toplevel_window (surface);
GList *iter;
g_assert (surface);
window = meta_wayland_surface_get_toplevel_window (surface);
meta_surface_actor_wayland_sync_state (self);
if (window && window->client_type != META_WINDOW_CLIENT_TYPE_X11)
@@ -311,8 +301,8 @@ meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
static MetaWindow *
meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor)
{
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (META_SURFACE_ACTOR_WAYLAND (actor));
MetaWaylandSurface *surface = priv->surface;
if (!surface)
return NULL;
@@ -321,26 +311,15 @@ meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor)
}
static void
meta_surface_actor_wayland_get_preferred_width (ClutterActor *actor,
meta_surface_actor_wayland_get_preferred_width (ClutterActor *self,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
MetaShapedTexture *stex;
double scale;
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
double scale = meta_surface_actor_wayland_get_scale (META_SURFACE_ACTOR_WAYLAND (self));
if (surface)
scale = meta_surface_actor_wayland_get_scale (self);
else
scale = 1.0;
stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
clutter_actor_get_preferred_width (CLUTTER_ACTOR (stex),
for_height,
min_width_p,
natural_width_p);
clutter_actor_get_preferred_width (CLUTTER_ACTOR (stex), for_height, min_width_p, natural_width_p);
if (min_width_p)
*min_width_p *= scale;
@@ -350,26 +329,15 @@ meta_surface_actor_wayland_get_preferred_width (ClutterActor *actor,
}
static void
meta_surface_actor_wayland_get_preferred_height (ClutterActor *actor,
meta_surface_actor_wayland_get_preferred_height (ClutterActor *self,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
MetaShapedTexture *stex;
double scale;
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
double scale = meta_surface_actor_wayland_get_scale (META_SURFACE_ACTOR_WAYLAND (self));
if (surface)
scale = meta_surface_actor_wayland_get_scale (self);
else
scale = 1.0;
stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
clutter_actor_get_preferred_height (CLUTTER_ACTOR (stex),
for_width,
min_height_p,
natural_height_p);
clutter_actor_get_preferred_height (CLUTTER_ACTOR (stex), for_width, min_height_p, natural_height_p);
if (min_height_p)
*min_height_p *= scale;
@@ -402,20 +370,8 @@ static void
meta_surface_actor_wayland_dispose (GObject *object)
{
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (object);
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
MetaWaylandFrameCallback *cb, *next;
meta_surface_actor_wayland_set_texture (self, NULL);
if (priv->surface)
{
g_object_remove_weak_pointer (G_OBJECT (priv->surface),
(gpointer *) &priv->surface);
priv->surface = NULL;
}
wl_list_for_each_safe (cb, next, &priv->frame_callback_list, link)
wl_resource_destroy (cb->resource);
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
}
@@ -466,8 +422,6 @@ meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
wl_list_init (&priv->frame_callback_list);
priv->surface = surface;
g_object_add_weak_pointer (G_OBJECT (priv->surface),
(gpointer *) &priv->surface);
return META_SURFACE_ACTOR (self);
}
@@ -486,3 +440,18 @@ meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
return priv->surface;
}
void
meta_surface_actor_wayland_surface_destroyed (MetaSurfaceActorWayland *self)
{
MetaWaylandFrameCallback *callback, *next;
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
wl_list_for_each_safe (callback, next, &priv->frame_callback_list, link)
{
wl_resource_destroy (callback->resource);
}
priv->surface = NULL;
}

View File

@@ -612,6 +612,20 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self,
MetaWindowActorPrivate *priv = self->priv;
cairo_region_get_extents (priv->shape_region, bounds);
#ifdef HAVE_WAYLAND
if (META_IS_SURFACE_ACTOR_WAYLAND (priv->surface))
{
MetaSurfaceActorWayland *surface_actor =
META_SURFACE_ACTOR_WAYLAND (priv->surface);
double scale = meta_surface_actor_wayland_get_scale (surface_actor);
bounds->x *= scale;
bounds->y *= scale;
bounds->width *= scale;
bounds->height *= scale;
}
#endif
}
static void

View File

@@ -219,7 +219,6 @@ meta_display_handle_event (MetaDisplay *display,
clutter_input_device_get_device_id (source));
}
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor () && event->type == CLUTTER_MOTION)
{
MetaWaylandCompositor *compositor;
@@ -238,7 +237,6 @@ meta_display_handle_event (MetaDisplay *display,
display->monitor_cache_invalidated = TRUE;
}
#endif
handle_idletime_for_event (event);

View File

@@ -1379,8 +1379,8 @@ meta_display_grab_accelerator (MetaDisplay *display,
MetaKeyBindingManager *keys = &display->key_binding_manager;
MetaKeyBinding *binding;
MetaKeyGrab *grab;
MetaKeyCombo combo = { 0 };
MetaResolvedKeyCombo resolved_combo = { 0 };
MetaKeyCombo combo;
MetaResolvedKeyCombo resolved_combo;
if (!meta_parse_accelerator (accelerator, &combo))
{

View File

@@ -326,10 +326,6 @@ gboolean
meta_parse_accelerator (const char *accel,
MetaKeyCombo *combo)
{
g_return_val_if_fail (combo != NULL, FALSE);
*combo = (MetaKeyCombo) { 0 };
if (!accel[0] || strcmp (accel, "disabled") == 0)
return TRUE;
@@ -340,11 +336,7 @@ gboolean
meta_parse_modifier (const char *accel,
MetaVirtualModifier *mask)
{
MetaKeyCombo combo = { 0 };
g_return_val_if_fail (mask != NULL, FALSE);
*mask = 0;
MetaKeyCombo combo;
if (accel == NULL || !accel[0] || strcmp (accel, "disabled") == 0)
return TRUE;

View File

@@ -142,19 +142,15 @@ meta_stack_remove (MetaStack *stack,
stack->added = g_list_remove (stack->added, window);
stack->sorted = g_list_remove (stack->sorted, window);
/* stack->removed is only used to update stack->xwindows */
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
/* Remember the window ID to remove it from the stack array.
* The macro is safe to use: Window is guaranteed to be 32 bits, and
* GUINT_TO_POINTER says it only works on 32 bits.
*/
stack->removed = g_list_prepend (stack->removed,
GUINT_TO_POINTER (window->xwindow));
if (window->frame)
stack->removed = g_list_prepend (stack->removed,
GUINT_TO_POINTER (window->frame->xwindow));
}
/* Remember the window ID to remove it from the stack array.
* The macro is safe to use: Window is guaranteed to be 32 bits, and
* GUINT_TO_POINTER says it only works on 32 bits.
*/
stack->removed = g_list_prepend (stack->removed,
GUINT_TO_POINTER (window->xwindow));
if (window->frame)
stack->removed = g_list_prepend (stack->removed,
GUINT_TO_POINTER (window->frame->xwindow));
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
@@ -853,20 +849,29 @@ static void
stack_do_window_additions (MetaStack *stack)
{
GList *tmp;
gint n_added;
gint i, n_added;
n_added = g_list_length (stack->added);
if (n_added > 0)
{
Window *end;
int old_size;
meta_topic (META_DEBUG_STACK,
"Adding %d windows to sorted list\n",
n_added);
old_size = stack->xwindows->len;
g_array_set_size (stack->xwindows, old_size + n_added);
end = &g_array_index (stack->xwindows, Window, old_size);
/* stack->added has the most recent additions at the
* front of the list, so we need to reverse it
*/
stack->added = g_list_reverse (stack->added);
i = 0;
tmp = stack->added;
while (tmp != NULL)
{
@@ -874,12 +879,12 @@ stack_do_window_additions (MetaStack *stack)
w = tmp->data;
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
g_array_append_val (stack->xwindows, w->xwindow);
end[i] = w->xwindow;
/* add to the main list */
stack->sorted = g_list_prepend (stack->sorted, w);
++i;
tmp = tmp->next;
}
@@ -1033,7 +1038,7 @@ stack_sync_to_xserver (MetaStack *stack)
GArray *x11_stacked;
GArray *all_root_children_stacked; /* wayland OR x11 */
GList *tmp;
GArray *hidden_stack_ids;
GArray *x11_hidden_stack_ids;
/* Bail out if frozen */
if (stack->freeze_count > 0)
@@ -1048,7 +1053,7 @@ stack_sync_to_xserver (MetaStack *stack)
x11_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
x11_hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
meta_topic (META_DEBUG_STACK, "Bottom to top: ");
meta_push_no_msg_prefix ();
@@ -1065,8 +1070,7 @@ stack_sync_to_xserver (MetaStack *stack)
meta_topic (META_DEBUG_STACK, "%u:%d - %s ",
w->layer, w->stack_position, w->desc);
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
g_array_append_val (x11_stacked, w->xwindow);
g_array_append_val (x11_stacked, w->xwindow);
if (w->frame)
top_level_window = w->frame->xwindow;
@@ -1083,7 +1087,8 @@ stack_sync_to_xserver (MetaStack *stack)
* the screens fullscreen guard_window. */
if (w->hidden)
{
g_array_append_val (hidden_stack_ids, stack_id);
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
g_array_append_val (x11_hidden_stack_ids, top_level_window);
continue;
}
@@ -1096,7 +1101,7 @@ stack_sync_to_xserver (MetaStack *stack)
/* The screen guard window sits above all hidden windows and acts as
* a barrier to input reaching these windows. */
guint64 guard_window_id = stack->screen->guard_window;
g_array_append_val (hidden_stack_ids, guard_window_id);
g_array_append_val (x11_hidden_stack_ids, guard_window_id);
/* Sync to server */
@@ -1107,8 +1112,8 @@ stack_sync_to_xserver (MetaStack *stack)
(guint64 *)all_root_children_stacked->data,
all_root_children_stacked->len);
meta_stack_tracker_restack_at_bottom (stack->screen->stack_tracker,
(guint64 *)hidden_stack_ids->data,
hidden_stack_ids->len);
(guint64 *)x11_hidden_stack_ids->data,
x11_hidden_stack_ids->len);
/* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */
@@ -1128,7 +1133,7 @@ stack_sync_to_xserver (MetaStack *stack)
x11_stacked->len);
g_array_free (x11_stacked, TRUE);
g_array_free (hidden_stack_ids, TRUE);
g_array_free (x11_hidden_stack_ids, TRUE);
g_array_free (all_root_children_stacked, TRUE);
}

View File

@@ -416,10 +416,8 @@ struct _MetaWindow
*
* For X11 windows, this matches XGetGeometry of the toplevel.
*
* For Wayland windows, the position matches the position of the
* surface associated with shell surface (wl_shell_surface, xdg_surface
* etc). The size matches the size surface size as displayed in the stage.
*/
* For Wayland windows, this matches the buffer size and where
* the surface actor is positioned. */
MetaRectangle buffer_rect;
/* Cached net_wm_icon_geometry */

View File

@@ -1259,7 +1259,6 @@ meta_window_unmanage (MetaWindow *window,
GList *tmp;
meta_verbose ("Unmanaging %s\n", window->desc);
window->unmanaging = TRUE;
#ifdef HAVE_WAYLAND
/* This needs to happen for both Wayland and XWayland clients,
@@ -1287,6 +1286,8 @@ meta_window_unmanage (MetaWindow *window,
meta_display_unregister_stamp (window->display, window->stamp);
window->unmanaging = TRUE;
if (meta_prefs_get_attach_modal_dialogs ())
{
GList *attached_children = NULL, *iter;

View File

@@ -115,7 +115,6 @@
* x winsys_id: the low-level ID of this mode
* u width, height: the resolution
* d frequency: refresh rate
* u flags: mode flags as defined in xf86drmMode.h and randr.h
Output and modes are read-only objects (except for output properties),
they can change only in accordance to HW changes (such as hotplugging
@@ -134,7 +133,7 @@
<arg name="serial" direction="out" type="u" />
<arg name="crtcs" direction="out" type="a(uxiiiiiuaua{sv})" />
<arg name="outputs" direction="out" type="a(uxiausauaua{sv})" />
<arg name="modes" direction="out" type="a(uxuudu)" />
<arg name="modes" direction="out" type="a(uxuud)" />
<arg name="max_screen_width" direction="out" type="i" />
<arg name="max_screen_height" direction="out" type="i" />
</method>

View File

@@ -53,80 +53,6 @@ output_resource_destroy (struct wl_resource *res)
wayland_output->resources = g_list_remove (wayland_output->resources, res);
}
static inline enum wl_output_transform
wl_output_transform_from_meta_monitor_transform (MetaMonitorTransform transform)
{
/* The enums are the same. */
return (enum wl_output_transform) transform;
}
static void
send_output_events (struct wl_resource *resource,
MetaWaylandOutput *wayland_output,
MetaMonitorInfo *monitor_info,
gboolean need_all_events)
{
int version = wl_resource_get_version (resource);
MetaOutput *output = monitor_info->outputs[0];
enum wl_output_transform transform = wl_output_transform_from_meta_monitor_transform (output->crtc->transform);
guint mode_flags = WL_OUTPUT_MODE_CURRENT;
MetaMonitorInfo *old_monitor_info = wayland_output->monitor_info;
enum wl_output_transform old_transform = wayland_output->transform;
guint old_mode_flags = wayland_output->mode_flags;
gint old_scale = wayland_output->scale;
gboolean need_done = FALSE;
if (need_all_events ||
old_monitor_info->rect.x != monitor_info->rect.x ||
old_monitor_info->rect.y != monitor_info->rect.y ||
old_transform != transform)
{
wl_output_send_geometry (resource,
(int)monitor_info->rect.x,
(int)monitor_info->rect.y,
monitor_info->width_mm,
monitor_info->height_mm,
output->subpixel_order,
output->vendor,
output->product,
transform);
need_done = TRUE;
}
if (output->crtc->current_mode == output->preferred_mode)
mode_flags |= WL_OUTPUT_MODE_PREFERRED;
if (need_all_events ||
old_monitor_info->rect.width != monitor_info->rect.width ||
old_monitor_info->rect.height != monitor_info->rect.height ||
old_monitor_info->refresh_rate != monitor_info->refresh_rate ||
old_mode_flags != mode_flags)
{
wl_output_send_mode (resource,
mode_flags,
(int)monitor_info->rect.width,
(int)monitor_info->rect.height,
(int)(monitor_info->refresh_rate * 1000));
need_done = TRUE;
}
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION)
{
if (need_all_events ||
old_scale != output->scale)
{
wl_output_send_scale (resource, output->scale);
need_done = TRUE;
}
if (need_done)
wl_output_send_done (resource);
}
}
static void
bind_output (struct wl_client *client,
void *data,
@@ -136,6 +62,7 @@ bind_output (struct wl_client *client,
MetaWaylandOutput *wayland_output = data;
MetaMonitorInfo *monitor_info = wayland_output->monitor_info;
struct wl_resource *resource;
guint mode_flags;
MetaOutput *output = monitor_info->outputs[0];
resource = wl_resource_create (client, &wl_output_interface, version, id);
@@ -150,7 +77,35 @@ bind_output (struct wl_client *client,
monitor_info->rect.width, monitor_info->rect.height,
monitor_info->refresh_rate);
send_output_events (resource, wayland_output, monitor_info, TRUE);
wl_output_send_geometry (resource,
(int)monitor_info->rect.x,
(int)monitor_info->rect.y,
monitor_info->width_mm,
monitor_info->height_mm,
/* Cogl values reflect XRandR values,
and so does wayland */
output->subpixel_order,
output->vendor,
output->product,
output->crtc->transform);
g_assert (output->crtc->current_mode != NULL);
mode_flags = WL_OUTPUT_MODE_CURRENT;
if (output->crtc->current_mode == output->preferred_mode)
mode_flags |= WL_OUTPUT_MODE_PREFERRED;
wl_output_send_mode (resource,
mode_flags,
(int)monitor_info->rect.width,
(int)monitor_info->rect.height,
(int)(monitor_info->refresh_rate * 1000));
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION)
wl_output_send_scale (resource, output->scale);
if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
wl_output_send_done (resource);
}
static void
@@ -162,19 +117,11 @@ wayland_output_destroy_notify (gpointer data)
g_object_unref (wayland_output);
}
static void
wayland_output_set_monitor_info (MetaWaylandOutput *wayland_output,
MetaMonitorInfo *monitor_info)
static inline enum wl_output_transform
wl_output_transform_from_meta_monitor_transform (MetaMonitorTransform transform)
{
MetaOutput *output = monitor_info->outputs[0];
enum wl_output_transform transform = wl_output_transform_from_meta_monitor_transform (output->crtc->transform);
wayland_output->monitor_info = monitor_info;
wayland_output->transform = transform;
wayland_output->mode_flags = WL_OUTPUT_MODE_CURRENT;
if (output->crtc->current_mode == output->preferred_mode)
wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED;
wayland_output->scale = output->scale;
/* The enums are the same. */
return (enum wl_output_transform) transform;
}
static void
@@ -182,21 +129,50 @@ wayland_output_update_for_output (MetaWaylandOutput *wayland_output,
MetaMonitorInfo *monitor_info)
{
GList *iter;
guint mode_flags;
MetaOutput *output = monitor_info->outputs[0];
enum wl_output_transform wl_transform = wl_output_transform_from_meta_monitor_transform (output->crtc->transform);
mode_flags = WL_OUTPUT_MODE_CURRENT;
if (output->crtc->current_mode == output->preferred_mode)
mode_flags |= WL_OUTPUT_MODE_PREFERRED;
for (iter = wayland_output->resources; iter; iter = iter->next)
{
struct wl_resource *resource = iter->data;
send_output_events (resource, wayland_output, monitor_info, FALSE);
if (wayland_output->x != monitor_info->rect.x ||
wayland_output->y != monitor_info->rect.y ||
wayland_output->transform != wl_transform)
{
wl_output_send_geometry (resource,
(int)monitor_info->rect.x,
(int)monitor_info->rect.y,
monitor_info->width_mm,
monitor_info->height_mm,
output->subpixel_order,
output->vendor,
output->product,
wl_transform);
}
wl_output_send_mode (resource,
mode_flags,
(int)monitor_info->rect.width,
(int)monitor_info->rect.height,
(int)(monitor_info->refresh_rate * 1000));
}
/* It's very important that we change the output pointer here, as
the old structure is about to be freed by MetaMonitorManager */
wayland_output_set_monitor_info (wayland_output, monitor_info);
wayland_output->monitor_info = monitor_info;
wayland_output->x = monitor_info->rect.x;
wayland_output->y = monitor_info->rect.y;
wayland_output->transform = wl_transform;
}
static MetaWaylandOutput *
meta_wayland_output_new (MetaWaylandCompositor *compositor,
MetaMonitorInfo *monitor_info)
meta_wayland_output_new (MetaWaylandCompositor *compositor)
{
MetaWaylandOutput *wayland_output;
@@ -205,7 +181,6 @@ meta_wayland_output_new (MetaWaylandCompositor *compositor,
&wl_output_interface,
META_WL_OUTPUT_VERSION,
wayland_output, bind_output);
wayland_output_set_monitor_info (wayland_output, monitor_info);
return wayland_output;
}
@@ -236,7 +211,7 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
g_hash_table_steal (compositor->outputs, GSIZE_TO_POINTER (info->winsys_id));
}
else
wayland_output = meta_wayland_output_new (compositor, info);
wayland_output = meta_wayland_output_new (compositor);
wayland_output_update_for_output (wayland_output, info);
g_hash_table_insert (new_table, GSIZE_TO_POINTER (info->winsys_id), wayland_output);

View File

@@ -41,11 +41,10 @@ struct _MetaWaylandOutput
{
GObject parent;
struct wl_global *global;
MetaMonitorInfo *monitor_info;
struct wl_global *global;
int x, y;
enum wl_output_transform transform;
guint mode_flags;
gint scale;
GList *resources;
};

View File

@@ -874,12 +874,13 @@ meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer)
{
MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)pointer->grab;
meta_wayland_popup_grab_end (popup_grab);
meta_wayland_popup_grab_destroy (popup_grab);
}
MetaWaylandPopup *
meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
MetaWaylandPopupSurface *popup_surface)
meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface)
{
MetaWaylandPopupGrab *grab;
@@ -888,11 +889,16 @@ meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
return NULL;
if (pointer->grab == &pointer->default_grab)
grab = meta_wayland_popup_grab_create (pointer, popup_surface);
{
struct wl_client *client = wl_resource_get_client (surface->resource);
grab = meta_wayland_popup_grab_create (pointer, client);
meta_wayland_popup_grab_begin (grab, surface);
}
else
grab = (MetaWaylandPopupGrab*)pointer->grab;
return meta_wayland_popup_create (popup_surface, grab);
return meta_wayland_popup_create (surface, grab);
}
void

View File

@@ -112,8 +112,8 @@ void meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer,
void meta_wayland_pointer_end_grab (MetaWaylandPointer *pointer);
MetaWaylandPopup *meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
MetaWaylandPopupSurface *popup_surface);
MetaWaylandPopup *meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
MetaWaylandSurface *popup);
void meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer);

View File

@@ -48,9 +48,6 @@
#include "meta-wayland-private.h"
#include "meta-wayland-surface.h"
G_DEFINE_INTERFACE (MetaWaylandPopupSurface, meta_wayland_popup_surface,
G_TYPE_OBJECT);
struct _MetaWaylandPopupGrab
{
MetaWaylandPointerGrab generic;
@@ -62,40 +59,13 @@ struct _MetaWaylandPopupGrab
struct _MetaWaylandPopup
{
MetaWaylandPopupGrab *grab;
MetaWaylandPopupSurface *popup_surface;
struct wl_list link;
MetaWaylandSurface *surface;
struct wl_listener surface_destroy_listener;
struct wl_signal destroy_signal;
struct wl_list link;
};
static void
meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
MetaWaylandSurface *surface);
static void
meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab);
static void
meta_wayland_popup_surface_default_init (MetaWaylandPopupSurfaceInterface *iface)
{
}
static void
meta_wayland_popup_surface_done (MetaWaylandPopupSurface *popup_surface)
{
META_WAYLAND_POPUP_SURFACE_GET_IFACE (popup_surface)->done (popup_surface);
}
static void
meta_wayland_popup_surface_dismiss (MetaWaylandPopupSurface *popup_surface)
{
META_WAYLAND_POPUP_SURFACE_GET_IFACE (popup_surface)->dismiss (popup_surface);
}
static MetaWaylandSurface *
meta_wayland_popup_surface_get_surface (MetaWaylandPopupSurface *popup_surface)
{
return META_WAYLAND_POPUP_SURFACE_GET_IFACE (popup_surface)->get_surface (popup_surface);
}
static void
popup_grab_focus (MetaWaylandPointerGrab *grab,
MetaWaylandSurface *surface)
@@ -138,12 +108,9 @@ static MetaWaylandPointerGrabInterface popup_grab_interface = {
};
MetaWaylandPopupGrab *
meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
MetaWaylandPopupSurface *popup_surface)
meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
struct wl_client *client)
{
MetaWaylandSurface *surface =
meta_wayland_popup_surface_get_surface (popup_surface);
struct wl_client *client = wl_resource_get_client (surface->resource);
MetaWaylandPopupGrab *grab;
grab = g_slice_new0 (MetaWaylandPopupGrab);
@@ -152,19 +119,16 @@ meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
grab->grab_client = client;
wl_list_init (&grab->all_popups);
meta_wayland_popup_grab_begin (grab, surface);
return grab;
}
void
meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab)
{
meta_wayland_popup_grab_end (grab);
g_slice_free (MetaWaylandPopupGrab, grab);
}
static void
void
meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
MetaWaylandSurface *surface)
{
@@ -195,7 +159,7 @@ meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab)
wl_list_for_each_safe (popup, tmp, &grab->all_popups, link)
{
meta_wayland_popup_surface_done (popup->popup_surface);
meta_wayland_surface_popup_done (popup->surface);
meta_wayland_popup_destroy (popup);
}
@@ -216,7 +180,7 @@ meta_wayland_popup_grab_get_top_popup (MetaWaylandPopupGrab *grab)
g_assert (!wl_list_empty (&grab->all_popups));
popup = wl_container_of (grab->all_popups.next, popup, link);
return meta_wayland_popup_surface_get_surface (popup->popup_surface);
return popup->surface;
}
gboolean
@@ -228,8 +192,9 @@ meta_wayland_pointer_grab_is_popup_grab (MetaWaylandPointerGrab *grab)
void
meta_wayland_popup_destroy (MetaWaylandPopup *popup)
{
meta_wayland_popup_surface_dismiss (popup->popup_surface);
wl_signal_emit (&popup->destroy_signal, popup);
wl_list_remove (&popup->surface_destroy_listener.link);
wl_list_remove (&popup->link);
g_slice_free (MetaWaylandPopup, popup);
}
@@ -251,12 +216,26 @@ meta_wayland_popup_get_top_popup (MetaWaylandPopup *popup)
return meta_wayland_popup_grab_get_top_popup (popup->grab);
}
MetaWaylandPopup *
meta_wayland_popup_create (MetaWaylandPopupSurface *popup_surface,
MetaWaylandPopupGrab *grab)
struct wl_signal *
meta_wayland_popup_get_destroy_signal (MetaWaylandPopup *popup)
{
return &popup->destroy_signal;
}
static void
on_popup_surface_destroy (struct wl_listener *listener,
void *data)
{
MetaWaylandPopup *popup =
wl_container_of (listener, popup, surface_destroy_listener);
meta_wayland_popup_dismiss (popup);
}
MetaWaylandPopup *
meta_wayland_popup_create (MetaWaylandSurface *surface,
MetaWaylandPopupGrab *grab)
{
MetaWaylandSurface *surface =
meta_wayland_popup_surface_get_surface (popup_surface);
MetaWaylandPopup *popup;
/* Don't allow creating popups if the grab has a different client. */
@@ -265,7 +244,20 @@ meta_wayland_popup_create (MetaWaylandPopupSurface *popup_surface,
popup = g_slice_new0 (MetaWaylandPopup);
popup->grab = grab;
popup->popup_surface = popup_surface;
popup->surface = surface;
popup->surface_destroy_listener.notify = on_popup_surface_destroy;
wl_signal_init (&popup->destroy_signal);
if (surface->xdg_popup)
{
wl_resource_add_destroy_listener (surface->xdg_popup,
&popup->surface_destroy_listener);
}
else if (surface->wl_shell_surface)
{
wl_resource_add_destroy_listener (surface->wl_shell_surface,
&popup->surface_destroy_listener);
}
wl_list_insert (&grab->all_popups, &popup->link);

View File

@@ -27,31 +27,22 @@
#include "meta-wayland-types.h"
#include "meta-wayland-pointer.h"
#define META_TYPE_WAYLAND_POPUP_SURFACE (meta_wayland_popup_surface_get_type ())
G_DECLARE_INTERFACE (MetaWaylandPopupSurface, meta_wayland_popup_surface,
META, WAYLAND_POPUP_SURFACE,
GObject);
struct _MetaWaylandPopupSurfaceInterface
{
GTypeInterface parent_iface;
void (*done) (MetaWaylandPopupSurface *popup_surface);
void (*dismiss) (MetaWaylandPopupSurface *popup_surface);
MetaWaylandSurface *(*get_surface) (MetaWaylandPopupSurface *popup_surface);
};
MetaWaylandPopupGrab *meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
MetaWaylandPopupSurface *popup_surface);
MetaWaylandPopupGrab *meta_wayland_popup_grab_create (MetaWaylandPointer *pointer,
struct wl_client *client);
void meta_wayland_popup_grab_destroy (MetaWaylandPopupGrab *grab);
void meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
MetaWaylandSurface *surface);
void meta_wayland_popup_grab_end (MetaWaylandPopupGrab *grab);
MetaWaylandSurface *meta_wayland_popup_grab_get_top_popup (MetaWaylandPopupGrab *grab);
gboolean meta_wayland_pointer_grab_is_popup_grab (MetaWaylandPointerGrab *grab);
MetaWaylandPopup *meta_wayland_popup_create (MetaWaylandPopupSurface *surface,
MetaWaylandPopupGrab *grab);
MetaWaylandPopup *meta_wayland_popup_create (MetaWaylandSurface *surface,
MetaWaylandPopupGrab *grab);
void meta_wayland_popup_destroy (MetaWaylandPopup *popup);
@@ -59,4 +50,6 @@ void meta_wayland_popup_dismiss (MetaWaylandPopup *popup);
MetaWaylandSurface *meta_wayland_popup_get_top_popup (MetaWaylandPopup *popup);
struct wl_signal *meta_wayland_popup_get_destroy_signal (MetaWaylandPopup *popup);
#endif /* META_WAYLAND_POPUP_H */

File diff suppressed because it is too large Load Diff

View File

@@ -62,7 +62,6 @@ struct _MetaWaylandSurfaceRoleClass
MetaWaylandPendingState *pending);
gboolean (*is_on_output) (MetaWaylandSurfaceRole *surface_role,
MetaMonitorInfo *monitor);
MetaWaylandSurface * (*get_toplevel) (MetaWaylandSurfaceRole *surface_role);
};
struct _MetaWaylandSerial {
@@ -70,43 +69,29 @@ struct _MetaWaylandSerial {
uint32_t value;
};
#define META_TYPE_WAYLAND_SURFACE_ROLE_ACTOR_SURFACE (meta_wayland_surface_role_actor_surface_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaWaylandSurfaceRoleActorSurface,
meta_wayland_surface_role_actor_surface,
META, WAYLAND_SURFACE_ROLE_ACTOR_SURFACE,
MetaWaylandSurfaceRole);
struct _MetaWaylandSurfaceRoleActorSurfaceClass
{
MetaWaylandSurfaceRoleClass parent_class;
};
#define META_TYPE_WAYLAND_SURFACE_ROLE_SHELL_SURFACE (meta_wayland_surface_role_shell_surface_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaWaylandSurfaceRoleShellSurface,
meta_wayland_surface_role_shell_surface,
META, WAYLAND_SURFACE_ROLE_SHELL_SURFACE,
MetaWaylandSurfaceRoleActorSurface);
struct _MetaWaylandSurfaceRoleShellSurfaceClass
{
MetaWaylandSurfaceRoleActorSurfaceClass parent_class;
void (*configure) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_width,
int new_height,
MetaWaylandSerial *sent_serial);
void (*managed) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
MetaWindow *window);
void (*ping) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
uint32_t serial);
void (*close) (MetaWaylandSurfaceRoleShellSurface *shell_surface_role);
};
#define META_TYPE_WAYLAND_SURFACE_ROLE_SUBSURFACE (meta_wayland_surface_role_subsurface_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleSubsurface,
meta_wayland_surface_role_subsurface,
META, WAYLAND_SURFACE_ROLE_SUBSURFACE,
MetaWaylandSurfaceRoleActorSurface);
MetaWaylandSurfaceRole);
#define META_TYPE_WAYLAND_SURFACE_ROLE_XDG_SURFACE (meta_wayland_surface_role_xdg_surface_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleXdgSurface,
meta_wayland_surface_role_xdg_surface,
META, WAYLAND_SURFACE_ROLE_XDG_SURFACE,
MetaWaylandSurfaceRole);
#define META_TYPE_WAYLAND_SURFACE_ROLE_XDG_POPUP (meta_wayland_surface_role_xdg_popup_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleXdgPopup,
meta_wayland_surface_role_xdg_popup,
META, WAYLAND_SURFACE_ROLE_XDG_POPUP,
MetaWaylandSurfaceRole);
#define META_TYPE_WAYLAND_SURFACE_ROLE_WL_SHELL_SURFACE (meta_wayland_surface_role_wl_shell_surface_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleWlShellSurface,
meta_wayland_surface_role_wl_shell_surface,
META, WAYLAND_SURFACE_ROLE_WL_SHELL_SURFACE,
MetaWaylandSurfaceRole);
#define META_TYPE_WAYLAND_SURFACE_ROLE_DND (meta_wayland_surface_role_dnd_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleDND,
@@ -202,13 +187,28 @@ struct _MetaWaylandSurface
MetaWaylandPendingState *pending;
/* Extension resources. */
struct wl_resource *xdg_surface;
struct wl_resource *xdg_popup;
struct wl_resource *wl_shell_surface;
struct wl_resource *gtk_surface;
struct wl_resource *wl_subsurface;
/* gtk_surface stuff */
/* xdg_surface stuff */
struct wl_resource *xdg_shell_resource;
MetaWaylandSerial acked_configure_serial;
gboolean has_set_geometry;
gboolean is_modal;
gboolean destroying;
/* xdg_popup */
struct {
MetaWaylandSurface *parent;
struct wl_listener parent_destroy_listener;
MetaWaylandPopup *popup;
struct wl_listener destroy_listener;
} popup;
/* wl_subsurface stuff. */
struct {
MetaWaylandSurface *parent;
@@ -263,6 +263,8 @@ void meta_wayland_surface_ping (MetaWaylandSurface *surface,
guint32 serial);
void meta_wayland_surface_delete (MetaWaylandSurface *surface);
void meta_wayland_surface_popup_done (MetaWaylandSurface *surface);
/* Drag dest functions */
void meta_wayland_surface_drag_dest_focus_in (MetaWaylandSurface *surface,
MetaWaylandDataOffer *offer);
@@ -274,8 +276,6 @@ void meta_wayland_surface_drag_dest_update (MetaWaylandSurface
void meta_wayland_surface_update_outputs (MetaWaylandSurface *surface);
MetaWaylandSurface *meta_wayland_surface_get_toplevel (MetaWaylandSurface *surface);
MetaWindow * meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface);
void meta_wayland_surface_queue_pending_frame_callbacks (MetaWaylandSurface *surface);
@@ -299,23 +299,4 @@ MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRo
cairo_region_t * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface);
void meta_wayland_surface_apply_window_state (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending);
void meta_wayland_surface_calculate_window_geometry (MetaWaylandSurface *surface,
MetaRectangle *total_geometry,
float parent_x,
float parent_y);
void meta_wayland_surface_destroy_window (MetaWaylandSurface *surface);
gboolean meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
MetaWaylandSeat *seat,
MetaGrabOp grab_op,
gfloat x,
gfloat y);
void meta_wayland_surface_window_managed (MetaWaylandSurface *surface,
MetaWindow *window);
#endif

View File

@@ -148,7 +148,7 @@ meta_wayland_tablet_manager_lookup_seat (MetaWaylandTabletManager *manager,
MetaWaylandSeat *seat;
GHashTableIter iter;
if (!device || !is_tablet_device (device))
if (!is_tablet_device (device))
return NULL;
g_hash_table_iter_init (&iter, manager->seats);

View File

@@ -192,14 +192,6 @@ meta_wayland_tablet_seat_new (MetaWaylandTabletManager *manager)
void
meta_wayland_tablet_seat_free (MetaWaylandTabletSeat *tablet_seat)
{
struct wl_resource *resource, *next;
wl_resource_for_each_safe (resource, next, &tablet_seat->resource_list)
{
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_signal_handlers_disconnect_by_data (tablet_seat->device_manager,
tablet_seat);
g_hash_table_destroy (tablet_seat->tablets);

View File

@@ -411,8 +411,6 @@ meta_wayland_tablet_tool_free (MetaWaylandTabletTool *tool)
wl_resource_for_each_safe (resource, next, &tool->resource_list)
{
zwp_tablet_tool_v1_send_removed (resource);
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_slice_free (MetaWaylandTabletTool, tool);

View File

@@ -48,6 +48,7 @@ meta_wayland_tablet_new (ClutterInputDevice *device,
tablet = g_slice_new0 (MetaWaylandTablet);
wl_list_init (&tablet->resource_list);
wl_list_init (&tablet->focus_resource_list);
tablet->device = device;
tablet->tablet_seat = tablet_seat;
@@ -62,8 +63,6 @@ meta_wayland_tablet_free (MetaWaylandTablet *tablet)
wl_resource_for_each_safe (resource, next, &tablet->resource_list)
{
zwp_tablet_v1_send_removed (resource);
wl_list_remove (wl_resource_get_link (resource));
wl_list_init (wl_resource_get_link (resource));
}
g_slice_free (MetaWaylandTablet, tablet);
@@ -120,5 +119,12 @@ struct wl_resource *
meta_wayland_tablet_lookup_resource (MetaWaylandTablet *tablet,
struct wl_client *client)
{
return wl_resource_find_for_client (&tablet->resource_list, client);
struct wl_resource *resource;
resource = wl_resource_find_for_client (&tablet->resource_list, client);
if (!resource)
resource = wl_resource_find_for_client (&tablet->focus_resource_list, client);
return resource;
}

View File

@@ -35,6 +35,7 @@ struct _MetaWaylandTablet
ClutterInputDevice *device;
struct wl_list resource_list;
struct wl_list focus_resource_list;
MetaWaylandSurface *current;
};

View File

@@ -28,7 +28,6 @@ typedef struct _MetaWaylandPointerGrab MetaWaylandPointerGrab;
typedef struct _MetaWaylandPointerGrabInterface MetaWaylandPointerGrabInterface;
typedef struct _MetaWaylandPopupGrab MetaWaylandPopupGrab;
typedef struct _MetaWaylandPopup MetaWaylandPopup;
typedef struct _MetaWaylandPopupSurface MetaWaylandPopupSurface;
typedef struct _MetaWaylandKeyboard MetaWaylandKeyboard;
typedef struct _MetaWaylandKeyboardGrab MetaWaylandKeyboardGrab;
typedef struct _MetaWaylandKeyboardGrabInterface MetaWaylandKeyboardGrabInterface;

View File

@@ -1,743 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2012-2013 Intel Corporation
* Copyright (C) 2013-2015 Red Hat Inc.
*
* 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.
*
*/
#include "config.h"
#include "wayland/meta-wayland-wl-shell.h"
#include "core/window-private.h"
#include "wayland/meta-wayland.h"
#include "wayland/meta-wayland-popup.h"
#include "wayland/meta-wayland-private.h"
#include "wayland/meta-wayland-seat.h"
#include "wayland/meta-wayland-surface.h"
#include "wayland/meta-wayland-versions.h"
#include "wayland/meta-window-wayland.h"
typedef enum
{
META_WL_SHELL_SURFACE_STATE_NONE,
META_WL_SHELL_SURFACE_STATE_TOPLEVEL,
META_WL_SHELL_SURFACE_STATE_POPUP,
META_WL_SHELL_SURFACE_STATE_TRANSIENT,
META_WL_SHELL_SURFACE_STATE_FULLSCREEN,
META_WL_SHELL_SURFACE_STATE_MAXIMIZED,
} MetaWlShellSurfaceState;
struct _MetaWaylandWlShellSurface
{
MetaWaylandSurfaceRoleShellSurface parent;
struct wl_resource *resource;
MetaWlShellSurfaceState state;
char *title;
char *wm_class;
MetaWaylandSurface *parent_surface;
GList *children;
MetaWaylandSeat *popup_seat;
MetaWaylandPopup *popup;
gboolean pending_popup;
int x;
int y;
};
static void
popup_surface_iface_init (MetaWaylandPopupSurfaceInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWaylandWlShellSurface,
meta_wayland_wl_shell_surface,
META_TYPE_WAYLAND_SURFACE_ROLE_SHELL_SURFACE,
G_IMPLEMENT_INTERFACE (META_TYPE_WAYLAND_POPUP_SURFACE,
popup_surface_iface_init));
static MetaWaylandSurface *
surface_from_wl_shell_surface_resource (struct wl_resource *resource)
{
MetaWaylandWlShellSurface *wl_shell_surface =
wl_resource_get_user_data (resource);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (wl_shell_surface);
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
sync_wl_shell_parent_relationship (MetaWaylandSurface *surface,
MetaWaylandSurface *parent);
static void
wl_shell_surface_destructor (struct wl_resource *resource)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
GList *l;
meta_wayland_compositor_destroy_frame_callbacks (surface->compositor,
surface);
if (wl_shell_surface->popup)
meta_wayland_popup_dismiss (wl_shell_surface->popup);
for (l = wl_shell_surface->children; l; l = l->next)
{
MetaWaylandSurface *child_surface = l->data;
MetaWaylandWlShellSurface *child_wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (child_surface->role);
child_wl_shell_surface->parent_surface = NULL;
if (child_wl_shell_surface->parent_surface == surface)
{
meta_wayland_popup_dismiss (child_wl_shell_surface->popup);
child_wl_shell_surface->parent_surface = NULL;
}
}
if (wl_shell_surface->parent_surface)
{
MetaWaylandSurface *parent_surface = wl_shell_surface->parent_surface;
MetaWaylandWlShellSurface *parent_wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (parent_surface->role);
parent_wl_shell_surface->children =
g_list_remove (parent_wl_shell_surface->children, surface);
}
g_free (wl_shell_surface->title);
g_free (wl_shell_surface->wm_class);
if (wl_shell_surface->popup)
{
wl_shell_surface->parent_surface = NULL;
meta_wayland_popup_dismiss (wl_shell_surface->popup);
}
wl_shell_surface->resource = NULL;
}
static void
wl_shell_surface_pong (struct wl_client *client,
struct wl_resource *resource,
uint32_t serial)
{
MetaDisplay *display = meta_get_display ();
meta_display_pong_for_serial (display, serial);
}
static void
wl_shell_surface_move (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *seat_resource,
uint32_t serial)
{
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
gfloat x, y;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
return;
meta_wayland_surface_begin_grab_op (surface, seat, META_GRAB_OP_MOVING, x, y);
}
static MetaGrabOp
grab_op_for_wl_shell_surface_resize_edge (int edge)
{
MetaGrabOp op = META_GRAB_OP_WINDOW_BASE;
if (edge & WL_SHELL_SURFACE_RESIZE_TOP)
op |= META_GRAB_OP_WINDOW_DIR_NORTH;
if (edge & WL_SHELL_SURFACE_RESIZE_BOTTOM)
op |= META_GRAB_OP_WINDOW_DIR_SOUTH;
if (edge & WL_SHELL_SURFACE_RESIZE_LEFT)
op |= META_GRAB_OP_WINDOW_DIR_WEST;
if (edge & WL_SHELL_SURFACE_RESIZE_RIGHT)
op |= META_GRAB_OP_WINDOW_DIR_EAST;
if (op == META_GRAB_OP_WINDOW_BASE)
{
g_warning ("invalid edge: %d", edge);
return META_GRAB_OP_NONE;
}
return op;
}
static void
wl_shell_surface_resize (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *seat_resource,
uint32_t serial,
uint32_t edges)
{
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
gfloat x, y;
MetaGrabOp grab_op;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
return;
grab_op = grab_op_for_wl_shell_surface_resize_edge (edges);
meta_wayland_surface_begin_grab_op (surface, seat, grab_op, x, y);
}
static void
wl_shell_surface_set_state (MetaWaylandSurface *surface,
MetaWlShellSurfaceState state)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface->role);
MetaWlShellSurfaceState old_state = wl_shell_surface->state;
wl_shell_surface->state = state;
if (surface->window && old_state != state)
{
if (old_state == META_WL_SHELL_SURFACE_STATE_POPUP &&
wl_shell_surface->popup)
{
meta_wayland_popup_dismiss (wl_shell_surface->popup);
wl_shell_surface->popup = NULL;
}
if (state == META_WL_SHELL_SURFACE_STATE_FULLSCREEN)
meta_window_make_fullscreen (surface->window);
else
meta_window_unmake_fullscreen (surface->window);
if (state == META_WL_SHELL_SURFACE_STATE_MAXIMIZED)
meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
else
meta_window_unmaximize (surface->window, META_MAXIMIZE_BOTH);
}
}
static void
wl_shell_surface_set_toplevel (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
wl_shell_surface_set_state (surface,
META_WL_SHELL_SURFACE_STATE_TOPLEVEL);
}
static void
set_wl_shell_surface_parent (MetaWaylandSurface *surface,
MetaWaylandSurface *parent)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface->role);
MetaWaylandWlShellSurface *parent_wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (parent->role);
if (wl_shell_surface->parent_surface)
{
MetaWaylandWlShellSurface *old_parent =
META_WAYLAND_WL_SHELL_SURFACE (wl_shell_surface->parent_surface->role);
old_parent->children = g_list_remove (old_parent->children, surface);
}
parent_wl_shell_surface->children =
g_list_append (parent_wl_shell_surface->children, surface);
wl_shell_surface->parent_surface = parent;
}
static void
wl_shell_surface_set_transient (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *parent_resource,
int32_t x,
int32_t y,
uint32_t flags)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
wl_shell_surface_set_state (surface,
META_WL_SHELL_SURFACE_STATE_TRANSIENT);
set_wl_shell_surface_parent (surface, parent_surf);
wl_shell_surface->x = x;
wl_shell_surface->y = y;
if (surface->window && parent_surf->window)
sync_wl_shell_parent_relationship (surface, parent_surf);
}
static void
wl_shell_surface_set_fullscreen (struct wl_client *client,
struct wl_resource *resource,
uint32_t method,
uint32_t framerate,
struct wl_resource *output)
{
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
wl_shell_surface_set_state (surface,
META_WL_SHELL_SURFACE_STATE_FULLSCREEN);
}
static void
meta_wayland_wl_shell_surface_create_popup (MetaWaylandWlShellSurface *wl_shell_surface)
{
MetaWaylandPopupSurface *popup_surface =
META_WAYLAND_POPUP_SURFACE (wl_shell_surface);
MetaWaylandSeat *seat = wl_shell_surface->popup_seat;
MetaWaylandPopup *popup;
popup = meta_wayland_pointer_start_popup_grab (&seat->pointer, popup_surface);
if (!popup)
{
wl_shell_surface_send_popup_done (wl_shell_surface->resource);
return;
}
wl_shell_surface->popup = popup;
}
static void
wl_shell_surface_set_popup (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *seat_resource,
uint32_t serial,
struct wl_resource *parent_resource,
int32_t x,
int32_t y,
uint32_t flags)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
if (wl_shell_surface->popup)
{
wl_shell_surface->parent_surface = NULL;
meta_wayland_popup_dismiss (wl_shell_surface->popup);
}
wl_shell_surface_set_state (surface,
META_WL_SHELL_SURFACE_STATE_POPUP);
if (!meta_wayland_seat_can_popup (seat, serial))
{
wl_shell_surface_send_popup_done (resource);
return;
}
set_wl_shell_surface_parent (surface, parent_surf);
wl_shell_surface->popup_seat = seat;
wl_shell_surface->x = x;
wl_shell_surface->y = y;
wl_shell_surface->pending_popup = TRUE;
if (surface->window && parent_surf->window)
sync_wl_shell_parent_relationship (surface, parent_surf);
}
static void
wl_shell_surface_set_maximized (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *output)
{
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
wl_shell_surface_set_state (surface,
META_WL_SHELL_SURFACE_STATE_MAXIMIZED);
}
static void
wl_shell_surface_set_title (struct wl_client *client,
struct wl_resource *resource,
const char *title)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
g_clear_pointer (&wl_shell_surface->title, g_free);
wl_shell_surface->title = g_strdup (title);
if (surface->window)
meta_window_set_title (surface->window, title);
}
static void
wl_shell_surface_set_class (struct wl_client *client,
struct wl_resource *resource,
const char *class_)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
g_clear_pointer (&wl_shell_surface->wm_class, g_free);
wl_shell_surface->wm_class = g_strdup (class_);
if (surface->window)
meta_window_set_wm_class (surface->window, class_, class_);
}
static const struct wl_shell_surface_interface meta_wayland_wl_shell_surface_interface = {
wl_shell_surface_pong,
wl_shell_surface_move,
wl_shell_surface_resize,
wl_shell_surface_set_toplevel,
wl_shell_surface_set_transient,
wl_shell_surface_set_fullscreen,
wl_shell_surface_set_popup,
wl_shell_surface_set_maximized,
wl_shell_surface_set_title,
wl_shell_surface_set_class,
};
static void
sync_wl_shell_parent_relationship (MetaWaylandSurface *surface,
MetaWaylandSurface *parent)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface->role);
meta_window_set_transient_for (surface->window, parent->window);
if (wl_shell_surface->state == META_WL_SHELL_SURFACE_STATE_POPUP ||
wl_shell_surface->state == META_WL_SHELL_SURFACE_STATE_TRANSIENT)
meta_window_wayland_place_relative_to (surface->window,
parent->window,
wl_shell_surface->x,
wl_shell_surface->y);
if (wl_shell_surface->state == META_WL_SHELL_SURFACE_STATE_POPUP &&
wl_shell_surface->pending_popup)
{
meta_wayland_wl_shell_surface_create_popup (wl_shell_surface);
wl_shell_surface->pending_popup = FALSE;
}
}
static void
create_wl_shell_surface_window (MetaWaylandSurface *surface)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface->role);
MetaWaylandSurface *parent;
GList *l;
surface->window = meta_window_wayland_new (meta_get_display (), surface);
meta_wayland_surface_set_window (surface, surface->window);
if (wl_shell_surface->title)
meta_window_set_title (surface->window, wl_shell_surface->title);
if (wl_shell_surface->wm_class)
meta_window_set_wm_class (surface->window,
wl_shell_surface->wm_class,
wl_shell_surface->wm_class);
parent = wl_shell_surface->parent_surface;
if (parent && parent->window)
sync_wl_shell_parent_relationship (surface, parent);
for (l = wl_shell_surface->children; l; l = l->next)
{
MetaWaylandSurface *child = l->data;
if (child->window)
sync_wl_shell_parent_relationship (child, surface);
}
}
static void
wl_shell_get_shell_surface (struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *surface_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandWlShellSurface *wl_shell_surface;
if (META_IS_WAYLAND_WL_SHELL_SURFACE (surface->role) &&
META_WAYLAND_WL_SHELL_SURFACE (surface->role)->resource)
{
wl_resource_post_error (surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"wl_shell::get_shell_surface already requested");
return;
}
if (!meta_wayland_surface_assign_role (surface,
META_TYPE_WAYLAND_WL_SHELL_SURFACE))
{
wl_resource_post_error (resource, WL_SHELL_ERROR_ROLE,
"wl_surface@%d already has a different role",
wl_resource_get_id (surface->resource));
return;
}
wl_shell_surface = META_WAYLAND_WL_SHELL_SURFACE (surface->role);
wl_shell_surface->resource =
wl_resource_create (client,
&wl_shell_surface_interface,
wl_resource_get_version (resource),
id);
wl_resource_set_implementation (wl_shell_surface->resource,
&meta_wayland_wl_shell_surface_interface,
wl_shell_surface,
wl_shell_surface_destructor);
create_wl_shell_surface_window (surface);
}
static const struct wl_shell_interface meta_wayland_wl_shell_interface = {
wl_shell_get_shell_surface,
};
static void
bind_wl_shell (struct wl_client *client,
void *data,
uint32_t version,
uint32_t id)
{
struct wl_resource *resource;
resource = wl_resource_create (client, &wl_shell_interface, version, id);
wl_resource_set_implementation (resource, &meta_wayland_wl_shell_interface, data, NULL);
}
static void
wl_shell_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandPendingState *pending)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface_role);
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaRectangle geom = { 0 };
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_wl_shell_surface_parent_class);
surface_role_class->commit (surface_role, pending);
/* For wl_shell, it's equivalent to an unmap. Semantics
* are poorly defined, so we can choose some that are
* convenient for us. */
if (surface->buffer_ref.buffer && !window)
{
create_wl_shell_surface_window (surface);
}
else if (!surface->buffer_ref.buffer && window)
{
if (wl_shell_surface->popup)
meta_wayland_popup_dismiss (wl_shell_surface->popup);
else
meta_wayland_surface_destroy_window (surface);
return;
}
if (!window)
return;
if (!pending->newly_attached)
return;
meta_wayland_surface_apply_window_state (surface, pending);
meta_wayland_surface_calculate_window_geometry (surface, &geom, 0, 0);
meta_window_wayland_move_resize (window,
NULL,
geom, pending->dx, pending->dy);
}
static MetaWaylandSurface *
wl_shell_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface_role);
if (wl_shell_surface->state == META_WL_SHELL_SURFACE_STATE_POPUP &&
wl_shell_surface->parent_surface)
return meta_wayland_surface_get_toplevel (wl_shell_surface->parent_surface);
else
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
wl_shell_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_width,
int new_height,
MetaWaylandSerial *sent_serial)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (shell_surface_role);
if (!wl_shell_surface->resource)
return;
wl_shell_surface_send_configure (wl_shell_surface->resource,
0,
new_width, new_height);
}
static void
wl_shell_surface_role_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
MetaWindow *window)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (shell_surface_role);
if (wl_shell_surface->state == META_WL_SHELL_SURFACE_STATE_POPUP)
meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
}
static void
wl_shell_surface_role_ping (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
guint32 serial)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (shell_surface_role);
wl_shell_surface_send_ping (wl_shell_surface->resource, serial);
}
static void
wl_shell_surface_role_close (MetaWaylandSurfaceRoleShellSurface *shell_surface_role)
{
/* Not supported by wl_shell_surface. */
}
static void
meta_wayland_wl_shell_surface_popup_done (MetaWaylandPopupSurface *popup_surface)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (popup_surface);
wl_shell_surface_send_popup_done (wl_shell_surface->resource);
}
static void
meta_wayland_wl_shell_surface_popup_dismiss (MetaWaylandPopupSurface *popup_surface)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (popup_surface);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (popup_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
wl_shell_surface->popup = NULL;
meta_wayland_surface_destroy_window (surface);
}
static MetaWaylandSurface *
meta_wayland_wl_shell_surface_popup_get_surface (MetaWaylandPopupSurface *popup_surface)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (popup_surface);
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
popup_surface_iface_init (MetaWaylandPopupSurfaceInterface *iface)
{
iface->done = meta_wayland_wl_shell_surface_popup_done;
iface->dismiss = meta_wayland_wl_shell_surface_popup_dismiss;
iface->get_surface = meta_wayland_wl_shell_surface_popup_get_surface;
}
static void
wl_shell_surface_role_finalize (GObject *object)
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (object);
GObjectClass *object_class;
g_clear_pointer (&wl_shell_surface->resource, wl_resource_destroy);
object_class =
G_OBJECT_CLASS (meta_wayland_wl_shell_surface_parent_class);
object_class->finalize (object);
}
static void
meta_wayland_wl_shell_surface_init (MetaWaylandWlShellSurface *wl_shell_surface)
{
}
static void
meta_wayland_wl_shell_surface_class_init (MetaWaylandWlShellSurfaceClass *klass)
{
GObjectClass *object_class;
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurfaceRoleShellSurfaceClass *shell_surface_role_class;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = wl_shell_surface_role_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = wl_shell_surface_role_commit;
surface_role_class->get_toplevel = wl_shell_surface_role_get_toplevel;
shell_surface_role_class =
META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_CLASS (klass);
shell_surface_role_class->configure = wl_shell_surface_role_configure;
shell_surface_role_class->managed = wl_shell_surface_role_managed;
shell_surface_role_class->ping = wl_shell_surface_role_ping;
shell_surface_role_class->close = wl_shell_surface_role_close;
}
void
meta_wayland_wl_shell_init (MetaWaylandCompositor *compositor)
{
if (wl_global_create (compositor->wayland_display,
&wl_shell_interface,
META_WL_SHELL_VERSION,
compositor, bind_wl_shell) == NULL)
g_error ("Failed to register a global wl-shell object");
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2013-2015 Red Hat, Inc.
*
* 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.
*/
#ifndef META_WAYLAND_WL_SHELL_H
#define META_WAYLAND_WL_SHELL_H
#include "wayland/meta-wayland-surface.h"
#define META_TYPE_WAYLAND_WL_SHELL_SURFACE (meta_wayland_wl_shell_surface_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandWlShellSurface,
meta_wayland_wl_shell_surface,
META, WAYLAND_WL_SHELL_SURFACE,
MetaWaylandSurfaceRoleShellSurface);
void meta_wayland_wl_shell_init (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_WL_SHELL_H */

View File

@@ -1,937 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2012-2013 Intel Corporation
* Copyright (C) 2013-2015 Red Hat Inc.
*
* 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.
*
*/
#include "config.h"
#include "wayland/meta-wayland-xdg-shell.h"
#include "core/window-private.h"
#include "wayland/meta-wayland.h"
#include "wayland/meta-wayland-popup.h"
#include "wayland/meta-wayland-private.h"
#include "wayland/meta-wayland-seat.h"
#include "wayland/meta-wayland-surface.h"
#include "wayland/meta-wayland-versions.h"
#include "wayland/meta-window-wayland.h"
#include "xdg-shell-unstable-v5-server-protocol.h"
struct _MetaWaylandXdgSurface
{
MetaWaylandSurfaceRoleShellSurface parent;
struct wl_resource *resource;
struct wl_resource *xdg_shell_resource;
MetaWaylandSerial acked_configure_serial;
gboolean has_set_geometry;
};
G_DEFINE_TYPE (MetaWaylandXdgSurface,
meta_wayland_xdg_surface,
META_TYPE_WAYLAND_SURFACE_ROLE_SHELL_SURFACE);
struct _MetaWaylandXdgPopup
{
MetaWaylandSurfaceRoleShellSurface parent;
struct wl_resource *resource;
struct wl_resource *xdg_shell_resource;
MetaWaylandSurface *parent_surface;
struct wl_listener parent_destroy_listener;
MetaWaylandPopup *popup;
};
static void
popup_surface_iface_init (MetaWaylandPopupSurfaceInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWaylandXdgPopup,
meta_wayland_xdg_popup,
META_TYPE_WAYLAND_SURFACE_ROLE_SHELL_SURFACE,
G_IMPLEMENT_INTERFACE (META_TYPE_WAYLAND_POPUP_SURFACE,
popup_surface_iface_init));
static MetaWaylandSurface *
surface_from_xdg_surface_resource (struct wl_resource *resource)
{
MetaWaylandXdgSurface *xdg_surface = wl_resource_get_user_data (resource);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (xdg_surface);
return meta_wayland_surface_role_get_surface (surface_role);
}
static MetaWaylandSurface *
surface_from_xdg_popup_resource (struct wl_resource *resource)
{
MetaWaylandXdgPopup *xdg_popup = wl_resource_get_user_data (resource);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (xdg_popup);
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
xdg_surface_destructor (struct wl_resource *resource)
{
MetaWaylandXdgSurface *xdg_surface = wl_resource_get_user_data (resource);
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_wayland_compositor_destroy_frame_callbacks (surface->compositor,
surface);
meta_wayland_surface_destroy_window (surface);
xdg_surface->resource = NULL;
}
static void
xdg_surface_destroy (struct wl_client *client,
struct wl_resource *resource)
{
wl_resource_destroy (resource);
}
static void
xdg_surface_set_parent (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *parent_resource)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
MetaWindow *transient_for = NULL;
if (parent_resource)
{
MetaWaylandSurface *parent_surface =
surface_from_xdg_surface_resource (parent_resource);
transient_for = parent_surface->window;
}
meta_window_set_transient_for (surface->window, transient_for);
}
static void
xdg_surface_set_title (struct wl_client *client,
struct wl_resource *resource,
const char *title)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_set_title (surface->window, title);
}
static void
xdg_surface_set_app_id (struct wl_client *client,
struct wl_resource *resource,
const char *app_id)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_set_wm_class (surface->window, app_id, app_id);
}
static void
xdg_surface_show_window_menu (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *seat_resource,
uint32_t serial,
int32_t x,
int32_t y)
{
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, FALSE, NULL, NULL))
return;
meta_window_show_menu (surface->window, META_WINDOW_MENU_WM,
surface->window->buffer_rect.x + x,
surface->window->buffer_rect.y + y);
}
static void
xdg_surface_move (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *seat_resource,
guint32 serial)
{
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
gfloat x, y;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
return;
meta_wayland_surface_begin_grab_op (surface, seat, META_GRAB_OP_MOVING, x, y);
}
static MetaGrabOp
grab_op_for_xdg_surface_resize_edge (int edge)
{
MetaGrabOp op = META_GRAB_OP_WINDOW_BASE;
if (edge & XDG_SURFACE_RESIZE_EDGE_TOP)
op |= META_GRAB_OP_WINDOW_DIR_NORTH;
if (edge & XDG_SURFACE_RESIZE_EDGE_BOTTOM)
op |= META_GRAB_OP_WINDOW_DIR_SOUTH;
if (edge & XDG_SURFACE_RESIZE_EDGE_LEFT)
op |= META_GRAB_OP_WINDOW_DIR_WEST;
if (edge & XDG_SURFACE_RESIZE_EDGE_RIGHT)
op |= META_GRAB_OP_WINDOW_DIR_EAST;
if (op == META_GRAB_OP_WINDOW_BASE)
{
g_warning ("invalid edge: %d", edge);
return META_GRAB_OP_NONE;
}
return op;
}
static void
xdg_surface_resize (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *seat_resource,
guint32 serial,
guint32 edges)
{
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
gfloat x, y;
MetaGrabOp grab_op;
if (!meta_wayland_seat_get_grab_info (seat, surface, serial, TRUE, &x, &y))
return;
grab_op = grab_op_for_xdg_surface_resize_edge (edges);
meta_wayland_surface_begin_grab_op (surface, seat, grab_op, x, y);
}
static void
xdg_surface_ack_configure (struct wl_client *client,
struct wl_resource *resource,
uint32_t serial)
{
MetaWaylandXdgSurface *xdg_surface = wl_resource_get_user_data (resource);
xdg_surface->acked_configure_serial.set = TRUE;
xdg_surface->acked_configure_serial.value = serial;
}
static void
xdg_surface_set_window_geometry (struct wl_client *client,
struct wl_resource *resource,
int32_t x,
int32_t y,
int32_t width,
int32_t height)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
surface->pending->has_new_geometry = TRUE;
surface->pending->new_geometry.x = x;
surface->pending->new_geometry.y = y;
surface->pending->new_geometry.width = width;
surface->pending->new_geometry.height = height;
}
static void
xdg_surface_set_maximized (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
}
static void
xdg_surface_unset_maximized (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_unmaximize (surface->window, META_MAXIMIZE_BOTH);
}
static void
xdg_surface_set_fullscreen (struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *output_resource)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_make_fullscreen (surface->window);
}
static void
xdg_surface_unset_fullscreen (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_unmake_fullscreen (surface->window);
}
static void
xdg_surface_set_minimized (struct wl_client *client,
struct wl_resource *resource)
{
MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource);
meta_window_minimize (surface->window);
}
static const struct xdg_surface_interface meta_wayland_xdg_surface_interface = {
xdg_surface_destroy,
xdg_surface_set_parent,
xdg_surface_set_title,
xdg_surface_set_app_id,
xdg_surface_show_window_menu,
xdg_surface_move,
xdg_surface_resize,
xdg_surface_ack_configure,
xdg_surface_set_window_geometry,
xdg_surface_set_maximized,
xdg_surface_unset_maximized,
xdg_surface_set_fullscreen,
xdg_surface_unset_fullscreen,
xdg_surface_set_minimized,
};
static void
xdg_popup_destructor (struct wl_resource *resource)
{
MetaWaylandSurface *surface = surface_from_xdg_popup_resource (resource);
MetaWaylandXdgPopup *xdg_popup =
META_WAYLAND_XDG_POPUP (wl_resource_get_user_data (resource));
meta_wayland_compositor_destroy_frame_callbacks (surface->compositor,
surface);
if (xdg_popup->parent_surface)
{
wl_list_remove (&xdg_popup->parent_destroy_listener.link);
xdg_popup->parent_surface = NULL;
}
if (xdg_popup->popup)
meta_wayland_popup_dismiss (xdg_popup->popup);
xdg_popup->resource = NULL;
}
static void
xdg_popup_destroy (struct wl_client *client,
struct wl_resource *resource)
{
wl_resource_destroy (resource);
}
static const struct xdg_popup_interface meta_wayland_xdg_popup_interface = {
xdg_popup_destroy,
};
static void
handle_popup_parent_destroyed (struct wl_listener *listener,
void *data)
{
MetaWaylandXdgPopup *xdg_popup =
wl_container_of (listener, xdg_popup, parent_destroy_listener);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (xdg_popup);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
wl_resource_post_error (xdg_popup->xdg_shell_resource,
XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP,
"destroyed popup not top most popup");
xdg_popup->parent_surface = NULL;
meta_wayland_surface_destroy_window (surface);
}
static void
fill_states (struct wl_array *states, MetaWindow *window)
{
uint32_t *s;
if (META_WINDOW_MAXIMIZED (window))
{
s = wl_array_add (states, sizeof *s);
*s = XDG_SURFACE_STATE_MAXIMIZED;
}
if (meta_window_is_fullscreen (window))
{
s = wl_array_add (states, sizeof *s);
*s = XDG_SURFACE_STATE_FULLSCREEN;
}
if (meta_grab_op_is_resizing (window->display->grab_op))
{
s = wl_array_add (states, sizeof *s);
*s = XDG_SURFACE_STATE_RESIZING;
}
if (meta_window_appears_focused (window))
{
s = wl_array_add (states, sizeof *s);
*s = XDG_SURFACE_STATE_ACTIVATED;
}
}
static void
xdg_surface_role_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandPendingState *pending)
{
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (surface_role);
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaRectangle geom = { 0 };
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_surface_parent_class);
surface_role_class->commit (surface_role, pending);
if (surface->buffer_ref.buffer == NULL)
{
/* XDG surfaces can't commit NULL buffers */
wl_resource_post_error (surface->resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"Cannot commit a NULL buffer to an xdg_surface");
return;
}
if (!pending->newly_attached)
return;
/* If the window disappeared the surface is not coming back. */
if (!window)
return;
meta_wayland_surface_apply_window_state (surface, pending);
if (pending->has_new_geometry)
{
/* If we have new geometry, use it. */
geom = pending->new_geometry;
xdg_surface->has_set_geometry = TRUE;
}
else if (!xdg_surface->has_set_geometry)
{
/* If the surface has never set any geometry, calculate
* a default one unioning the surface and all subsurfaces together. */
meta_wayland_surface_calculate_window_geometry (surface, &geom, 0, 0);
}
else
{
/* Otherwise, keep the geometry the same. */
/* XXX: We don't store the geometry in any consistent place
* right now, so we can't re-fetch it. We should change
* meta_window_wayland_move_resize. */
/* XXX: This is the common case. Recognize it to prevent
* a warning. */
if (pending->dx == 0 && pending->dy == 0)
return;
g_warning ("XXX: Attach-initiated move without a new geometry. This is unimplemented right now.");
return;
}
meta_window_wayland_move_resize (window,
&xdg_surface->acked_configure_serial,
geom, pending->dx, pending->dy);
xdg_surface->acked_configure_serial.set = FALSE;
}
static MetaWaylandSurface *
xdg_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
xdg_surface_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_width,
int new_height,
MetaWaylandSerial *sent_serial)
{
MetaWaylandXdgSurface *xdg_surface =
META_WAYLAND_XDG_SURFACE (shell_surface_role);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (shell_surface_role);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
struct wl_client *client = wl_resource_get_client (xdg_surface->resource);
struct wl_display *display = wl_client_get_display (client);
uint32_t serial = wl_display_next_serial (display);
struct wl_array states;
if (!xdg_surface->resource)
return;
wl_array_init (&states);
fill_states (&states, surface->window);
xdg_surface_send_configure (xdg_surface->resource,
new_width, new_height,
&states,
serial);
wl_array_release (&states);
if (sent_serial)
{
sent_serial->set = TRUE;
sent_serial->value = serial;
}
}
static void
xdg_surface_role_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
MetaWindow *window)
{
}
static void
xdg_surface_role_ping (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
uint32_t serial)
{
MetaWaylandXdgSurface *xdg_surface =
META_WAYLAND_XDG_SURFACE (shell_surface_role);
xdg_shell_send_ping (xdg_surface->xdg_shell_resource, serial);
}
static void
xdg_surface_role_close (MetaWaylandSurfaceRoleShellSurface *shell_surface_role)
{
MetaWaylandXdgSurface *xdg_surface =
META_WAYLAND_XDG_SURFACE (shell_surface_role);
xdg_surface_send_close (xdg_surface->resource);
}
static void
xdg_surface_role_finalize (GObject *object)
{
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (object);
g_clear_pointer (&xdg_surface->resource, wl_resource_destroy);
G_OBJECT_CLASS (meta_wayland_xdg_surface_parent_class)->finalize (object);
}
static void
meta_wayland_xdg_surface_init (MetaWaylandXdgSurface *role)
{
}
static void
meta_wayland_xdg_surface_class_init (MetaWaylandXdgSurfaceClass *klass)
{
GObjectClass *object_class;
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurfaceRoleShellSurfaceClass *shell_surface_role_class;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = xdg_surface_role_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = xdg_surface_role_commit;
surface_role_class->get_toplevel = xdg_surface_role_get_toplevel;
shell_surface_role_class =
META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_CLASS (klass);
shell_surface_role_class->configure = xdg_surface_role_configure;
shell_surface_role_class->managed = xdg_surface_role_managed;
shell_surface_role_class->ping = xdg_surface_role_ping;
shell_surface_role_class->close = xdg_surface_role_close;
}
static void
xdg_popup_role_commit (MetaWaylandSurfaceRole *surface_role,
MetaWaylandPendingState *pending)
{
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaRectangle geom = { 0 };
surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_xdg_popup_parent_class);
surface_role_class->commit (surface_role, pending);
if (surface->buffer_ref.buffer == NULL)
{
/* XDG surfaces can't commit NULL buffers */
wl_resource_post_error (surface->resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"Cannot commit a NULL buffer to an xdg_popup");
return;
}
if (!pending->newly_attached)
return;
/* If the window disappeared the surface is not coming back. */
if (!window)
return;
meta_wayland_surface_apply_window_state (surface, pending);
meta_wayland_surface_calculate_window_geometry (surface, &geom, 0, 0);
meta_window_wayland_move_resize (window,
NULL,
geom, pending->dx, pending->dy);
}
static MetaWaylandSurface *
xdg_popup_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (surface_role);
return meta_wayland_surface_get_toplevel (xdg_popup->parent_surface);
}
static void
xdg_popup_role_configure (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
int new_width,
int new_height,
MetaWaylandSerial *sent_serial)
{
/* This can happen if the popup window loses or receives focus.
* Just ignore it. */
}
static void
xdg_popup_role_managed (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
MetaWindow *window)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (shell_surface_role);
MetaWaylandSurface *parent = xdg_popup->parent_surface;
g_assert (parent);
meta_window_set_transient_for (window, parent->window);
meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
}
static void
xdg_popup_role_ping (MetaWaylandSurfaceRoleShellSurface *shell_surface_role,
uint32_t serial)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (shell_surface_role);
xdg_shell_send_ping (xdg_popup->xdg_shell_resource, serial);
}
static void
meta_wayland_xdg_popup_done (MetaWaylandPopupSurface *popup_surface)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (popup_surface);
xdg_popup_send_popup_done (xdg_popup->resource);
}
static void
meta_wayland_xdg_popup_dismiss (MetaWaylandPopupSurface *popup_surface)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (popup_surface);
MetaWaylandSurfaceRole *surface_role = META_WAYLAND_SURFACE_ROLE (xdg_popup);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurface *top_popup;
top_popup = meta_wayland_popup_get_top_popup (xdg_popup->popup);
if (surface != top_popup)
{
wl_resource_post_error (xdg_popup->xdg_shell_resource,
XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP,
"destroyed popup not top most popup");
}
xdg_popup->popup = NULL;
meta_wayland_surface_destroy_window (surface);
}
static MetaWaylandSurface *
meta_wayland_xdg_popup_get_surface (MetaWaylandPopupSurface *popup_surface)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (popup_surface);
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
popup_surface_iface_init (MetaWaylandPopupSurfaceInterface *iface)
{
iface->done = meta_wayland_xdg_popup_done;
iface->dismiss = meta_wayland_xdg_popup_dismiss;
iface->get_surface = meta_wayland_xdg_popup_get_surface;
}
static void
xdg_popup_role_finalize (GObject *object)
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (object);
g_clear_pointer (&xdg_popup->resource, wl_resource_destroy);
G_OBJECT_CLASS (meta_wayland_xdg_popup_parent_class)->finalize (object);
}
static void
meta_wayland_xdg_popup_init (MetaWaylandXdgPopup *role)
{
}
static void
meta_wayland_xdg_popup_class_init (MetaWaylandXdgPopupClass *klass)
{
GObjectClass *object_class;
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurfaceRoleShellSurfaceClass *shell_surface_role_class;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = xdg_popup_role_finalize;
surface_role_class = META_WAYLAND_SURFACE_ROLE_CLASS (klass);
surface_role_class->commit = xdg_popup_role_commit;
surface_role_class->get_toplevel = xdg_popup_role_get_toplevel;
shell_surface_role_class =
META_WAYLAND_SURFACE_ROLE_SHELL_SURFACE_CLASS (klass);
shell_surface_role_class->configure = xdg_popup_role_configure;
shell_surface_role_class->managed = xdg_popup_role_managed;
shell_surface_role_class->ping = xdg_popup_role_ping;
}
static void
xdg_shell_get_xdg_surface (struct wl_client *client,
struct wl_resource *resource,
guint32 id,
struct wl_resource *surface_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandXdgSurface *xdg_surface;
MetaWindow *window;
if (META_IS_WAYLAND_XDG_SURFACE (surface->role) &&
META_WAYLAND_XDG_SURFACE (surface->role)->resource)
{
wl_resource_post_error (surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"xdg_shell::get_xdg_surface already requested");
return;
}
if (!meta_wayland_surface_assign_role (surface, META_TYPE_WAYLAND_XDG_SURFACE))
{
wl_resource_post_error (resource, XDG_SHELL_ERROR_ROLE,
"wl_surface@%d already has a different role",
wl_resource_get_id (surface->resource));
return;
}
xdg_surface = META_WAYLAND_XDG_SURFACE (surface->role);
xdg_surface->resource = wl_resource_create (client,
&xdg_surface_interface,
wl_resource_get_version (resource),
id);
wl_resource_set_implementation (xdg_surface->resource,
&meta_wayland_xdg_surface_interface,
xdg_surface,
xdg_surface_destructor);
xdg_surface->xdg_shell_resource = resource;
window = meta_window_wayland_new (meta_get_display (), surface);
meta_wayland_surface_set_window (surface, window);
}
static void
xdg_shell_get_xdg_popup (struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *surface_resource,
struct wl_resource *parent_resource,
struct wl_resource *seat_resource,
uint32_t serial,
int32_t x,
int32_t y)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandPopupSurface *popup_surface;
MetaWaylandSurface *parent_surf = wl_resource_get_user_data (parent_resource);
MetaWaylandSurface *top_popup;
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaWindow *window;
MetaDisplay *display = meta_get_display ();
MetaWaylandXdgPopup *xdg_popup;
MetaWaylandPopup *popup;
if (META_IS_WAYLAND_XDG_POPUP (surface->role) &&
META_WAYLAND_XDG_POPUP (surface->role)->resource)
{
wl_resource_post_error (surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"xdg_shell::get_xdg_popup already requested");
return;
}
if (!meta_wayland_surface_assign_role (surface, META_TYPE_WAYLAND_XDG_POPUP))
{
wl_resource_post_error (resource, XDG_SHELL_ERROR_ROLE,
"wl_surface@%d already has a different role",
wl_resource_get_id (surface->resource));
return;
}
if (parent_surf == NULL ||
parent_surf->window == NULL ||
(!META_IS_WAYLAND_XDG_POPUP (parent_surf->role) &&
!META_IS_WAYLAND_XDG_SURFACE (parent_surf->role)))
{
wl_resource_post_error (resource,
XDG_SHELL_ERROR_INVALID_POPUP_PARENT,
"invalid parent surface");
return;
}
top_popup = meta_wayland_pointer_get_top_popup (&seat->pointer);
if ((top_popup == NULL && !META_IS_WAYLAND_XDG_SURFACE (parent_surf->role)) ||
(top_popup != NULL && parent_surf != top_popup))
{
wl_resource_post_error (resource,
XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP,
"parent not top most surface");
return;
}
xdg_popup = META_WAYLAND_XDG_POPUP (surface->role);
xdg_popup->resource = wl_resource_create (client, &xdg_popup_interface,
wl_resource_get_version (resource), id);
wl_resource_set_implementation (xdg_popup->resource,
&meta_wayland_xdg_popup_interface,
xdg_popup,
xdg_popup_destructor);
xdg_popup->xdg_shell_resource = resource;
if (!meta_wayland_seat_can_popup (seat, serial))
{
xdg_popup_send_popup_done (xdg_popup->resource);
return;
}
xdg_popup->parent_surface = parent_surf;
xdg_popup->parent_destroy_listener.notify = handle_popup_parent_destroyed;
wl_resource_add_destroy_listener (parent_surf->resource,
&xdg_popup->parent_destroy_listener);
window = meta_window_wayland_new (display, surface);
meta_window_wayland_place_relative_to (window, parent_surf->window, x, y);
window->showing_for_first_time = FALSE;
meta_wayland_surface_set_window (surface, window);
meta_window_focus (window, meta_display_get_current_time (display));
popup_surface = META_WAYLAND_POPUP_SURFACE (surface->role);
popup = meta_wayland_pointer_start_popup_grab (&seat->pointer,
popup_surface);
if (popup == NULL)
{
xdg_popup_send_popup_done (xdg_popup->resource);
meta_wayland_surface_destroy_window (surface);
return;
}
xdg_popup->popup = popup;
}
static void
xdg_shell_destroy (struct wl_client *client,
struct wl_resource *resource)
{
wl_resource_destroy (resource);
}
static void
xdg_shell_use_unstable_version (struct wl_client *client,
struct wl_resource *resource,
int32_t version)
{
if (version != XDG_SHELL_VERSION_CURRENT)
wl_resource_post_error (resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"bad xdg-shell version: %d\n", version);
}
static void
xdg_shell_pong (struct wl_client *client,
struct wl_resource *resource,
uint32_t serial)
{
MetaDisplay *display = meta_get_display ();
meta_display_pong_for_serial (display, serial);
}
static const struct xdg_shell_interface meta_wayland_xdg_shell_interface = {
xdg_shell_destroy,
xdg_shell_use_unstable_version,
xdg_shell_get_xdg_surface,
xdg_shell_get_xdg_popup,
xdg_shell_pong,
};
static void
bind_xdg_shell (struct wl_client *client,
void *data,
guint32 version,
guint32 id)
{
struct wl_resource *resource;
if (version != META_XDG_SHELL_VERSION)
{
g_warning ("using xdg-shell without stable version %d\n",
META_XDG_SHELL_VERSION);
return;
}
resource = wl_resource_create (client, &xdg_shell_interface, version, id);
wl_resource_set_implementation (resource, &meta_wayland_xdg_shell_interface,
data, NULL);
}
void
meta_wayland_xdg_shell_init (MetaWaylandCompositor *compositor)
{
if (wl_global_create (compositor->wayland_display,
&xdg_shell_interface,
META_XDG_SHELL_VERSION,
compositor, bind_xdg_shell) == NULL)
g_error ("Failed to register a global xdg-shell object");
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2013-2015 Red Hat, Inc.
*
* 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.
*/
#ifndef META_WAYLAND_XDG_SHELL_H
#define META_WAYLAND_XDG_SHELL_H
#include "wayland/meta-wayland-surface.h"
#define META_TYPE_WAYLAND_XDG_SURFACE (meta_wayland_xdg_surface_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandXdgSurface,
meta_wayland_xdg_surface,
META, WAYLAND_XDG_SURFACE,
MetaWaylandSurfaceRoleShellSurface);
#define META_TYPE_WAYLAND_XDG_POPUP (meta_wayland_xdg_popup_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandXdgPopup,
meta_wayland_xdg_popup,
META, WAYLAND_XDG_POPUP,
MetaWaylandSurfaceRoleShellSurface);
void meta_wayland_xdg_shell_init (MetaWaylandCompositor *compositor);
#endif /* META_WAYLAND_XDG_SHELL_H */

View File

@@ -32,7 +32,6 @@
#include "stack-tracker.h"
#include "meta-wayland-private.h"
#include "meta-wayland-surface.h"
#include "meta-wayland-xdg-shell.h"
#include "compositor/meta-surface-actor-wayland.h"
struct _MetaWindowWayland
@@ -68,7 +67,15 @@ meta_window_wayland_manage (MetaWindow *window)
0);
}
meta_wayland_surface_window_managed (window->surface, window);
if (META_IS_WAYLAND_SURFACE_ROLE_XDG_POPUP (window->surface->role))
{
MetaWaylandSurface *parent = window->surface->popup.parent;
g_assert (parent);
meta_window_set_transient_for (window, parent->window);
meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
}
}
static void
@@ -124,10 +131,6 @@ surface_state_changed (MetaWindow *window)
{
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
/* don't send notify when the window is being unmanaged */
if (window->unmanaging)
return;
meta_wayland_surface_configure_notify (window->surface,
wl_window->last_sent_width,
wl_window->last_sent_height,
@@ -170,10 +173,6 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
g_assert (window->frame == NULL);
/* don't do anything if we're dropping the window, see #751847 */
if (window->unmanaging)
return;
/* The scale the window is drawn in might change depending on what monitor it
* is mainly on. Scale the configured rectangle to be in logical pixel
* coordinate space so that we can have a scale independent size to pass
@@ -404,6 +403,12 @@ appears_focused_changed (GObject *object,
gpointer user_data)
{
MetaWindow *window = META_WINDOW (object);
/* When we're unmanaging, we remove focus from the window,
* causing this to fire. Don't do anything in that case. */
if (window->unmanaging)
return;
surface_state_changed (window);
}

View File

@@ -618,12 +618,6 @@ xwayland_surface_commit (MetaWaylandSurfaceRole *surface_role,
meta_wayland_surface_queue_pending_state_frame_callbacks (surface, pending);
}
static MetaWaylandSurface *
xwayland_surface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
return meta_wayland_surface_role_get_surface (surface_role);
}
static void
meta_wayland_surface_role_xwayland_init (MetaWaylandSurfaceRoleXWayland *role)
{
@@ -637,5 +631,4 @@ meta_wayland_surface_role_xwayland_class_init (MetaWaylandSurfaceRoleXWaylandCla
surface_role_class->assigned = xwayland_surface_assigned;
surface_role_class->commit = xwayland_surface_commit;
surface_role_class->get_toplevel = xwayland_surface_get_toplevel;
}