Compare commits

...

28 Commits

Author SHA1 Message Date
Christian Hergert
cfc348d69c clutter/actor: avoid transform node for identity matrix
If the transform matrix is an identity, then positioning wont change and
we can avoid creating the transform node altogether. This is based on
a similar find in GTK today while reducing temporary allocations.

This cuts the number of transforms created in clutter_actor_paint() by
about half under light testing of GNOME Shell from 6.8% to 2.4% of
allocations.

Before:

    ALLOCATED      TOTAL    FUNCTION
[   20.4 MiB] [  21.20%]    clutter_actor_paint
[   11.0 MiB] [  11.45%]      clutter_paint_node_paint
[    6.6 MiB] [   6.84%]      clutter_transform_node_new
[    2.5 MiB] [   2.61%]      clutter_actor_node_new

After:

    ALLOCATED      TOTAL    FUNCTION
[   33.4 MiB] [  24.12%]    clutter_actor_paint
[   26.2 MiB] [  18.91%]      clutter_paint_node_paint
[    3.4 MiB] [   2.43%]      clutter_actor_node_new
[    3.3 MiB] [   2.41%]      clutter_transform_node_new

Allocation amounts will have differed due to different amounts of running
time, but the % of allocations has now dropped below
clutter_actor_node_new() which should be expected.

https://gitlab.gnome.org/GNOME/mutter/issues/1056
2020-02-19 21:24:32 -08:00
Jonas Ådahl
44ae38599f wayland: Move MetaWindow ownership to window owning roles
There are two surface roles owning a MetaWindow: MetaWaylandShellSurface
(basis of MetaWaylandXdgToplevel, MetaWaylandXdgPopup,
MetaWaylandWlShellSurface, etc), and MetaXwaylandSurface.

With these two role types, the MetaWindow has two different types of
life times. With MetaWaylandShellSurface, the window is owned and
managed by the role itself, while with MetaXwaylandSurface, the
MetaWindow is tied to the X11 window, while the Wayland surface and its
role plays more the role of the backing rendering surface.

Before, for historical reasons, MetaWindow was part of
MetaWaylandSurface, even though just some roles used it, and before
'wayland: Untie MetaWindowXwayland lifetime from the wl_surface' had
equivalent life times as well. But since that commit, the management
changed. To not have the same fied in MetaWaylandSurface being managed
in such drastically different ways, rearrange it so that the roles that
has a MetaWindow themself manages it in the way it is meant to; meaning
MetaWaylandShellSurface practically owns it, while with Xwayland, the
existance of a MetaWindow is tracked via X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
df642eb150 wayland: Move calc-showing window logic to roles having windows
https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
722ae2b77a wayland/surface: Let roles set DND functions
The DND functions are role specific, with Xwayland surface being the
special one. Let the roles set it instead of having per role like logic
in MetaWaylandSurface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
54194e67e3 wayland/surface: Move relative coordinate calculating to roles
The role determines how a relative coordinate is calculated. More
specifically, using clutters API to transform coordinates is only
accurate right after a clutter layout pass but this function is used
e.g. to deliver pointer motion events which can happen at any time. This
isn't a problem for Wayland clients since they don't control their
position, but X clients do and we'd be sending outdated coordinates if a
client is moving a window in response to motion events.

This was already done already, but now move the Xwayland specific logic
to the Xwayland surface role, keeping the generic transformation logic
in the generic actor surface role.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
c0c74484bc wayland: Don't access MetaWaylandSurface::window directly
It'll be moved to the role owning it, accessed via a helper function
implemented by the role. Currently it still just fetches the field in
MetaWaylandSurface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
5149e1e43a wayland: Move tree updating to the shell surface role
The shell surface role is the one where subsurfaces may exist, and it
has direct relation to the MetaWindowActorWayland which currently has
the subsurface stacking logic.

Instead of directly finding the window actor when dealing with
subsurfaces, notify the parent surface that the subsurface state
changed, so that it can outsource the application of this information to
the role. For subsurface roles, this simply means forward upward to the
parent; for shell surface roles, this means regenerate the surface actor
layering.

This allows us to move away from accessing the window directly from the
surface, which in turn allows us to change the ownership structure of
windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
ac2c870177 surface-actor: Remove get_window() API and vfunc
It was unused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Ådahl
f21595687f xwayland: Move out surface role related logic
Does some needed naming cleanup while at it, to be more similar to other
role types.

In short, MetaWaylandSurfaceRoleXwayland was changed to
MetaXwaylandSurface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/835
2020-02-19 22:34:28 +00:00
Jonas Dreßler
e51279dcf0 display: Only send one ping to a window at a time
If a window already is being pinged, it doesn't make sense to send more
pings to the window, instead we should just wait for that answer or
timeout until we send a new one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/891
2020-02-19 21:20:29 +00:00
Jonas Dreßler
9b58033375 display: Make sure ping serials are never reused
Using a timestamp twice in a row (e.g. when activating two windows in
response to the same event or due to other bugs) will break the window
detection and show a close dialog on the wrong window. This is a grave
error that should never happen, so check every timestamp before sending
the ping for uniqueness and if the timestamp was already used and its
ping is still pending, log a warning message and don't send the ping.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/891
2020-02-19 21:20:29 +00:00
Jonas Dreßler
0bf9727a31 display: Fix intendation of an argument and add details to a warning
https://gitlab.gnome.org/GNOME/mutter/merge_requests/891
2020-02-19 21:20:29 +00:00
Jonas Dreßler
d053ccfb18 window: Check window responsiveness on every window focus
Increase the number of checks whether a window is still responsive and
ping windows on every call to `meta_window_focus()` instead of
`meta_window_activate_full()`. This ensures the window is also pinged in
case normal interaction like clicks on the window happen and a close
dialog will eventually get shown.

Related https://gitlab.gnome.org/GNOME/mutter/issues/395

https://gitlab.gnome.org/GNOME/mutter/merge_requests/891
2020-02-19 21:20:29 +00:00
Jonas Dreßler
7cc02cf24e backends/native: Replace tabs with spaces
Replace the few remaining places where tabs are used for indentation
with spaces.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1065
2020-02-19 18:28:29 +00:00
Jonas Dreßler
e07478f8bc virtual-input-device/native: Fix warning message
We want to log the evdev keycode here, not the Clutter one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1065
2020-02-19 18:28:29 +00:00
Jonas Dreßler
efe1bc2e59 util: Add INPUT debug topic
Allow debugging input issues more easily by adding an INPUT debug topic.
Currently there are only debug messages for the native backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1065
2020-02-19 18:28:29 +00:00
Adam Jackson
41992757e0 cogl: GLES3 has sync objects
https://gitlab.gnome.org/GNOME/mutter/merge_requests/882
2020-02-19 17:55:46 +00:00
Adam Jackson
445af61a68 cogl: GLES3 has vertex array objects
https://gitlab.gnome.org/GNOME/mutter/merge_requests/882
2020-02-19 17:55:46 +00:00
Adam Jackson
03ef335a70 cogl: GLES3 has sampler objects
https://gitlab.gnome.org/GNOME/mutter/merge_requests/882
2020-02-19 17:55:46 +00:00
Adam Jackson
b4226daadb cogl: GLES3 has glGetStringi
https://gitlab.gnome.org/GNOME/mutter/merge_requests/882
2020-02-19 17:55:46 +00:00
Daniel van Vugt
b70611e3cf clutter/enums: Correct docs about ClutterOffscreenRedirect
The default value is zero, not the flag the docs say.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1068
2020-02-19 17:36:29 +00:00
Florian Müllner
35fe6a40ed clutter: Make clutter_contraint_update_preferred_size() public
This is necessary for gobject-introspection to correctly pick up
the annotations for the corresponding vfunc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1067
2020-02-19 11:57:05 +00:00
Emmanuele Bassi
4f8e518d42 bind-constraint: Update the preferred size
Bind the preferred size of an actor using a BindConstraint to the
preferred size of the source of the constraint, depending on the
coordinate of the constraint.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1070
2020-02-19 08:26:28 -03:00
Yi-Jyun Pan
d2953e0d33 Update Chinese (Taiwan) translation
(cherry picked from commit 053bb5901a)
2020-02-19 03:09:27 +00:00
Sebastian Keller
b45b03b063 surface-actor-x11: Avoid flicker when (un)redirecting windows
Currently when a window is requested to be unredirected, the
corresponding pixmap and texture can get cleared before the window has
been unredirected by the X server. This can result in the windows behind
showing through which causes a short flicker after showing an OSD or
notification when a fullscreen application is running.
Fix this by ensuring the texture is only cleared after the window has
been unredirected by the server.

Similarly when the window is being redirected again, the pixmap of the
window can only be requested after the redirection has been completed by
the server. This currently can happen in a different frame than the next
redraw of the actor resulting in an empty texture until the next redraw.
Fix this by queuing a redraw immediately after redirecting.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/997
2020-02-18 22:49:01 +00:00
Jonas Ådahl
c06fae4741 window-actor: Don't show actor until meta_window_actor_show()
By default clutter will show an actor as it is added to a parent. This
means that after we create the window actor, when it's added to the
window group, we implicitly show it. What we really want is to not show
it until the window is supposed to be shown, which happens when
meta_window_actor_show() is called, as showing prior to that, could
cause issues.

Avoid the implicit show by setting the "show-on-set-parent" property on
the window actor to `FALSE` on window actor construction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1066
2020-02-18 23:04:49 +01:00
Olivier Fourdan
76e0d7293d window-actor/x11: Update opaque region
Now that the opaque region is not reset by the Wayland actor surface, we
need to update the opaque region just like we do for input region.

That fixes a regression with client-side decoration X11 windows running
in Xwayland.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1060
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1043
2020-02-17 23:37:18 +00:00
Jonas Ådahl
0e0afa240e settings: Improve logging of enabled experimental features
We didn't log what we enabled, just g_info():ed what failed to be
enabled. Change this to g_warning() what failed to be enabled, and
g_message() on what was enabled, so that both will be visible in the
logs.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1061
2020-02-17 17:08:21 +00:00
49 changed files with 1128 additions and 548 deletions

View File

@@ -3997,11 +3997,14 @@ clutter_actor_paint (ClutterActor *self,
clutter_actor_get_transform (self, &transform);
transform_node = clutter_transform_node_new (&transform);
clutter_paint_node_add_child (transform_node, root_node);
clutter_paint_node_unref (root_node);
if (!cogl_matrix_is_identity (&transform))
{
transform_node = clutter_transform_node_new (&transform);
clutter_paint_node_add_child (transform_node, root_node);
clutter_paint_node_unref (root_node);
root_node = g_steal_pointer (&transform_node);
root_node = g_steal_pointer (&transform_node);
}
#ifdef CLUTTER_ENABLE_DEBUG
/* Catch when out-of-band transforms have been made by actors not as part

View File

@@ -144,6 +144,55 @@ source_destroyed (ClutterActor *actor,
bind->source = NULL;
}
static void
clutter_bind_constraint_update_preferred_size (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterOrientation direction,
float for_size,
float *minimum_size,
float *natural_size)
{
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
float source_min, source_nat;
if (bind->source == NULL)
return;
/* only these bindings affect the preferred size */
if (!(bind->coordinate == CLUTTER_BIND_WIDTH ||
bind->coordinate == CLUTTER_BIND_HEIGHT ||
bind->coordinate == CLUTTER_BIND_SIZE ||
bind->coordinate == CLUTTER_BIND_ALL))
return;
switch (direction)
{
case CLUTTER_ORIENTATION_HORIZONTAL:
if (bind->coordinate != CLUTTER_BIND_HEIGHT)
{
clutter_actor_get_preferred_width (bind->source, for_size,
&source_min,
&source_nat);
*minimum_size = source_min;
*natural_size = source_nat;
}
break;
case CLUTTER_ORIENTATION_VERTICAL:
if (bind->coordinate != CLUTTER_BIND_WIDTH)
{
clutter_actor_get_preferred_height (bind->source, for_size,
&source_min,
&source_nat);
*minimum_size = source_min;
*natural_size = source_nat;
}
break;
}
}
static void
clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
@@ -328,6 +377,8 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
meta_class->set_actor = clutter_bind_constraint_set_actor;
constraint_class->update_allocation = clutter_bind_constraint_update_allocation;
constraint_class->update_preferred_size = clutter_bind_constraint_update_preferred_size;
/**
* ClutterBindConstraint:source:
*

View File

@@ -30,13 +30,6 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation);
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterOrientation direction,
float for_size,
float *minimum_size,
float *natural_size);
G_END_DECLS
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */

View File

@@ -222,6 +222,17 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
return !clutter_actor_box_equal (allocation, &old_alloc);
}
/**
* clutter_constraint_update_preferred_size:
* @constraint: a #ClutterConstraint
* @actor: a #ClutterActor
* @direction: a #ClutterOrientation
* @for_size: the size in the opposite direction
* @minimum_size: (inout): the minimum size to modify
* @natural_size: (inout): the natural size to modify
*
* Asks the @constraint to update the size request of a #ClutterActor.
*/
void
clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
ClutterActor *actor,

View File

@@ -99,6 +99,14 @@ struct _ClutterConstraintClass
CLUTTER_EXPORT
GType clutter_constraint_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterOrientation direction,
float for_size,
float *minimum_size,
float *natural_size);
/* ClutterActor API */
CLUTTER_EXPORT
void clutter_actor_add_constraint (ClutterActor *self,

View File

@@ -535,7 +535,7 @@ typedef enum /*< prefix=CLUTTER_ACTOR >*/
* ClutterOffscreenRedirect:
* @CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY: Only redirect
* the actor if it is semi-transparent and its has_overlaps()
* virtual returns %TRUE. This is the default.
* virtual returns %TRUE.
* @CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: Always redirect the actor to an
* offscreen buffer even if it is fully opaque.
*

View File

@@ -253,6 +253,10 @@ _cogl_driver_update_features (CoglContext *context,
(void *) _cogl_renderer_get_proc_address (context->display->renderer,
"glGetString",
TRUE);
context->glGetStringi =
(void *) _cogl_renderer_get_proc_address (context->display->renderer,
"glGetStringi",
TRUE);
gl_extensions = _cogl_context_get_gl_extensions (context);
@@ -310,6 +314,9 @@ _cogl_driver_update_features (CoglContext *context,
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ANY_GL, TRUE);
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE);
if (context->glGenSamplers)
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, TRUE);
if (context->glBlitFramebuffer)
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
@@ -359,6 +366,9 @@ _cogl_driver_update_features (CoglContext *context,
_cogl_check_extension ("GL_OES_egl_sync", gl_extensions))
COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_OES_EGL_SYNC, TRUE);
if (context->glFenceSync)
COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_FENCE, TRUE);
if (_cogl_check_extension ("GL_EXT_texture_rg", gl_extensions))
COGL_FLAGS_SET (context->features,
COGL_FEATURE_ID_TEXTURE_RG,

View File

@@ -162,7 +162,7 @@ COGL_EXT_FUNCTION (void, glFramebufferTexture2DMultisampleIMG,
COGL_EXT_END ()
COGL_EXT_BEGIN (ARB_sampler_objects, 3, 3,
0, /* not in either GLES */
COGL_EXT_IN_GLES3,
"ARB:\0",
"sampler_objects\0")
COGL_EXT_FUNCTION (void, glGenSamplers,
@@ -181,7 +181,7 @@ COGL_EXT_FUNCTION (void, glSamplerParameteri,
COGL_EXT_END ()
COGL_EXT_BEGIN (only_gl3, 3, 0,
0, /* not in either GLES */
COGL_EXT_IN_GLES3,
"\0",
"\0")
COGL_EXT_FUNCTION (const GLubyte *, glGetStringi,
@@ -189,7 +189,7 @@ COGL_EXT_FUNCTION (const GLubyte *, glGetStringi,
COGL_EXT_END ()
COGL_EXT_BEGIN (vertex_array_object, 3, 0,
0, /* not in either GLES */
COGL_EXT_IN_GLES3,
"ARB\0OES\0",
"vertex_array_object\0")
COGL_EXT_FUNCTION (void, glBindVertexArray,
@@ -212,7 +212,7 @@ COGL_EXT_END ()
#ifdef GL_ARB_sync
COGL_EXT_BEGIN (sync, 3, 2,
0, /* not in either GLES */
COGL_EXT_IN_GLES3,
"ARB:\0",
"sync\0")
COGL_EXT_FUNCTION (GLsync, glFenceSync,

View File

@@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: metacity 3.3.4\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2019-02-04 17:52+0000\n"
"PO-Revision-Date: 2019-02-17 23:15+0800\n"
"POT-Creation-Date: 2019-11-21 15:22+0000\n"
"PO-Revision-Date: 2019-11-23 13:58+0800\n"
"Last-Translator: pan93412 <pan93412@gmail.com>\n"
"Language-Team: Chinese <zh-l10n@linux.org.tw>\n"
"Language: zh_TW\n"
@@ -19,7 +19,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Lokalize 18.12.2\n"
"X-Generator: Lokalize 19.11.80\n"
#: data/50-mutter-navigation.xml:6
msgid "Navigation"
@@ -371,6 +371,16 @@ msgid "Enable experimental features"
msgstr "啟用試驗性功能"
#: data/org.gnome.mutter.gschema.xml.in:108
#| msgid ""
#| "To enable experimental features, add the feature keyword to the list. "
#| "Whether the feature requires restarting the compositor depends on the "
#| "given feature. Any experimental feature is not required to still be "
#| "available, or configurable. Dont expect adding anything in this setting "
#| "to be future proof. Currently possible keywords: • “scale-monitor-"
#| "framebuffer” — makes mutter default to layout logical monitors in a "
#| "logical pixel coordinate space, while scaling monitor framebuffers "
#| "instead of window content, to manage HiDPI monitors. Does not require a "
#| "restart."
msgid ""
"To enable experimental features, add the feature keyword to the list. "
"Whether the feature requires restarting the compositor depends on the given "
@@ -379,27 +389,41 @@ msgid ""
"proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes "
"mutter default to layout logical monitors in a logical pixel coordinate "
"space, while scaling monitor framebuffers instead of window content, to "
"manage HiDPI monitors. Does not require a restart."
"manage HiDPI monitors. Does not require a restart. • “rt-scheduler” — makes "
"mutter request a low priority real-time scheduling. The executable or user "
"must have CAP_SYS_NICE. Requires a restart. • “autostart-xwayland” — "
"initializes Xwayland lazily if there are X11 clients. Requires restart."
msgstr ""
"若要啟用實驗性功能,請將功能關鍵字加入列表中。置於該功能是否須要重新啟動混成"
"器則視給予的功能而定。任何實驗性功能不一定能用、或是可以調整設定。請不要預期"
"在此設定中加入的任何東西未來都能存在。目前可用的關鍵字有: • “scale-monitor-"
"framebuffer— 讓 mutter 預設採用邏輯像素座標空間的配置邏輯螢幕,而縮放螢幕 "
"framebuffer 則取代視窗內容以管理 HiDPI 螢幕。不要重新啟動。"
"在此設定中加入的任何東西未來都能存在。目前可用的關鍵字有:"
"• 「scale-monitor-framebuffer— 讓 mutter 預設採用邏輯像素座標空間的"
"配置邏輯螢幕,而縮放螢幕 framebuffer 則取代視窗內容以管理 HiDPI 螢幕。不要重新啟動。"
"• 「rt-scheduler」— 讓 mutter 請求低優先級的即時排程。可執行檔或使用者必須要有"
"CAP_SYS_NICE。需要重新啟動。"
"• 「autostart-xwayland」— 如果有 X11 用戶端就延遲初始化 Xwayland。需要重新啟動。"
#: data/org.gnome.mutter.gschema.xml.in:141
#: data/org.gnome.mutter.gschema.xml.in:134
msgid "Modifier to use to locate the pointer"
msgstr "要用來定位指標的輔助鍵"
#: data/org.gnome.mutter.gschema.xml.in:135
msgid "This key will initiate the “locate pointer” action."
msgstr "這個按鍵將會「定位指標」。"
#: data/org.gnome.mutter.gschema.xml.in:155
msgid "Select window from tab popup"
msgstr "從分頁彈出項選擇視窗"
#: data/org.gnome.mutter.gschema.xml.in:146
#: data/org.gnome.mutter.gschema.xml.in:160
msgid "Cancel tab popup"
msgstr "取消分頁彈出項"
#: data/org.gnome.mutter.gschema.xml.in:151
#: data/org.gnome.mutter.gschema.xml.in:165
msgid "Switch monitor configurations"
msgstr "切換螢幕組態"
#: data/org.gnome.mutter.gschema.xml.in:156
#: data/org.gnome.mutter.gschema.xml.in:170
msgid "Rotates the built-in monitor configuration"
msgstr "旋轉切換內建螢幕組態"
@@ -456,26 +480,38 @@ msgid "Re-enable shortcuts"
msgstr "重新啟用快捷鍵"
#: data/org.gnome.mutter.wayland.gschema.xml.in:64
msgid "Allow grabs with Xwayland"
msgstr "在 Xwayland 允許抓取"
#| msgid "Allow grabs with Xwayland"
msgid "Allow X11 grabs to lock keyboard focus with Xwayland"
msgstr "允許 X11 抓取以使用 Xwayland 鎖定鍵盤焦點"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65
#, fuzzy
#| msgid ""
#| "Allow keyboard grabs issued by X11 applications running in Xwayland to be "
#| "taken into account. For a X11 grab to be taken into account under "
#| "Wayland, the client must also either send a specific X11 ClientMessage to "
#| "the root window or be among the applications white-listed in key "
#| "“xwayland-grab-access-rules”."
msgid ""
"Allow keyboard grabs issued by X11 applications running in Xwayland to be "
"taken into account. For a X11 grab to be taken into account under Wayland, "
"the client must also either send a specific X11 ClientMessage to the root "
"window or be among the applications white-listed in key “xwayland-grab-"
"access-rules”."
"Allow all keyboard events to be routed to X11 “override redirect” windows "
"with a grab when running in Xwayland. This option is to support X11 clients "
"which map an “override redirect” window (which do not receive keyboard "
"focus) and issue a keyboard grab to force all keyboard events to that "
"window. This option is seldom used and has no effect on regular X11 windows "
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
msgstr ""
"考慮到在 Xwayland 中執行的 X11 應用程序發出的鍵盤抓取。對於在 Wayland 下考慮"
"的 X11 抓取,客戶端也必須送出一個特定的 X11 ClientMessage 到 root 視窗或者在 "
"xwayland-grab-access-rules 鍵白名單其中的應用程式"
"xwayland-grab-access-rules 鍵白名單其中的應用程式"
#: data/org.gnome.mutter.wayland.gschema.xml.in:77
#: data/org.gnome.mutter.wayland.gschema.xml.in:84
msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "Xwayland 應用程式允許發出鍵盤抓取"
#: data/org.gnome.mutter.wayland.gschema.xml.in:78
#: data/org.gnome.mutter.wayland.gschema.xml.in:85
msgid ""
"List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
@@ -499,7 +535,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2423
#: src/backends/meta-input-settings.c:2532
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "模式切換( 群組 %d)"
@@ -507,121 +543,124 @@ msgstr "模式切換( 群組 %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2446
#: src/backends/meta-input-settings.c:2555
msgid "Switch monitor"
msgstr "切換螢幕"
#: src/backends/meta-input-settings.c:2448
#: src/backends/meta-input-settings.c:2557
msgid "Show on-screen help"
msgstr "顯示螢幕求助"
#: src/backends/meta-monitor-manager.c:954
#: src/backends/meta-monitor.c:223
msgid "Built-in display"
msgstr "內建顯示"
#: src/backends/meta-monitor-manager.c:986
#: src/backends/meta-monitor.c:252
msgid "Unknown"
msgstr "不明"
#: src/backends/meta-monitor-manager.c:988
#: src/backends/meta-monitor.c:254
msgid "Unknown Display"
msgstr "不明的顯示器"
#: src/backends/meta-monitor-manager.c:996
#: src/backends/meta-monitor.c:262
#, c-format
#| msgid "%s %s"
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor-manager.c:1004
#: src/backends/meta-monitor.c:270
#, c-format
#| msgid "%s %s"
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
"inches could not be calculated, e.g. Dell U2414H"
msgid "%s %s"
msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:82
msgid "Compositor"
msgstr "合成器"
# FIXME: I'm still unclear about the meaning of XGetSelectionOwner -- Abel
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:482
#: src/compositor/compositor.c:509
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
msgstr "在畫面「%2$s」中的第 %1$i 個螢幕中已啟動另一個組合視窗管理員。"
#: src/core/bell.c:252
#: src/core/bell.c:192
msgid "Bell event"
msgstr "響鈴事件"
#: src/core/main.c:185
#: src/core/main.c:190
msgid "Disable connection to session manager"
msgstr "停用到作業階段管理員的連線"
#: src/core/main.c:191
#: src/core/main.c:196
msgid "Replace the running window manager"
msgstr "取代執行中的視窗管理員"
#: src/core/main.c:197
#: src/core/main.c:202
msgid "Specify session management ID"
msgstr "指定作業階段管理 ID"
#: src/core/main.c:202
#: src/core/main.c:207
msgid "X Display to use"
msgstr "使用的 X 畫面"
#: src/core/main.c:208
#: src/core/main.c:213
msgid "Initialize session from savefile"
msgstr "以 savefile 初始化作業階段"
#: src/core/main.c:214
#: src/core/main.c:219
msgid "Make X calls synchronous"
msgstr "使用同步方式調用 X 函式"
#: src/core/main.c:221
#: src/core/main.c:226
msgid "Run as a wayland compositor"
msgstr "以 wayland 組合器執行"
#: src/core/main.c:227
#: src/core/main.c:232
msgid "Run as a nested compositor"
msgstr "以巢狀組合器執行"
#: src/core/main.c:233
#: src/core/main.c:238
msgid "Run wayland compositor without starting Xwayland"
msgstr "在不啟動 Xwayland 的情況下開啟 Wayland 合成器"
#: src/core/main.c:241
#: src/core/main.c:246
msgid "Run as a full display server, rather than nested"
msgstr "以完全顯示伺服器執行,而非巢狀"
#: src/core/main.c:247
#: src/core/main.c:252
msgid "Run with X11 backend"
msgstr "透過 X11 後端執行"
#. Translators: %s is a window title
#: src/core/meta-close-dialog-default.c:150
#: src/core/meta-close-dialog-default.c:151
#, c-format
msgid "“%s” is not responding."
msgstr "「%s」沒有回應。"
#: src/core/meta-close-dialog-default.c:152
#: src/core/meta-close-dialog-default.c:153
msgid "Application is not responding."
msgstr "應用程式沒有回應。"
#: src/core/meta-close-dialog-default.c:157
#: src/core/meta-close-dialog-default.c:158
msgid ""
"You may choose to wait a short while for it to continue or force the "
"application to quit entirely."
msgstr "您可以選擇稍等一下讓它繼續,或者強制完全退出程式。"
#: src/core/meta-close-dialog-default.c:164
#: src/core/meta-close-dialog-default.c:165
msgid "_Force Quit"
msgstr "強制退出(_F)"
#: src/core/meta-close-dialog-default.c:164
#: src/core/meta-close-dialog-default.c:165
msgid "_Wait"
msgstr "等待(_W)"
@@ -648,21 +687,21 @@ msgid "Mutter plugin to use"
msgstr "要使用的 Mutter 外掛程式"
# (Abel) take care of the same string in libwnck
#: src/core/prefs.c:1786
#: src/core/prefs.c:1849
#, c-format
msgid "Workspace %d"
msgstr "工作區 %d"
#: src/core/util.c:121
#: src/core/util.c:122
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "編譯 Mutter 時並沒有加入詳細偵錯模式的支援\n"
#: src/wayland/meta-wayland-tablet-pad.c:567
#: src/wayland/meta-wayland-tablet-pad.c:568
#, c-format
msgid "Mode Switch: Mode %d"
msgstr "模式切換:模式 %d"
#: src/x11/meta-x11-display.c:666
#: src/x11/meta-x11-display.c:679
#, c-format
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
@@ -671,27 +710,32 @@ msgstr ""
"畫面「%s」已經有了視窗管理員請嘗試使用 --replace 選項來替換目前的視窗管理"
"員。"
#: src/x11/meta-x11-display.c:1008
#: src/x11/meta-x11-display.c:1040
msgid "Failed to initialize GDK\n"
msgstr "無法初始化 GDK\n"
#: src/x11/meta-x11-display.c:1032
#: src/x11/meta-x11-display.c:1064
#, c-format
msgid "Failed to open X Window System display “%s”\n"
msgstr "無法開啟 X Window 系統畫面「%s」\n"
#: src/x11/meta-x11-display.c:1115
#: src/x11/meta-x11-display.c:1147
#, c-format
msgid "Screen %d on display “%s” is invalid\n"
msgstr "畫面「%2$s」中的第 %1$d 個螢幕無效\n"
#: src/x11/meta-x11-selection-input-stream.c:445
#, c-format
msgid "Format %s not supported"
msgstr "不支援 %s 格式"
#: src/x11/session.c:1821
msgid ""
"These windows do not support “save current setup” and will have to be "
"restarted manually next time you log in."
msgstr "這些視窗不支援「儲存目前的設定」,必須在下次登入後自行啟動。"
#: src/x11/window-props.c:568
#: src/x11/window-props.c:569
#, c-format
msgid "%s (on %s)"
msgstr "%s在 %s"

View File

@@ -248,7 +248,7 @@ experimental_features_handler (GVariant *features_variant,
{
MetaSettings *settings = data;
GVariantIter features_iter;
char *feature;
char *feature_str;
MetaExperimentalFeature features = META_EXPERIMENTAL_FEATURE_NONE;
if (settings->experimental_features_overridden)
@@ -258,18 +258,25 @@ experimental_features_handler (GVariant *features_variant,
}
g_variant_iter_init (&features_iter, features_variant);
while (g_variant_iter_loop (&features_iter, "s", &feature))
while (g_variant_iter_loop (&features_iter, "s", &feature_str))
{
if (g_str_equal (feature, "scale-monitor-framebuffer"))
features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
else if (g_str_equal (feature, "kms-modifiers"))
features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
else if (g_str_equal (feature, "rt-scheduler"))
features |= META_EXPERIMENTAL_FEATURE_RT_SCHEDULER;
else if (g_str_equal (feature, "autostart-xwayland"))
features |= META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND;
MetaExperimentalFeature feature = META_EXPERIMENTAL_FEATURE_NONE;
if (g_str_equal (feature_str, "scale-monitor-framebuffer"))
feature = META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
else if (g_str_equal (feature_str, "kms-modifiers"))
feature = META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
else if (g_str_equal (feature_str, "rt-scheduler"))
feature = META_EXPERIMENTAL_FEATURE_RT_SCHEDULER;
else if (g_str_equal (feature_str, "autostart-xwayland"))
feature = META_EXPERIMENTAL_FEATURE_AUTOSTART_XWAYLAND;
if (feature)
g_message ("Enabling experimental feature '%s'", feature_str);
else
g_info ("Unknown experimental feature '%s'\n", feature);
g_warning ("Unknown experimental feature '%s'", feature_str);
features |= feature;
}
if (features != settings->experimental_features)

View File

@@ -1284,10 +1284,10 @@ meta_input_device_native_class_init (MetaInputDeviceNativeClass *klass)
obj_props[PROP_DEVICE_MATRIX] =
g_param_spec_boxed ("device-matrix",
"Device input matrix",
"Device input matrix",
CAIRO_GOBJECT_TYPE_MATRIX,
CLUTTER_PARAM_READWRITE);
"Device input matrix",
"Device input matrix",
CAIRO_GOBJECT_TYPE_MATRIX,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OUTPUT_ASPECT_RATIO] =
g_param_spec_double ("output-aspect-ratio",
"Output aspect ratio",

View File

@@ -78,8 +78,8 @@ uint32_t meta_input_device_tool_native_get_button_code (Clutt
void meta_input_device_tool_native_set_pressure_curve (ClutterInputDeviceTool *tool,
double curve[4]);
void meta_input_device_tool_native_set_button_code (ClutterInputDeviceTool *tool,
uint32_t button,
uint32_t evcode);
uint32_t button,
uint32_t evcode);
G_END_DECLS

View File

@@ -470,9 +470,9 @@ meta_input_settings_native_set_tablet_keep_aspect (MetaInputSettings *settings,
backend = meta_get_backend ();
monitor_manager = meta_backend_get_monitor_manager (backend);
meta_monitor_manager_get_screen_size (monitor_manager,
&width,
&height);
meta_monitor_manager_get_screen_size (monitor_manager,
&width,
&height);
}
aspect_ratio = (double) width / height;

View File

@@ -28,11 +28,11 @@ MetaLauncher *meta_launcher_new (GError **error);
void meta_launcher_free (MetaLauncher *self);
gboolean meta_launcher_activate_session (MetaLauncher *self,
GError **error);
GError **error);
gboolean meta_launcher_activate_vt (MetaLauncher *self,
signed char vt,
GError **error);
signed char vt,
GError **error);
const char * meta_launcher_get_seat_id (MetaLauncher *launcher);

View File

@@ -275,7 +275,12 @@ update_button_count (MetaSeatNative *seat,
{
/* Handle cases where we newer saw the initial pressed event. */
if (seat->button_count[button] == 0)
return 0;
{
meta_topic (META_DEBUG_INPUT,
"Counting release of key 0x%x and count is already 0\n",
button);
return 0;
}
return --seat->button_count[button];
}
@@ -297,10 +302,14 @@ meta_seat_native_notify_key (MetaSeatNative *seat,
{
/* Drop any repeated button press (for example from virtual devices. */
int count = update_button_count (seat, key, state);
if (state && count > 1)
return;
if (!state && count != 0)
return;
if ((state && count > 1) ||
(!state && count != 0))
{
meta_topic (META_DEBUG_INPUT,
"Dropping repeated %s of key 0x%x, count %d, state %d\n",
state ? "press" : "release", key, count, state);
return;
}
}
/* We can drop the event on the floor if no stage has been
@@ -514,10 +523,14 @@ meta_seat_native_notify_button (MetaSeatNative *seat,
/* Drop any repeated button press (for example from virtual devices. */
button_count = update_button_count (seat, button, state);
if (state && button_count > 1)
return;
if (!state && button_count != 0)
return;
if ((state && button_count > 1) ||
(!state && button_count != 0))
{
meta_topic (META_DEBUG_INPUT,
"Dropping repeated %s of button 0x%x, count %d\n",
state ? "press" : "release", button, button_count);
return;
}
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
@@ -1835,12 +1848,19 @@ process_device_event (MetaSeatNative *seat,
seat_key_count =
libinput_event_keyboard_get_seat_key_count (key_event);
/* Ignore key events that are not seat wide state changes. */
if ((key_state == LIBINPUT_KEY_STATE_PRESSED &&
seat_key_count != 1) ||
(key_state == LIBINPUT_KEY_STATE_RELEASED &&
seat_key_count != 0))
break;
/* Ignore key events that are not seat wide state changes. */
if ((key_state == LIBINPUT_KEY_STATE_PRESSED &&
seat_key_count != 1) ||
(key_state == LIBINPUT_KEY_STATE_RELEASED &&
seat_key_count != 0))
{
meta_topic (META_DEBUG_INPUT,
"Dropping key-%s of key 0x%x because seat-wide "
"key count is %d\n",
key_state == LIBINPUT_KEY_STATE_PRESSED ? "press" : "release",
key, seat_key_count);
break;
}
meta_seat_native_notify_key (seat_from_device (device),
device,
@@ -1927,7 +1947,14 @@ process_device_event (MetaSeatNative *seat,
seat_button_count != 1) ||
(button_state == LIBINPUT_BUTTON_STATE_RELEASED &&
seat_button_count != 0))
break;
{
meta_topic (META_DEBUG_INPUT,
"Dropping button-%s of button 0x%x because seat-wide "
"button count is %d\n",
button_state == LIBINPUT_BUTTON_STATE_PRESSED ? "press" : "release",
button, seat_button_count);
break;
}
meta_seat_native_notify_button (seat_from_device (device), device,
time_us, button, button_state);

View File

@@ -27,6 +27,7 @@
#include "backends/native/meta-seat-native.h"
#include "backends/native/meta-virtual-input-device-native.h"
#include "clutter/clutter-mutter.h"
#include "meta/util.h"
enum
{
@@ -116,6 +117,10 @@ release_pressed_buttons (ClutterVirtualInputDevice *virtual_device)
time_us = g_get_monotonic_time ();
meta_topic (META_DEBUG_INPUT,
"Releasing pressed buttons while destroying virtual input device "
"(device %p)\n", virtual_device);
for (code = 0; code < G_N_ELEMENTS (virtual_evdev->button_count); code++)
{
if (virtual_evdev->button_count[code] == 0)
@@ -231,6 +236,11 @@ meta_virtual_input_device_native_notify_button (ClutterVirtualInputDevice *virtu
return;
}
meta_topic (META_DEBUG_INPUT,
"Emitting virtual button-%s of button 0x%x (device %p)\n",
button_state == CLUTTER_BUTTON_STATE_PRESSED ? "press" : "release",
evdev_button, virtual_device);
meta_seat_native_notify_button (virtual_evdev->seat,
virtual_evdev->device,
time_us,
@@ -261,11 +271,16 @@ meta_virtual_input_device_native_notify_key (ClutterVirtualInputDevice *virtual_
if (key_count < 0 || key_count > 1)
{
g_warning ("Received multiple virtual 0x%x key %s (ignoring)", key,
key_state == CLUTTER_KEY_STATE_PRESSED ? "presses" : "releases");
key_state == CLUTTER_KEY_STATE_PRESSED ? "presses" : "releases");
update_button_count (virtual_evdev, key, 1 - key_state);
return;
}
meta_topic (META_DEBUG_INPUT,
"Emitting virtual key-%s of key 0x%x (device %p)\n",
key_state == CLUTTER_KEY_STATE_PRESSED ? "press" : "release",
key, virtual_device);
meta_seat_native_notify_key (virtual_evdev->seat,
virtual_evdev->device,
time_us,
@@ -355,6 +370,12 @@ apply_level_modifiers (ClutterVirtualInputDevice *virtual_device,
clutter_input_device_keycode_to_evdev (virtual_evdev->device,
keycode, &evcode);
meta_topic (META_DEBUG_INPUT,
"Emitting virtual key-%s of modifier key 0x%x (device %p)\n",
key_state == CLUTTER_KEY_STATE_PRESSED ? "press" : "release",
evcode, virtual_device);
meta_seat_native_notify_key (virtual_evdev->seat,
virtual_evdev->device,
time_us,
@@ -396,12 +417,18 @@ meta_virtual_input_device_native_notify_keyval (ClutterVirtualInputDevice *virtu
key_count = update_button_count (virtual_evdev, evcode, key_state);
if (key_count < 0 || key_count > 1)
{
g_warning ("Received multiple virtual 0x%x key %s (ignoring)", keycode,
key_state == CLUTTER_KEY_STATE_PRESSED ? "presses" : "releases");
g_warning ("Received multiple virtual 0x%x key %s (ignoring)", evcode,
key_state == CLUTTER_KEY_STATE_PRESSED ? "presses" : "releases");
update_button_count (virtual_evdev, evcode, 1 - key_state);
return;
}
meta_topic (META_DEBUG_INPUT,
"Emitting virtual key-%s of key 0x%x with modifier level %d, "
"press count %d (device %p)\n",
key_state == CLUTTER_KEY_STATE_PRESSED ? "press" : "release",
evcode, level, key_count, virtual_device);
if (key_state)
apply_level_modifiers (virtual_device, time_us, level, key_state);
@@ -637,6 +664,10 @@ meta_virtual_input_device_native_constructed (GObject *object)
device_type = clutter_virtual_input_device_get_device_type (virtual_device);
meta_topic (META_DEBUG_INPUT,
"Creating new virtual input device of type %d (%p)\n",
device_type, virtual_device);
virtual_evdev->device =
meta_input_device_native_new_virtual (virtual_evdev->seat,
device_type,

View File

@@ -103,9 +103,9 @@ meta_xkb_translate_state (ClutterEvent *event,
uint32_t button_state)
{
_clutter_event_set_state_full (event,
button_state,
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE) | button_state);
button_state,
xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE) | button_state);
}

View File

@@ -631,6 +631,7 @@ meta_compositor_add_window (MetaCompositor *compositor,
window_actor = g_object_new (window_actor_type,
"meta-window", window,
"show-on-set-parent", FALSE,
NULL);
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)

View File

@@ -86,18 +86,6 @@ meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
wl_list_insert_list (&self->frame_callback_list, frame_callbacks);
}
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);
if (!surface)
return NULL;
return surface->window;
}
static void
meta_surface_actor_wayland_paint (ClutterActor *actor,
ClutterPaintContext *paint_context)
@@ -155,8 +143,6 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
surface_actor_class->is_visible = meta_surface_actor_wayland_is_visible;
surface_actor_class->is_opaque = meta_surface_actor_wayland_is_opaque;
surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
object_class->dispose = meta_surface_actor_wayland_dispose;
}

View File

@@ -300,12 +300,15 @@ sync_unredirected (MetaSurfaceActorX11 *self)
if (self->unredirected)
{
detach_pixmap (self);
XCompositeUnredirectWindow (xdisplay, xwindow, CompositeRedirectManual);
XSync (xdisplay, False);
detach_pixmap (self);
}
else
{
XCompositeRedirectWindow (xdisplay, xwindow, CompositeRedirectManual);
XSync (xdisplay, False);
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
meta_x11_error_trap_pop (display->x11_display);
@@ -345,13 +348,6 @@ meta_surface_actor_x11_dispose (GObject *object)
G_OBJECT_CLASS (meta_surface_actor_x11_parent_class)->dispose (object);
}
static MetaWindow *
meta_surface_actor_x11_get_window (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
return self->window;
}
static void
meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
{
@@ -364,8 +360,6 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
surface_actor_class->pre_paint = meta_surface_actor_x11_pre_paint;
surface_actor_class->is_visible = meta_surface_actor_x11_is_visible;
surface_actor_class->is_opaque = meta_surface_actor_x11_is_opaque;
surface_actor_class->get_window = meta_surface_actor_x11_get_window;
}
static void

View File

@@ -567,12 +567,6 @@ meta_surface_actor_is_frozen (MetaSurfaceActor *self)
return priv->frozen;
}
MetaWindow *
meta_surface_actor_get_window (MetaSurfaceActor *self)
{
return META_SURFACE_ACTOR_GET_CLASS (self)->get_window (self);
}
void
meta_surface_actor_set_transform (MetaSurfaceActor *self,
MetaMonitorTransform transform)

View File

@@ -27,15 +27,12 @@ struct _MetaSurfaceActorClass
void (* pre_paint) (MetaSurfaceActor *actor);
gboolean (* is_visible) (MetaSurfaceActor *actor);
gboolean (* is_opaque) (MetaSurfaceActor *actor);
MetaWindow *(* get_window) (MetaSurfaceActor *actor);
};
cairo_surface_t *meta_surface_actor_get_image (MetaSurfaceActor *self,
cairo_rectangle_int_t *clip);
MetaShapedTexture *meta_surface_actor_get_texture (MetaSurfaceActor *self);
MetaWindow *meta_surface_actor_get_window (MetaSurfaceActor *self);
gboolean meta_surface_actor_is_obscured (MetaSurfaceActor *self);

View File

@@ -91,17 +91,6 @@ meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor)
actor);
}
MetaWindowActor *
meta_window_actor_wayland_from_surface (MetaWaylandSurface *surface)
{
if (surface->window)
return meta_window_actor_from_window (surface->window);
else if (surface->sub.parent)
return meta_window_actor_wayland_from_surface (surface->sub.parent);
else
return NULL;
}
static void
meta_window_actor_wayland_assign_surface_actor (MetaWindowActor *actor,
MetaSurfaceActor *surface_actor)

View File

@@ -33,6 +33,5 @@ G_DECLARE_FINAL_TYPE (MetaWindowActorWayland,
MetaWindowActor)
void meta_window_actor_wayland_rebuild_surface_tree (MetaWindowActor *actor);
MetaWindowActor * meta_window_actor_wayland_from_surface (MetaWaylandSurface *surface);
#endif /*META_WINDOW_ACTOR_WAYLAND_H */

View File

@@ -1138,7 +1138,10 @@ handle_updates (MetaWindowActorX11 *actor_x11)
* which causes the shadows to look bad.
*/
if (surface && meta_window_x11_always_update_shape (window))
update_shape_region (actor_x11);
{
update_opaque_region (actor_x11);
update_shape_region (actor_x11);
}
return;
}

View File

@@ -2061,20 +2061,43 @@ meta_display_ping_timeout (gpointer data)
*/
void
meta_display_ping_window (MetaWindow *window,
guint32 serial)
guint32 serial)
{
GSList *l;
MetaDisplay *display = window->display;
MetaPingData *ping_data;
if (serial == 0)
{
meta_warning ("Tried to ping a window with a bad serial! Not allowed.\n");
meta_warning ("Tried to ping window %s with a bad serial! Not allowed.\n",
window->desc);
return;
}
if (!meta_window_can_ping (window))
return;
for (l = display->pending_pings; l; l = l->next)
{
MetaPingData *ping_data = l->data;
if (window == ping_data->window)
{
meta_topic (META_DEBUG_PING,
"Window %s already is being pinged with serial %u\n",
window->desc, ping_data->serial);
return;
}
if (serial == ping_data->serial)
{
meta_warning ("Ping serial %u was reused for window %s, "
"previous use was for window %s.\n",
serial, window->desc, ping_data->window->desc);
return;
}
}
ping_data = g_new (MetaPingData, 1);
ping_data->window = window;
ping_data->serial = serial;

View File

@@ -335,6 +335,8 @@ topic_name (MetaDebugTopic topic)
return "EDGE_RESISTANCE";
case META_DEBUG_DBUS:
return "DBUS";
case META_DEBUG_INPUT:
return "INPUT";
case META_DEBUG_VERBOSE:
return "VERBOSE";
}

View File

@@ -223,6 +223,7 @@ enum
WORKSPACE_CHANGED,
FOCUS,
RAISED,
UNMANAGING,
UNMANAGED,
SIZE_CHANGED,
POSITION_CHANGED,
@@ -649,6 +650,14 @@ meta_window_class_init (MetaWindowClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
window_signals[UNMANAGING] =
g_signal_new ("unmanaging",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
window_signals[UNMANAGED] =
g_signal_new ("unmanaged",
G_TYPE_FROM_CLASS (object_class),
@@ -1435,17 +1444,9 @@ meta_window_unmanage (MetaWindow *window,
g_clear_handle_id (&window->unmanage_idle_id, g_source_remove);
meta_window_free_delete_dialog (window);
g_signal_emit (window, window_signals[UNMANAGING], 0);
#ifdef HAVE_WAYLAND
/* This needs to happen for both Wayland and XWayland clients,
* so it can't be in MetaWindowWayland. */
if (window->surface)
{
meta_wayland_surface_set_window (window->surface, NULL);
window->surface = NULL;
}
#endif
meta_window_free_delete_dialog (window);
if (window->visible_to_compositor)
{
@@ -3750,8 +3751,6 @@ meta_window_activate_full (MetaWindow *window,
meta_window_focus (window, timestamp);
else
meta_workspace_activate_with_focus (window->workspace, window, timestamp);
meta_window_check_alive (window, timestamp);
}
/* This function exists since most of the functionality in window_activate
@@ -4772,6 +4771,8 @@ meta_window_focus (MetaWindow *window,
return;
}
meta_window_check_alive (window, timestamp);
META_WINDOW_GET_CLASS (window)->focus (window, timestamp);
if (window->display->event_route == META_EVENT_ROUTE_NORMAL)

View File

@@ -584,6 +584,8 @@ if have_wayland
'wayland/meta-xwayland-private.h',
'wayland/meta-xwayland-dnd.c',
'wayland/meta-xwayland-dnd-private.h',
'wayland/meta-xwayland-surface.c',
'wayland/meta-xwayland-surface.h',
]
endif

View File

@@ -111,7 +111,8 @@ typedef enum
META_DEBUG_SHAPES = 1 << 19,
META_DEBUG_COMPOSITOR = 1 << 20,
META_DEBUG_EDGE_RESISTANCE = 1 << 21,
META_DEBUG_DBUS = 1 << 22
META_DEBUG_DBUS = 1 << 22,
META_DEBUG_INPUT = 1 << 23
} MetaDebugTopic;
META_EXPORT

View File

@@ -696,6 +696,7 @@ meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint)
GObject *object;
MetaPointerConfinementWayland *confinement;
MetaWaylandSurface *surface;
MetaWindow *window;
object = g_object_new (META_TYPE_POINTER_CONFINEMENT_WAYLAND, NULL);
confinement = META_POINTER_CONFINEMENT_WAYLAND (object);
@@ -708,9 +709,11 @@ meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint)
G_CALLBACK (surface_geometry_changed),
confinement,
0);
if (surface->window)
window = meta_wayland_surface_get_window (surface);
if (window)
{
g_signal_connect_object (surface->window,
g_signal_connect_object (window,
"position-changed",
G_CALLBACK (window_position_changed),
confinement,

View File

@@ -150,6 +150,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
MetaShapedTexture *stex;
MetaWaylandBuffer *buffer;
cairo_rectangle_int_t surface_rect;
MetaWindow *window;
MetaWaylandSurface *subsurface_surface;
surface_actor = priv->actor;
@@ -194,8 +195,9 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor
meta_surface_actor_set_input_region (surface_actor, NULL);
}
if (surface->window &&
surface->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
window = meta_wayland_surface_get_window (surface);
if (window &&
window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
if (surface->opaque_region)
{
@@ -323,6 +325,23 @@ meta_wayland_actor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *surfac
return is_on_monitor;
}
static void
meta_wayland_actor_surface_get_relative_coordinates (MetaWaylandSurfaceRole *surface_role,
float abs_x,
float abs_y,
float *out_sx,
float *out_sy)
{
MetaWaylandActorSurface *actor_surface =
META_WAYLAND_ACTOR_SURFACE (surface_role);
MetaWaylandActorSurfacePrivate *priv =
meta_wayland_actor_surface_get_instance_private (actor_surface);
clutter_actor_transform_stage_point (CLUTTER_ACTOR (priv->actor),
abs_x, abs_y,
out_sx, out_sy);
}
static void
meta_wayland_actor_surface_init (MetaWaylandActorSurface *actor_surface)
{
@@ -346,6 +365,8 @@ meta_wayland_actor_surface_class_init (MetaWaylandActorSurfaceClass *klass)
surface_role_class->apply_state = meta_wayland_actor_surface_apply_state;
surface_role_class->is_on_logical_monitor =
meta_wayland_actor_surface_is_on_logical_monitor;
surface_role_class->get_relative_coordinates =
meta_wayland_actor_surface_get_relative_coordinates;
klass->sync_actor_state = meta_wayland_actor_surface_real_sync_actor_state;
}

View File

@@ -83,7 +83,7 @@ gtk_surface_set_dbus_properties (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -104,7 +104,7 @@ gtk_surface_set_modal (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -123,7 +123,7 @@ gtk_surface_unset_modal (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -143,7 +143,7 @@ gtk_surface_present (struct wl_client *client,
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -162,7 +162,7 @@ gtk_surface_request_focus (struct wl_client *client,
MetaStartupSequence *sequence = NULL;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -313,11 +313,14 @@ static void
on_configure (MetaWaylandSurface *surface,
MetaWaylandGtkSurface *gtk_surface)
{
send_configure (gtk_surface, surface->window);
MetaWindow *window;
window = meta_wayland_surface_get_window (surface);
send_configure (gtk_surface, window);
if (wl_resource_get_version (gtk_surface->resource) >= GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION)
send_configure_edges (gtk_surface, surface->window);
if (wl_resource_get_version (gtk_surface->resource) >=
GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION)
send_configure_edges (gtk_surface, window);
}
static void
@@ -387,11 +390,13 @@ gtk_shell_system_bell (struct wl_client *client,
MetaWaylandGtkSurface *gtk_surface =
wl_resource_get_user_data (gtk_surface_resource);
MetaWaylandSurface *surface = gtk_surface->surface;
MetaWindow *window;
if (!surface->window)
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
meta_bell_notify (display, surface->window);
meta_bell_notify (display, window);
}
else
{

View File

@@ -189,7 +189,7 @@ zxdg_toplevel_v6_set_parent (struct wl_client *client,
MetaWindow *transient_for = NULL;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -198,7 +198,7 @@ zxdg_toplevel_v6_set_parent (struct wl_client *client,
MetaWaylandSurface *parent_surface =
surface_from_xdg_surface_resource (parent_resource);
transient_for = parent_surface->window;
transient_for = meta_wayland_surface_get_window (parent_surface);
}
meta_window_set_transient_for (window, transient_for);
@@ -212,7 +212,7 @@ zxdg_toplevel_v6_set_title (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -230,7 +230,7 @@ zxdg_toplevel_v6_set_app_id (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -253,7 +253,7 @@ zxdg_toplevel_v6_show_window_menu (struct wl_client *client,
MetaWindow *window;
int monitor_scale;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -277,7 +277,7 @@ zxdg_toplevel_v6_move (struct wl_client *client,
MetaWindow *window;
gfloat x, y;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -323,7 +323,7 @@ zxdg_toplevel_v6_resize (struct wl_client *client,
gfloat x, y;
MetaGrabOp grab_op;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -344,7 +344,7 @@ zxdg_toplevel_v6_set_max_size (struct wl_client *client,
MetaWaylandSurfaceState *pending;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -373,7 +373,7 @@ zxdg_toplevel_v6_set_min_size (struct wl_client *client,
MetaWaylandSurfaceState *pending;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -399,7 +399,7 @@ zxdg_toplevel_v6_set_maximized (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -417,7 +417,7 @@ zxdg_toplevel_v6_unset_maximized (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -432,7 +432,7 @@ zxdg_toplevel_v6_set_fullscreen (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -453,7 +453,7 @@ zxdg_toplevel_v6_unset_fullscreen (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -467,7 +467,7 @@ zxdg_toplevel_v6_set_minimized (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -600,10 +600,13 @@ meta_wayland_zxdg_toplevel_v6_send_configure (MetaWaylandZxdgToplevelV6 *xd
META_WAYLAND_SURFACE_ROLE (xdg_toplevel);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window;
struct wl_array states;
window = meta_wayland_surface_get_window (surface);
wl_array_init (&states);
fill_states (&states, surface->window);
fill_states (&states, window);
zxdg_toplevel_v6_send_configure (xdg_toplevel->resource,
configuration->width,
@@ -662,7 +665,7 @@ meta_wayland_zxdg_toplevel_v6_apply_state (MetaWaylandSurfaceRole *surface_role
MetaRectangle old_geometry;
gboolean geometry_changed;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
{
meta_wayland_surface_cache_pending_frame_callbacks (surface, pending);
@@ -845,9 +848,11 @@ static void
scale_placement_rule (MetaPlacementRule *placement_rule,
MetaWaylandSurface *surface)
{
MetaWindow *window;
int geometry_scale;
geometry_scale = meta_window_wayland_get_geometry_scale (surface->window);
window = meta_wayland_surface_get_window (surface);
geometry_scale = meta_window_wayland_get_geometry_scale (window);
placement_rule->anchor_rect.x *= geometry_scale;
placement_rule->anchor_rect.y *= geometry_scale;
@@ -885,7 +890,7 @@ finish_popup_setup (MetaWaylandZxdgPopupV6 *xdg_popup)
xdg_popup->setup.parent_surface = NULL;
xdg_popup->setup.grab_seat = NULL;
if (!parent_surface->window)
if (!meta_wayland_surface_get_window (parent_surface))
{
zxdg_popup_v6_send_popup_done (xdg_popup->resource);
return;
@@ -964,6 +969,7 @@ meta_wayland_zxdg_popup_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window;
if (xdg_popup->setup.parent_surface)
finish_popup_setup (xdg_popup);
@@ -973,7 +979,8 @@ meta_wayland_zxdg_popup_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
surface_role_class->apply_state (surface_role, pending);
/* If the window disappeared the surface is not coming back. */
if (!surface->window)
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
if (!pending->newly_attached)
@@ -988,7 +995,7 @@ meta_wayland_zxdg_popup_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
window_geometry =
meta_wayland_zxdg_surface_v6_get_window_geometry (xdg_surface);
meta_window_wayland_finish_move_resize (surface->window,
meta_window_wayland_finish_move_resize (window,
window_geometry,
pending);
}
@@ -1013,7 +1020,8 @@ meta_wayland_zxdg_popup_v6_configure (MetaWaylandShellSurface *shell_surf
META_WAYLAND_ZXDG_POPUP_V6 (shell_surface);
MetaWaylandZxdgSurfaceV6 *xdg_surface =
META_WAYLAND_ZXDG_SURFACE_V6 (xdg_popup);
MetaWindow *parent_window = xdg_popup->parent_surface->window;
MetaWindow *parent_window =
meta_wayland_surface_get_window (xdg_popup->parent_surface);
int geometry_scale;
int x, y;
@@ -1048,7 +1056,8 @@ meta_wayland_zxdg_popup_v6_managed (MetaWaylandShellSurface *shell_surface,
g_assert (parent);
meta_window_set_transient_for (window, parent->window);
meta_window_set_transient_for (window,
meta_wayland_surface_get_window (parent));
meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
}
@@ -1328,7 +1337,7 @@ meta_wayland_zxdg_surface_v6_apply_state (MetaWaylandSurfaceRole *surface_role,
meta_wayland_zxdg_surface_v6_get_instance_private (xdg_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
MetaWaylandSurfaceRoleClass *surface_role_class;
surface_role_class =

View File

@@ -164,25 +164,29 @@ window_associated (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfacePointerConstraintsData *data)
{
MetaWaylandSurface *surface = data->surface;
MetaWindow *window;
connect_window (data, surface->window);
window = meta_wayland_surface_get_window (surface);
connect_window (data, window);
g_clear_signal_handler (&data->window_associated_handler_id, surface);
meta_wayland_pointer_constraint_maybe_enable_for_window (surface->window);
meta_wayland_pointer_constraint_maybe_enable_for_window (window);
}
static MetaWaylandSurfacePointerConstraintsData *
surface_constraint_data_new (MetaWaylandSurface *surface)
{
MetaWaylandSurfacePointerConstraintsData *data;
MetaWindow *window;
data = g_new0 (MetaWaylandSurfacePointerConstraintsData, 1);
data->surface = surface;
if (surface->window)
window = meta_wayland_surface_get_window (surface);
if (window)
{
connect_window (data, surface->window);
connect_window (data, window);
}
else if (meta_xwayland_is_xwayland_surface (surface))
{
@@ -280,8 +284,9 @@ static void
pointer_focus_surface_changed (MetaWaylandPointer *pointer,
MetaWaylandPointerConstraint *constraint)
{
MetaWindow *window = constraint->surface->window;
MetaWindow *window;
window = meta_wayland_surface_get_window (constraint->surface);
if (window)
{
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
@@ -453,7 +458,7 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
{
MetaWindow *window;
window = constraint->surface->window;
window = meta_wayland_surface_get_window (constraint->surface);
if (!window)
{
/*
@@ -494,8 +499,6 @@ should_constraint_be_enabled (MetaWaylandPointerConstraint *constraint)
}
else
{
MetaWindow *window = constraint->surface->window;
if (!meta_window_appears_focused (window))
return FALSE;
}
@@ -610,7 +613,7 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo
if (constraint->region)
cairo_region_intersect (region, constraint->region);
window = constraint->surface->window;
window = meta_wayland_surface_get_window (constraint->surface);
if (window && window->frame)
{
MetaFrame *frame = window->frame;

View File

@@ -927,6 +927,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
{
struct wl_client *client = wl_resource_get_client (surface->resource);
graphene_point_t pos;
MetaWindow *focus_window;
pointer->focus_surface = surface;
@@ -937,8 +938,9 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
clutter_input_device_get_coords (pointer->device, NULL, &pos);
if (pointer->focus_surface->window)
meta_window_handle_enter (pointer->focus_surface->window,
focus_window = meta_wayland_surface_get_window (pointer->focus_surface);
if (focus_window)
meta_window_handle_enter (focus_window,
/* XXX -- can we reliably get a timestamp for setting focus? */
clutter_get_current_event_time (),
pos.x, pos.y);

View File

@@ -186,7 +186,7 @@ meta_wayland_popup_grab_begin (MetaWaylandPopupGrab *grab,
MetaWaylandSurface *surface)
{
MetaWaylandPointer *pointer = grab->generic.pointer;
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
meta_wayland_pointer_start_grab (pointer, (MetaWaylandPointerGrab*)grab);
meta_display_begin_grab_op (window->display,

View File

@@ -24,15 +24,26 @@
#include "wayland/meta-wayland-shell-surface.h"
#include "compositor/meta-surface-actor-wayland.h"
#include "compositor/meta-window-actor-private.h"
#include "compositor/meta-window-actor-wayland.h"
#include "wayland/meta-wayland-actor-surface.h"
#include "wayland/meta-wayland-buffer.h"
#include "wayland/meta-wayland-subsurface.h"
#include "wayland/meta-wayland-surface.h"
#include "wayland/meta-window-wayland.h"
G_DEFINE_ABSTRACT_TYPE (MetaWaylandShellSurface,
meta_wayland_shell_surface,
META_TYPE_WAYLAND_ACTOR_SURFACE)
typedef struct _MetaWaylandShellSurfacePrivate
{
MetaWindow *window;
gulong unmanaging_handler_id;
gulong position_changed_handler_id;
gulong effects_completed_handler_id;
} MetaWaylandShellSurfacePrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaWaylandShellSurface,
meta_wayland_shell_surface,
META_TYPE_WAYLAND_ACTOR_SURFACE)
void
meta_wayland_shell_surface_calculate_geometry (MetaWaylandShellSurface *shell_surface,
@@ -80,16 +91,93 @@ meta_wayland_shell_surface_determine_geometry (MetaWaylandShellSurface *shell_su
*out_geometry = intersected_geometry;
}
void
meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
MetaWindow *window)
static void
clear_window (MetaWaylandShellSurface *shell_surface)
{
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (shell_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaSurfaceActor *surface_actor;
if (!priv->window)
return;
g_clear_signal_handler (&priv->unmanaging_handler_id,
priv->window);
g_clear_signal_handler (&priv->position_changed_handler_id,
priv->window);
g_clear_signal_handler (&priv->effects_completed_handler_id,
meta_window_actor_from_window (priv->window));
priv->window = NULL;
surface_actor = meta_wayland_surface_get_actor (surface);
if (surface_actor)
clutter_actor_set_reactive (CLUTTER_ACTOR (surface_actor), FALSE);
meta_wayland_surface_notify_unmapped (surface);
}
static void
window_unmanaging (MetaWindow *window,
MetaWaylandShellSurface *shell_surface)
{
clear_window (shell_surface);
}
static void
window_position_changed (MetaWindow *window,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
}
static void
window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
meta_wayland_compositor_repick (surface->compositor);
}
void
meta_wayland_shell_surface_set_window (MetaWaylandShellSurface *shell_surface,
MetaWindow *window)
{
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (shell_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaSurfaceActor *surface_actor;
g_assert (!priv->window);
priv->window = window;
surface_actor = meta_wayland_surface_get_actor (surface);
if (surface_actor)
clutter_actor_set_reactive (CLUTTER_ACTOR (surface_actor), TRUE);
priv->unmanaging_handler_id =
g_signal_connect (window,
"unmanaging",
G_CALLBACK (window_unmanaging),
shell_surface);
priv->position_changed_handler_id =
g_signal_connect (window,
"position-changed",
G_CALLBACK (window_position_changed),
surface);
priv->effects_completed_handler_id =
g_signal_connect (meta_window_actor_from_window (window),
"effects-completed",
G_CALLBACK (window_actor_effects_completed),
surface);
meta_wayland_surface_set_window (surface, window);
meta_window_update_monitor (window, META_WINDOW_UPDATE_MONITOR_FLAGS_NONE);
}
@@ -132,10 +220,44 @@ meta_wayland_shell_surface_managed (MetaWaylandShellSurface *shell_surface,
shell_surface_class->managed (shell_surface, window);
}
static void
meta_wayland_shell_surface_assigned (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_shell_surface_parent_class);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
surface->dnd.funcs = meta_wayland_data_device_get_drag_dest_funcs ();
surface_role_class->assigned (surface_role);
}
static void
meta_wayland_shell_surface_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandShellSurface *shell_surface =
META_WAYLAND_SHELL_SURFACE (surface_role);
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
if (pending->newly_attached &&
!surface->buffer_ref.buffer &&
priv->window)
meta_window_queue (priv->window, META_QUEUE_CALC_SHOWING);
}
static void
meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandShellSurface *shell_surface =
META_WAYLAND_SHELL_SURFACE (surface_role);
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
MetaWaylandActorSurface *actor_surface =
META_WAYLAND_ACTOR_SURFACE (surface_role);
MetaWaylandSurface *surface =
@@ -153,7 +275,7 @@ meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface
if (!buffer)
return;
window = surface->window;
window = priv->window;
if (!window)
return;
@@ -165,6 +287,35 @@ meta_wayland_shell_surface_surface_apply_state (MetaWaylandSurfaceRole *surface
meta_wayland_surface_get_height (surface) * geometry_scale;
}
static MetaWindow *
meta_wayland_shell_surface_get_window (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandShellSurface *shell_surface =
META_WAYLAND_SHELL_SURFACE (surface_role);
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
return priv->window;
}
static void
meta_wayland_shell_surface_notify_subsurface_state_changed (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandShellSurface *shell_surface =
META_WAYLAND_SHELL_SURFACE (surface_role);
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
MetaWindow *window;
MetaWindowActor *window_actor;
window = priv->window;
if (!window)
return;
window_actor = meta_window_actor_from_window (window);
meta_window_actor_wayland_rebuild_surface_tree (window_actor);
}
static double
meta_wayland_shell_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
{
@@ -190,32 +341,32 @@ meta_wayland_shell_surface_sync_actor_state (MetaWaylandActorSurface *actor_surf
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_shell_surface_parent_class);
MetaWaylandSurface *toplevel_surface;
MetaWindow *toplevel_window;
toplevel_surface = meta_wayland_surface_get_toplevel (surface);
if (toplevel_surface && toplevel_surface->window)
actor_surface_class->sync_actor_state (actor_surface);
toplevel_window = meta_wayland_surface_get_toplevel_window (surface);
if (!toplevel_window)
return;
actor_surface_class->sync_actor_state (actor_surface);
}
void
meta_wayland_shell_surface_destroy_window (MetaWaylandShellSurface *shell_surface)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (shell_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandShellSurfacePrivate *priv =
meta_wayland_shell_surface_get_instance_private (shell_surface);
MetaWindow *window;
MetaDisplay *display;
uint32_t timestamp;
window = surface->window;
window = priv->window;
if (!window)
return;
display = meta_window_get_display (window);
timestamp = meta_display_get_current_time_roundtrip (display);
meta_window_unmanage (surface->window, timestamp);
g_assert (!surface->window);
meta_window_unmanage (window, timestamp);
g_assert (!priv->window);
}
static void
@@ -244,8 +395,14 @@ meta_wayland_shell_surface_class_init (MetaWaylandShellSurfaceClass *klass)
object_class->finalize = meta_wayland_shell_surface_finalize;
surface_role_class->assigned = meta_wayland_shell_surface_assigned;
surface_role_class->pre_apply_state =
meta_wayland_shell_surface_surface_pre_apply_state;
surface_role_class->apply_state =
meta_wayland_shell_surface_surface_apply_state;
surface_role_class->notify_subsurface_state_changed =
meta_wayland_shell_surface_notify_subsurface_state_changed;
surface_role_class->get_window = meta_wayland_shell_surface_get_window;
actor_surface_class->get_geometry_scale =
meta_wayland_shell_surface_get_geometry_scale;

View File

@@ -139,7 +139,6 @@ meta_wayland_subsurface_parent_state_applied (MetaWaylandSubsurface *subsurface)
{
GSList *it;
MetaWaylandSurface *parent;
MetaWindowActor *window_actor;
parent = surface->sub.parent;
@@ -184,9 +183,7 @@ meta_wayland_subsurface_parent_state_applied (MetaWaylandSubsurface *subsurface)
g_slist_free (surface->sub.pending_placement_ops);
surface->sub.pending_placement_ops = NULL;
window_actor = meta_window_actor_wayland_from_surface (surface);
if (window_actor)
meta_window_actor_wayland_rebuild_surface_tree (window_actor);
meta_wayland_surface_notify_subsurface_state_changed (parent);
}
if (is_surface_effectively_synchronized (surface))
@@ -228,6 +225,19 @@ meta_wayland_subsurface_union_geometry (MetaWaylandSubsurface *subsurface,
}
}
static void
meta_wayland_subsurface_assigned (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_wayland_subsurface_parent_class);
surface->dnd.funcs = meta_wayland_data_device_get_drag_dest_funcs ();
surface_role_class->assigned (surface_role);
}
static MetaWaylandSurface *
meta_wayland_subsurface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
@@ -258,6 +268,16 @@ meta_wayland_subsurface_should_cache_state (MetaWaylandSurfaceRole *surface_role
return TRUE;
}
static void
meta_wayland_subsurface_notify_subsurface_state_changed (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurface *parent = surface->sub.parent;
return meta_wayland_surface_notify_subsurface_state_changed (parent);
}
static double
meta_wayland_subsurface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
{
@@ -292,7 +312,7 @@ meta_wayland_subsurface_sync_actor_state (MetaWaylandActorSurface *actor_surface
MetaWaylandSurface *toplevel_surface;
toplevel_surface = meta_wayland_surface_get_toplevel (surface);
if (toplevel_surface && toplevel_surface->window)
if (toplevel_surface && meta_wayland_surface_get_window (toplevel_surface))
actor_surface_class->sync_actor_state (actor_surface);
sync_actor_subsurface_state (surface);
@@ -311,8 +331,11 @@ meta_wayland_subsurface_class_init (MetaWaylandSubsurfaceClass *klass)
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
surface_role_class->assigned = meta_wayland_subsurface_assigned;
surface_role_class->get_toplevel = meta_wayland_subsurface_get_toplevel;
surface_role_class->should_cache_state = meta_wayland_subsurface_should_cache_state;
surface_role_class->notify_subsurface_state_changed =
meta_wayland_subsurface_notify_subsurface_state_changed;
actor_surface_class->get_geometry_scale =
meta_wayland_subsurface_get_geometry_scale;
@@ -519,7 +542,6 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandSurface *parent = wl_resource_get_user_data (parent_resource);
MetaWindow *toplevel_window;
MetaWindowActor *window_actor;
if (surface->wl_subsurface)
{
@@ -564,9 +586,7 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
g_node_append (parent->subsurface_branch_node,
surface->subsurface_branch_node);
window_actor = meta_window_actor_wayland_from_surface (surface);
if (window_actor)
meta_window_actor_wayland_rebuild_surface_tree (window_actor);
meta_wayland_surface_notify_subsurface_state_changed (parent);
}
static const struct wl_subcompositor_interface meta_wayland_subcompositor_interface = {

View File

@@ -120,13 +120,6 @@ meta_wayland_surface_role_is_on_logical_monitor (MetaWaylandSurfaceRole *surface
static MetaWaylandSurface *
meta_wayland_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role);
static void
window_position_changed (MetaWindow *window,
MetaWaylandSurface *surface);
static void
window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface);
static void
role_assignment_valist_to_properties (GType role_type,
const char *first_property_name,
@@ -633,9 +626,6 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
if (state->newly_attached)
{
if (!surface->buffer_ref.buffer && surface->window)
meta_window_queue (surface->window, META_QUEUE_CALC_SHOWING);
/* Always release any previously held buffer. If the buffer held is same
* as the newly attached buffer, we still need to release it here, because
* wl_surface.attach+commit and wl_buffer.release on the attached buffer
@@ -1125,16 +1115,6 @@ static const struct wl_surface_interface meta_wayland_wl_surface_interface = {
wl_surface_damage_buffer,
};
static void
sync_drag_dest_funcs (MetaWaylandSurface *surface)
{
if (surface->window &&
surface->window->client_type == META_WINDOW_CLIENT_TYPE_X11)
surface->dnd.funcs = meta_xwayland_selection_get_drag_dest_funcs ();
else
surface->dnd.funcs = meta_wayland_data_device_get_drag_dest_funcs ();
}
static void
surface_entered_output (MetaWaylandSurface *surface,
MetaWaylandOutput *wayland_output)
@@ -1254,7 +1234,7 @@ meta_wayland_surface_update_outputs (MetaWaylandSurface *surface)
surface);
}
static void
void
meta_wayland_surface_update_outputs_recursively (MetaWaylandSurface *surface)
{
MetaWaylandSurface *subsurface_surface;
@@ -1266,47 +1246,9 @@ meta_wayland_surface_update_outputs_recursively (MetaWaylandSurface *surface)
}
void
meta_wayland_surface_set_window (MetaWaylandSurface *surface,
MetaWindow *window)
meta_wayland_surface_notify_unmapped (MetaWaylandSurface *surface)
{
gboolean was_unmapped = surface->window && !window;
ClutterActor *actor;
if (surface->window == window)
return;
if (surface->window)
{
g_signal_handlers_disconnect_by_func (surface->window,
window_position_changed,
surface);
g_signal_handlers_disconnect_by_func (meta_window_actor_from_window (surface->window),
window_actor_effects_completed,
surface);
}
surface->window = window;
actor = CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
if (actor)
clutter_actor_set_reactive (actor, !!window);
sync_drag_dest_funcs (surface);
if (was_unmapped)
g_signal_emit (surface, surface_signals[SURFACE_UNMAPPED], 0);
if (window)
{
g_signal_connect_object (window,
"position-changed",
G_CALLBACK (window_position_changed),
surface, 0);
g_signal_connect_object (meta_window_actor_from_window (window),
"effects-completed",
G_CALLBACK (window_actor_effects_completed),
surface, 0);
}
g_signal_emit (surface, surface_signals[SURFACE_UNMAPPED], 0);
}
static void
@@ -1378,21 +1320,6 @@ wl_surface_destructor (struct wl_resource *resource)
meta_wayland_compositor_repick (compositor);
}
static void
window_position_changed (MetaWindow *window,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
}
static void
window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
meta_wayland_compositor_repick (surface->compositor);
}
MetaWaylandSurface *
meta_wayland_surface_create (MetaWaylandCompositor *compositor,
struct wl_client *client,
@@ -1417,8 +1344,6 @@ meta_wayland_surface_create (MetaWaylandCompositor *compositor,
wl_list_init (&surface->pending_frame_callback_list);
sync_drag_dest_funcs (surface);
surface->outputs_to_destroy_notify_id = g_hash_table_new (NULL, NULL);
surface->shortcut_inhibited_seats = g_hash_table_new (NULL, NULL);
@@ -1434,7 +1359,7 @@ meta_wayland_surface_begin_grab_op (MetaWaylandSurface *surface,
gfloat x,
gfloat y)
{
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
if (grab_op == META_GRAB_OP_NONE)
return FALSE;
@@ -1574,7 +1499,7 @@ meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface)
toplevel = meta_wayland_surface_get_toplevel (surface);
if (toplevel)
return toplevel->window;
return meta_wayland_surface_get_window (toplevel);
else
return NULL;
}
@@ -1586,30 +1511,12 @@ meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
float *sx,
float *sy)
{
/* Using clutter API to transform coordinates is only accurate right
* after a clutter layout pass but this function is used e.g. to
* deliver pointer motion events which can happen at any time. This
* isn't a problem for wayland clients since they don't control
* their position, but X clients do and we'd be sending outdated
* coordinates if a client is moving a window in response to motion
* events.
*/
if (surface->window &&
surface->window->client_type == META_WINDOW_CLIENT_TYPE_X11)
{
MetaRectangle window_rect;
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface->role);
meta_window_get_buffer_rect (surface->window, &window_rect);
*sx = abs_x - window_rect.x;
*sy = abs_y - window_rect.y;
}
else
{
ClutterActor *actor =
CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
clutter_actor_transform_stage_point (actor, abs_x, abs_y, sx, sy);
}
surface_role_class->get_relative_coordinates (surface->role,
abs_x, abs_y,
sx, sy);
}
void
@@ -1822,6 +1729,25 @@ meta_wayland_surface_role_get_toplevel (MetaWaylandSurfaceRole *surface_role)
return NULL;
}
static MetaWindow *
meta_wayland_surface_role_get_window (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurfaceRoleClass *klass;
klass = META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role);
if (klass->get_window)
return klass->get_window (surface_role);
else
return NULL;
}
MetaWindow *
meta_wayland_surface_get_window (MetaWaylandSurface *surface)
{
return meta_wayland_surface_role_get_window (surface->role);
}
static gboolean
meta_wayland_surface_role_should_cache_state (MetaWaylandSurfaceRole *surface_role)
{
@@ -1843,6 +1769,24 @@ meta_wayland_surface_should_cache_state (MetaWaylandSurface *surface)
return meta_wayland_surface_role_should_cache_state (surface->role);
}
static void
meta_wayland_surface_role_notify_subsurface_state_changed (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurfaceRoleClass *klass;
klass = META_WAYLAND_SURFACE_ROLE_GET_CLASS (surface_role);
g_return_if_fail (klass->notify_subsurface_state_changed);
klass->notify_subsurface_state_changed (surface_role);
}
void
meta_wayland_surface_notify_subsurface_state_changed (MetaWaylandSurface *surface)
{
if (surface->role)
meta_wayland_surface_role_notify_subsurface_state_changed (surface->role);
}
MetaWaylandSurface *
meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role)
{

View File

@@ -62,6 +62,13 @@ struct _MetaWaylandSurfaceRoleClass
MetaLogicalMonitor *logical_monitor);
MetaWaylandSurface * (*get_toplevel) (MetaWaylandSurfaceRole *surface_role);
gboolean (*should_cache_state) (MetaWaylandSurfaceRole *surface_role);
void (*notify_subsurface_state_changed) (MetaWaylandSurfaceRole *surface_role);
void (*get_relative_coordinates) (MetaWaylandSurfaceRole *surface_role,
float abs_x,
float abs_y,
float *out_sx,
float *out_sy);
MetaWindow * (*get_window) (MetaWaylandSurfaceRole *surface_role);
};
struct _MetaWaylandSurfaceState
@@ -137,7 +144,6 @@ struct _MetaWaylandSurface
struct wl_resource *resource;
MetaWaylandCompositor *compositor;
MetaWaylandSurfaceRole *role;
MetaWindow *window;
cairo_region_t *input_region;
cairo_region_t *opaque_region;
int scale;
@@ -272,6 +278,8 @@ void meta_wayland_surface_update_outputs (MetaWaylandSurface *sur
MetaWaylandSurface *meta_wayland_surface_get_toplevel (MetaWaylandSurface *surface);
MetaWindow * meta_wayland_surface_get_window (MetaWaylandSurface *surface);
gboolean meta_wayland_surface_should_cache_state (MetaWaylandSurface *surface);
MetaWindow * meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface);
@@ -325,6 +333,12 @@ MetaSurfaceActor * meta_wayland_surface_get_actor (MetaWaylandSurface *surface)
void meta_wayland_surface_notify_geometry_changed (MetaWaylandSurface *surface);
void meta_wayland_surface_notify_subsurface_state_changed (MetaWaylandSurface *surface);
void meta_wayland_surface_notify_unmapped (MetaWaylandSurface *surface);
void meta_wayland_surface_update_outputs_recursively (MetaWaylandSurface *surface);
int meta_wayland_surface_get_width (MetaWaylandSurface *surface);
int meta_wayland_surface_get_height (MetaWaylandSurface *surface);

View File

@@ -224,10 +224,12 @@ wl_shell_surface_set_state (MetaWaylandSurface *surface,
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface->role);
MetaWlShellSurfaceState old_state = wl_shell_surface->state;
MetaWindow *window;
wl_shell_surface->state = state;
if (surface->window && old_state != state)
window = meta_wayland_surface_get_window (surface);
if (window && old_state != state)
{
if (old_state == META_WL_SHELL_SURFACE_STATE_POPUP &&
wl_shell_surface->popup)
@@ -237,14 +239,14 @@ wl_shell_surface_set_state (MetaWaylandSurface *surface,
}
if (state == META_WL_SHELL_SURFACE_STATE_FULLSCREEN)
meta_window_make_fullscreen (surface->window);
meta_window_make_fullscreen (window);
else
meta_window_unmake_fullscreen (surface->window);
meta_window_unmake_fullscreen (window);
if (state == META_WL_SHELL_SURFACE_STATE_MAXIMIZED)
meta_window_maximize (surface->window, META_MAXIMIZE_BOTH);
meta_window_maximize (window, META_MAXIMIZE_BOTH);
else
meta_window_unmaximize (surface->window, META_MAXIMIZE_BOTH);
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
}
@@ -302,7 +304,8 @@ wl_shell_surface_set_transient (struct wl_client *client,
wl_shell_surface->x = x;
wl_shell_surface->y = y;
if (surface->window && parent_surf->window)
if (meta_wayland_surface_get_window (surface) &&
meta_wayland_surface_get_window (parent_surf))
sync_wl_shell_parent_relationship (surface, parent_surf);
}
@@ -377,7 +380,8 @@ wl_shell_surface_set_popup (struct wl_client *client,
wl_shell_surface->y = y;
wl_shell_surface->pending_popup = TRUE;
if (surface->window && parent_surf->window)
if (meta_wayland_surface_get_window (surface) &&
meta_wayland_surface_get_window (parent_surf))
sync_wl_shell_parent_relationship (surface, parent_surf);
}
@@ -402,6 +406,7 @@ wl_shell_surface_set_title (struct wl_client *client,
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
MetaWindow *window;
g_clear_pointer (&wl_shell_surface->title, g_free);
@@ -410,8 +415,9 @@ wl_shell_surface_set_title (struct wl_client *client,
wl_shell_surface->title = g_strdup (title);
if (surface->window)
meta_window_set_title (surface->window, title);
window = meta_wayland_surface_get_window (surface);
if (window)
meta_window_set_title (window, title);
}
static void
@@ -423,6 +429,7 @@ wl_shell_surface_set_class (struct wl_client *client,
META_WAYLAND_WL_SHELL_SURFACE (wl_resource_get_user_data (resource));
MetaWaylandSurface *surface =
surface_from_wl_shell_surface_resource (resource);
MetaWindow *window;
g_clear_pointer (&wl_shell_surface->wm_class, g_free);
@@ -431,8 +438,9 @@ wl_shell_surface_set_class (struct wl_client *client,
wl_shell_surface->wm_class = g_strdup (class_);
if (surface->window)
meta_window_set_wm_class (surface->window, class_, class_);
window = meta_wayland_surface_get_window (surface);
if (window)
meta_window_set_wm_class (window, class_, class_);
}
static const struct wl_shell_surface_interface meta_wayland_wl_shell_surface_interface = {
@@ -454,13 +462,17 @@ sync_wl_shell_parent_relationship (MetaWaylandSurface *surface,
{
MetaWaylandWlShellSurface *wl_shell_surface =
META_WAYLAND_WL_SHELL_SURFACE (surface->role);
MetaWindow *window;
MetaWindow *parent_window;
meta_window_set_transient_for (surface->window, parent->window);
window = meta_wayland_surface_get_window (surface);
parent_window = meta_wayland_surface_get_window (parent);
meta_window_set_transient_for (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,
meta_window_wayland_place_relative_to (window,
parent_window,
wl_shell_surface->x,
wl_shell_surface->y);
@@ -487,21 +499,21 @@ create_wl_shell_surface_window (MetaWaylandSurface *surface)
meta_wayland_shell_surface_set_window (shell_surface, window);
if (wl_shell_surface->title)
meta_window_set_title (surface->window, wl_shell_surface->title);
meta_window_set_title (window, wl_shell_surface->title);
if (wl_shell_surface->wm_class)
meta_window_set_wm_class (surface->window,
meta_window_set_wm_class (window,
wl_shell_surface->wm_class,
wl_shell_surface->wm_class);
parent = wl_shell_surface->parent_surface;
if (parent && parent->window)
if (parent && meta_wayland_surface_get_window (parent))
sync_wl_shell_parent_relationship (surface, parent);
for (l = wl_shell_surface->children; l; l = l->next)
{
MetaWaylandSurface *child = l->data;
if (child->window)
if (meta_wayland_surface_get_window (child))
sync_wl_shell_parent_relationship (child, surface);
}
}
@@ -575,7 +587,7 @@ wl_shell_surface_role_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceRoleClass *surface_role_class;
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
cairo_region_t *input_region;
MetaRectangle geom = { 0 };

View File

@@ -144,7 +144,8 @@ xdg_exporter_export (struct wl_client *client,
MetaWaylandXdgExported *exported;
char *handle;
if (!surface->role || !surface->window ||
if (!surface->role ||
!meta_wayland_surface_get_window (surface) ||
!(META_IS_WAYLAND_XDG_SURFACE (surface->role) ||
META_IS_WAYLAND_ZXDG_SURFACE_V6 (surface->role)))
{
@@ -256,7 +257,7 @@ is_valid_child (MetaWaylandSurface *surface)
!META_IS_WAYLAND_ZXDG_TOPLEVEL_V6 (surface->role))
return FALSE;
if (!surface->window)
if (!meta_wayland_surface_get_window (surface))
return FALSE;
return TRUE;
@@ -294,12 +295,18 @@ xdg_imported_set_parent_of (struct wl_client *client,
if (surface)
{
MetaWindow *window;
MetaWindow *exported_window;
imported->parent_of_unmapped_handler_id =
g_signal_connect (surface, "unmapped",
G_CALLBACK (imported_parent_of_unmapped),
imported);
meta_window_set_transient_for (surface->window,
imported->exported->surface->window);
window = meta_wayland_surface_get_window (surface);
exported_window =
meta_wayland_surface_get_window (imported->exported->surface);
meta_window_set_transient_for (window, exported_window);
}
}
@@ -329,7 +336,7 @@ meta_wayland_xdg_imported_destroy (MetaWaylandXdgImported *imported)
g_clear_signal_handler (&imported->parent_of_unmapped_handler_id,
imported->parent_of);
window = imported->parent_of->window;
window = meta_wayland_surface_get_window (imported->parent_of);
if (window)
meta_window_set_transient_for (window, NULL);
}

View File

@@ -196,7 +196,7 @@ xdg_toplevel_set_parent (struct wl_client *client,
MetaWindow *transient_for = NULL;
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -205,7 +205,7 @@ xdg_toplevel_set_parent (struct wl_client *client,
MetaWaylandSurface *parent_surface =
surface_from_xdg_surface_resource (parent_resource);
transient_for = parent_surface->window;
transient_for = meta_wayland_surface_get_window (parent_surface);
}
meta_window_set_transient_for (window, transient_for);
@@ -219,7 +219,7 @@ xdg_toplevel_set_title (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -237,7 +237,7 @@ xdg_toplevel_set_app_id (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -260,7 +260,7 @@ xdg_toplevel_show_window_menu (struct wl_client *client,
MetaWindow *window;
int monitor_scale;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -284,7 +284,7 @@ xdg_toplevel_move (struct wl_client *client,
MetaWindow *window;
float x, y;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -330,7 +330,7 @@ xdg_toplevel_resize (struct wl_client *client,
gfloat x, y;
MetaGrabOp grab_op;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -398,7 +398,7 @@ xdg_toplevel_set_maximized (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -416,7 +416,7 @@ xdg_toplevel_unset_maximized (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -431,7 +431,7 @@ xdg_toplevel_set_fullscreen (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -456,7 +456,7 @@ xdg_toplevel_unset_fullscreen (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -470,7 +470,7 @@ xdg_toplevel_set_minimized (struct wl_client *client,
MetaWaylandSurface *surface = surface_from_xdg_toplevel_resource (resource);
MetaWindow *window;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -604,7 +604,7 @@ fill_states (MetaWaylandXdgToplevel *xdg_toplevel,
META_WAYLAND_SURFACE_ROLE (xdg_toplevel);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
if (META_WINDOW_MAXIMIZED (window))
add_state_value (states, XDG_TOPLEVEL_STATE_MAXIMIZED);
@@ -694,7 +694,7 @@ meta_wayland_xdg_toplevel_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaRectangle old_geometry;
gboolean geometry_changed;
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
{
meta_wayland_surface_cache_pending_frame_callbacks (surface, pending);
@@ -904,9 +904,10 @@ static void
scale_placement_rule (MetaPlacementRule *placement_rule,
MetaWaylandSurface *surface)
{
MetaWindow *window = meta_wayland_surface_get_window (surface);
int geometry_scale;
geometry_scale = meta_window_wayland_get_geometry_scale (surface->window);
geometry_scale = meta_window_wayland_get_geometry_scale (window);
placement_rule->anchor_rect.x *= geometry_scale;
placement_rule->anchor_rect.y *= geometry_scale;
@@ -926,12 +927,13 @@ meta_wayland_xdg_popup_place (MetaWaylandXdgPopup *xdg_popup,
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaPlacementRule scaled_placement_rule;
MetaWindow *window;
scaled_placement_rule = *placement_rule;
scale_placement_rule (&scaled_placement_rule, surface);
meta_window_place_with_placement_rule (surface->window,
&scaled_placement_rule);
window = meta_wayland_surface_get_window (surface);
meta_window_place_with_placement_rule (window, &scaled_placement_rule);
}
static void
@@ -958,7 +960,7 @@ finish_popup_setup (MetaWaylandXdgPopup *xdg_popup)
xdg_popup->setup.parent_surface = NULL;
xdg_popup->setup.grab_seat = NULL;
if (!parent_surface->window)
if (!meta_wayland_surface_get_window (parent_surface))
{
xdg_popup_send_popup_done (xdg_popup->resource);
return;
@@ -1065,7 +1067,7 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
}
/* If the window disappeared the surface is not coming back. */
window = surface->window;
window = meta_wayland_surface_get_window (surface);
if (!window)
return;
@@ -1083,7 +1085,7 @@ meta_wayland_xdg_popup_apply_state (MetaWaylandSurfaceRole *surface_role,
meta_window_wayland_finish_move_resize (window, window_geometry, pending);
}
parent_window = xdg_popup->parent_surface->window;
parent_window = meta_wayland_surface_get_window (xdg_popup->parent_surface);
meta_window_get_buffer_rect (window, &buffer_rect);
meta_window_get_buffer_rect (parent_window, &parent_buffer_rect);
if (!meta_rectangle_overlap (&buffer_rect, &parent_buffer_rect) &&
@@ -1126,7 +1128,8 @@ meta_wayland_xdg_popup_configure (MetaWaylandShellSurface *shell_surface,
{
MetaWaylandXdgPopup *xdg_popup = META_WAYLAND_XDG_POPUP (shell_surface);
MetaWaylandXdgSurface *xdg_surface = META_WAYLAND_XDG_SURFACE (xdg_popup);
MetaWindow *parent_window = xdg_popup->parent_surface->window;
MetaWindow *parent_window =
meta_wayland_surface_get_window (xdg_popup->parent_surface);
int geometry_scale;
int x, y;
@@ -1160,7 +1163,8 @@ meta_wayland_xdg_popup_managed (MetaWaylandShellSurface *shell_surface,
g_assert (parent);
meta_window_set_transient_for (window, parent->window);
meta_window_set_transient_for (window,
meta_wayland_surface_get_window (parent));
meta_window_set_type (window, META_WINDOW_DROPDOWN_MENU);
}
@@ -1447,7 +1451,7 @@ meta_wayland_xdg_surface_apply_state (MetaWaylandSurfaceRole *surface_role,
meta_wayland_xdg_surface_get_instance_private (xdg_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
MetaWaylandSurfaceRoleClass *surface_role_class;
surface_role_class =

View File

@@ -471,7 +471,7 @@ meta_x11_drag_dest_focus_in (MetaWaylandDataDevice *data_device,
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
dnd->dnd_dest = surface->window->xwindow;
dnd->dnd_dest = meta_wayland_surface_get_window (surface)->xwindow;
xdnd_send_enter (dnd, dnd->dnd_dest);
}
@@ -619,6 +619,7 @@ repick_drop_surface (MetaWaylandCompositor *compositor,
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
MetaWaylandSurface *focus = NULL;
MetaWindow *focus_window;
focus = pick_drop_surface (compositor, event);
if (dnd->focus_surface == focus)
@@ -626,15 +627,20 @@ repick_drop_surface (MetaWaylandCompositor *compositor,
dnd->focus_surface = focus;
if (focus &&
focus->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
if (focus)
focus_window = meta_wayland_surface_get_window (focus);
else
focus_window = NULL;
if (focus_window &&
focus_window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
XMapRaised (xdisplay, dnd->dnd_window);
XMoveResizeWindow (xdisplay, dnd->dnd_window,
focus->window->rect.x,
focus->window->rect.y,
focus->window->rect.width,
focus->window->rect.height);
focus_window->rect.x,
focus_window->rect.y,
focus_window->rect.width,
focus_window->rect.height);
}
else
{

View File

@@ -228,7 +228,7 @@ static void
meta_xwayland_keyboard_grab_activate (MetaXwaylandKeyboardActiveGrab *active_grab)
{
MetaWaylandSurface *surface = active_grab->surface;
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
MetaWaylandSeat *seat = active_grab->seat;
if (meta_xwayland_grab_is_granted (window))
@@ -259,7 +259,7 @@ zwp_xwayland_keyboard_grab_manager_grab (struct wl_client *client,
struct wl_resource *seat_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWindow *window = surface->window;
MetaWindow *window = meta_wayland_surface_get_window (surface);
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
MetaXwaylandKeyboardActiveGrab *active_grab;
struct wl_resource *grab_resource;

View File

@@ -0,0 +1,283 @@
/*
* Copyright (C) 2013 Intel Corporation
* Copyright (C) 2013-2019 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-xwayland-surface.h"
#include "compositor/meta-surface-actor-wayland.h"
#include "compositor/meta-window-actor-private.h"
#include "wayland/meta-wayland-actor-surface.h"
#include "wayland/meta-xwayland-private.h"
enum
{
WINDOW_ASSOCIATED,
N_SIGNALS
};
static guint signals[N_SIGNALS];
struct _MetaXwaylandSurface
{
MetaWaylandActorSurface parent;
MetaWindow *window;
gulong unmanaging_handler_id;
gulong position_changed_handler_id;
gulong effects_completed_handler_id;
};
G_DEFINE_TYPE (MetaXwaylandSurface,
meta_xwayland_surface,
META_TYPE_WAYLAND_ACTOR_SURFACE)
static void
clear_window (MetaXwaylandSurface *xwayland_surface)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (xwayland_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWindowActor *window_actor;
MetaSurfaceActor *surface_actor;
if (!xwayland_surface->window)
return;
g_clear_signal_handler (&xwayland_surface->unmanaging_handler_id,
xwayland_surface->window);
g_clear_signal_handler (&xwayland_surface->position_changed_handler_id,
xwayland_surface->window);
window_actor = meta_window_actor_from_window (xwayland_surface->window);
g_clear_signal_handler (&xwayland_surface->effects_completed_handler_id,
window_actor);
xwayland_surface->window->surface = NULL;
xwayland_surface->window = NULL;
surface_actor = meta_wayland_surface_get_actor (surface);
if (surface_actor)
clutter_actor_set_reactive (CLUTTER_ACTOR (surface_actor), FALSE);
meta_wayland_surface_notify_unmapped (surface);
}
static void
window_unmanaging (MetaWindow *window,
MetaXwaylandSurface *xwayland_surface)
{
clear_window (xwayland_surface);
}
static void
window_position_changed (MetaWindow *window,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
}
static void
window_actor_effects_completed (MetaWindowActor *window_actor,
MetaWaylandSurface *surface)
{
meta_wayland_surface_update_outputs_recursively (surface);
meta_wayland_compositor_repick (surface->compositor);
}
void
meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surface,
MetaWindow *window)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (xwayland_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaSurfaceActor *surface_actor;
MetaWindowActor *window_actor;
/*
* If the window has an existing surface, like if we're undecorating or
* decorating the window, then we need to detach the window from its old
* surface.
*/
if (window->surface)
{
MetaXwaylandSurface *other_xwayland_surface;
other_xwayland_surface = META_XWAYLAND_SURFACE (window->surface->role);
clear_window (other_xwayland_surface);
}
window->surface = surface;
xwayland_surface->window = window;
surface_actor = meta_wayland_surface_get_actor (surface);
if (surface_actor)
clutter_actor_set_reactive (CLUTTER_ACTOR (surface_actor), TRUE);
xwayland_surface->unmanaging_handler_id =
g_signal_connect (window,
"unmanaging",
G_CALLBACK (window_unmanaging),
xwayland_surface);
xwayland_surface->position_changed_handler_id =
g_signal_connect (window,
"position-changed",
G_CALLBACK (window_position_changed),
surface);
xwayland_surface->effects_completed_handler_id =
g_signal_connect (meta_window_actor_from_window (window),
"effects-completed",
G_CALLBACK (window_actor_effects_completed),
surface);
g_signal_emit (xwayland_surface, signals[WINDOW_ASSOCIATED], 0);
window_actor = meta_window_actor_from_window (window);
if (window_actor)
meta_window_actor_assign_surface_actor (window_actor, surface_actor);
}
static void
meta_xwayland_surface_assigned (MetaWaylandSurfaceRole *surface_role)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (meta_xwayland_surface_parent_class);
surface->dnd.funcs = meta_xwayland_selection_get_drag_dest_funcs ();
surface_role_class->assigned (surface_role);
}
static void
meta_xwayland_surface_pre_apply_state (MetaWaylandSurfaceRole *surface_role,
MetaWaylandSurfaceState *pending)
{
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaXwaylandSurface *xwayland_surface = META_XWAYLAND_SURFACE (surface_role);
if (pending->newly_attached &&
surface->buffer_ref.buffer &&
xwayland_surface->window)
meta_window_queue (xwayland_surface->window, META_QUEUE_CALC_SHOWING);
}
static void
meta_xwayland_surface_get_relative_coordinates (MetaWaylandSurfaceRole *surface_role,
float abs_x,
float abs_y,
float *out_sx,
float *out_sy)
{
MetaXwaylandSurface *xwayland_surface = META_XWAYLAND_SURFACE (surface_role);
MetaRectangle window_rect;
meta_window_get_buffer_rect (xwayland_surface->window, &window_rect);
*out_sx = abs_x - window_rect.x;
*out_sy = abs_y - window_rect.y;
}
static MetaWaylandSurface *
meta_xwayland_surface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
return meta_wayland_surface_role_get_surface (surface_role);
}
static MetaWindow *
meta_xwayland_surface_get_window (MetaWaylandSurfaceRole *surface_role)
{
MetaXwaylandSurface *xwayland_surface = META_XWAYLAND_SURFACE (surface_role);
return xwayland_surface->window;
}
static double
meta_xwayland_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
{
return 1;
}
static void
meta_xwayland_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
{
MetaXwaylandSurface *xwayland_surface = META_XWAYLAND_SURFACE (actor_surface);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (meta_xwayland_surface_parent_class);
if (xwayland_surface->window)
actor_surface_class->sync_actor_state (actor_surface);
}
static void
meta_xwayland_surface_finalize (GObject *object)
{
MetaXwaylandSurface *xwayland_surface = META_XWAYLAND_SURFACE (object);
GObjectClass *parent_object_class =
G_OBJECT_CLASS (meta_xwayland_surface_parent_class);
clear_window (xwayland_surface);
parent_object_class->finalize (object);
}
static void
meta_xwayland_surface_init (MetaXwaylandSurface *xwayland_surface)
{
}
static void
meta_xwayland_surface_class_init (MetaXwaylandSurfaceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (klass);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
object_class->finalize = meta_xwayland_surface_finalize;
surface_role_class->assigned = meta_xwayland_surface_assigned;
surface_role_class->pre_apply_state = meta_xwayland_surface_pre_apply_state;
surface_role_class->get_relative_coordinates =
meta_xwayland_surface_get_relative_coordinates;
surface_role_class->get_toplevel = meta_xwayland_surface_get_toplevel;
surface_role_class->get_window = meta_xwayland_surface_get_window;
actor_surface_class->get_geometry_scale =
meta_xwayland_surface_get_geometry_scale;
actor_surface_class->sync_actor_state =
meta_xwayland_surface_sync_actor_state;
signals[WINDOW_ASSOCIATED] =
g_signal_new ("window-associated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2013 Intel Corporation
* Copyright (C) 2013-2019 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_XWAYLAND_SURFACE_H
#define META_XWAYLAND_SURFACE_H
#include "meta/types.h"
#include "wayland/meta-wayland-actor-surface.h"
#define META_TYPE_XWAYLAND_SURFACE (meta_xwayland_surface_get_type ())
G_DECLARE_FINAL_TYPE (MetaXwaylandSurface,
meta_xwayland_surface,
META, XWAYLAND_SURFACE,
MetaWaylandActorSurface)
void
meta_xwayland_surface_associate_with_window (MetaXwaylandSurface *xwayland_surface,
MetaWindow *window);
#endif /* META_XWAYLAND_SURFACE_H */

View File

@@ -39,37 +39,11 @@
#include <unistd.h>
#include <X11/Xauth.h>
#include "compositor/meta-surface-actor-wayland.h"
#include "compositor/meta-window-actor-private.h"
#include "core/main-private.h"
#include "meta/main.h"
#include "wayland/meta-wayland-actor-surface.h"
#include "wayland/meta-xwayland-surface.h"
#include "x11/meta-x11-display-private.h"
enum
{
XWAYLAND_SURFACE_WINDOW_ASSOCIATED,
XWAYLAND_SURFACE_LAST_SIGNAL
};
guint xwayland_surface_signals[XWAYLAND_SURFACE_LAST_SIGNAL];
#define META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND (meta_wayland_surface_role_xwayland_get_type ())
G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleXWayland,
meta_wayland_surface_role_xwayland,
META, WAYLAND_SURFACE_ROLE_XWAYLAND,
MetaWaylandActorSurface)
struct _MetaWaylandSurfaceRoleXWayland
{
MetaWaylandActorSurface parent;
};
G_DEFINE_TYPE (MetaWaylandSurfaceRoleXWayland,
meta_wayland_surface_role_xwayland,
META_TYPE_WAYLAND_ACTOR_SURFACE)
static int display_number_override = -1;
static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager);
@@ -79,20 +53,10 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window,
MetaWaylandSurface *surface)
{
MetaDisplay *display = window->display;
MetaWindowActor *window_actor;
/* If the window has an existing surface, like if we're
* undecorating or decorating the window, then we need
* to detach the window from its old surface.
*/
if (window->surface)
{
meta_wayland_surface_set_window (window->surface, NULL);
window->surface = NULL;
}
MetaXwaylandSurface *xwayland_surface;
if (!meta_wayland_surface_assign_role (surface,
META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND,
META_TYPE_XWAYLAND_SURFACE,
NULL))
{
wl_resource_post_error (surface->resource,
@@ -102,20 +66,8 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window,
return;
}
window->surface = surface;
meta_wayland_surface_set_window (surface, window);
g_signal_emit (surface->role,
xwayland_surface_signals[XWAYLAND_SURFACE_WINDOW_ASSOCIATED],
0);
window_actor = meta_window_actor_from_window (window);
if (window_actor)
{
MetaSurfaceActor *surface_actor;
surface_actor = meta_wayland_surface_get_actor (surface);
meta_window_actor_assign_surface_actor (window_actor, surface_actor);
}
xwayland_surface = META_XWAYLAND_SURFACE (surface->role);
meta_xwayland_surface_associate_with_window (xwayland_surface, window);
/* Now that we have a surface check if it should have focus. */
meta_display_sync_wayland_input_focus (display);
@@ -853,80 +805,3 @@ meta_xwayland_shutdown (MetaXWaylandManager *manager)
g_clear_pointer (&manager->lock_file, g_free);
}
}
static MetaWaylandSurface *
xwayland_surface_get_toplevel (MetaWaylandSurfaceRole *surface_role)
{
return meta_wayland_surface_role_get_surface (surface_role);
}
static double
xwayland_surface_get_geometry_scale (MetaWaylandActorSurface *actor_surface)
{
return 1;
}
static void
xwayland_surface_sync_actor_state (MetaWaylandActorSurface *actor_surface)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (actor_surface);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (meta_wayland_surface_role_xwayland_parent_class);
if (surface->window)
actor_surface_class->sync_actor_state (actor_surface);
}
static void
xwayland_surface_finalize (GObject *object)
{
MetaWaylandSurfaceRole *surface_role =
META_WAYLAND_SURFACE_ROLE (object);
MetaWaylandSurface *surface =
meta_wayland_surface_role_get_surface (surface_role);
GObjectClass *parent_object_class =
G_OBJECT_CLASS (meta_wayland_surface_role_xwayland_parent_class);
MetaWindow *window;
window = surface->window;
if (window)
{
meta_wayland_surface_set_window (surface, NULL);
window->surface = NULL;
}
parent_object_class->finalize (object);
}
static void
meta_wayland_surface_role_xwayland_init (MetaWaylandSurfaceRoleXWayland *role)
{
}
static void
meta_wayland_surface_role_xwayland_class_init (MetaWaylandSurfaceRoleXWaylandClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaWaylandSurfaceRoleClass *surface_role_class =
META_WAYLAND_SURFACE_ROLE_CLASS (klass);
MetaWaylandActorSurfaceClass *actor_surface_class =
META_WAYLAND_ACTOR_SURFACE_CLASS (klass);
object_class->finalize = xwayland_surface_finalize;
surface_role_class->get_toplevel = xwayland_surface_get_toplevel;
actor_surface_class->get_geometry_scale = xwayland_surface_get_geometry_scale;
actor_surface_class->sync_actor_state = xwayland_surface_sync_actor_state;
xwayland_surface_signals[XWAYLAND_SURFACE_WINDOW_ASSOCIATED] =
g_signal_new ("window-associated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}