Commit Graph

29 Commits

Author SHA1 Message Date
Jonas Dreßler
9b99b67fea Remove ClutterAllocationFlags
Those flags were removed from Clutter since they're pretty much unused,
so remove them here, too.

See https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1245

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1245
2020-05-20 15:12:03 +02:00
Robert Mader
135d178d08 cleanup: Use g_clear_signal_handler() where possible
`g_clear_signal_handler()` is usually cleaner and saver than
`g_signal_handler_disconnect()`. We use it new code, lets also
adopt the existing one.

See also https://gitlab.gnome.org/GNOME/mutter/merge_requests/868
and https://gitlab.gnome.org/GNOME/mutter/merge_requests/940

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/842
2019-11-21 22:37:37 +00:00
Florian Müllner
d8825e0d12 shell: Stop using anchor point
Since the removal of the old (pre-3.16) message tray, legacy tray icons
are very unlikely to be placed in a container that is animated using the
deprecated anchor point.

Just assume that the regular stage position is good enough.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/572
2019-06-05 17:59:51 +00:00
Florian Müllner
ae07aa7864 gtk-embed: Hide window actors from pick
Since we started to support tray icons on wayland, the icon we show
is not the actual XEmbed window. Instead, we let mutter create a
MetaWindow for it, then use its window actor as source for a clone
we (or nowadays: extensions) can add, remove and destroy freely.

To not let the real icon get in the way, we set an empty input shape
and make its window actor fully transparent. This works OK on X11,
but on wayland all events still go through Clutter, so any reactive
surface actor inside the window actor will block events for any actors
underneath (and status icons go into the top-windows group, so almost
all actors are affected).

Luckily we can pile another hack onto the pile of status icon hacks ...

https://gitlab.gnome.org/GNOME/gnome-shell/issues/191
2019-03-04 19:52:24 +00:00
Ray Strode
90c55e1977 gtk-embed: ensure we only listen for window-created events once
If a tray icon gets a mapped and unmapped and the mapped again
in quick succession, we can end up with multiple handlers
listening for window creation events.

This commit tries to guard against that by only listening for
window-created events when we don't  know the actor associated
with the icon.

https://bugzilla.gnome.org/show_bug.cgi?id=787361
2017-09-15 15:32:46 -04:00
Jonas Ådahl
c131c44ef6 gtk-embed: Don't try to compare with unrealized window
After having embedded a Gtk window, we start to listen for the
corresponding MetaWindow to know when it has been mapped by the
compositor. If the embedder does not realize the window immediately,
and some other window is created and mapped before the embedder
realizes the window, we would prior to this patch try to dereference
the not created GdkWindow. Fix this by NULL checking the GdkWindow
before dereferencing. We will never miss the needed MetaWindow creation
since it can not have been mapped have it not yet been realized.

https://bugzilla.gnome.org/show_bug.cgi?id=776130
2016-12-15 19:42:48 +08:00
Florian Müllner
294702d3f1 shell: Use G_DECLARE_*_TYPE macros
Cut down on boilerplate by using the (no longer that) new helper
macros. We don't care about breaking ABI in private libraries, so
use G_DECLARE_FINAL_TYPE even where the class struct used to be
exposed in the header, except for types we inherit from ourselves
(obviously) or where the class exposes any vfuncs (where changes
could affect inheritance in extensions).
2015-10-15 22:58:28 +02:00
Florian Müllner
e25502aeb2 shell: Use G_DEFINE_TYPE_WITH_PRIVATE() and friends 2015-10-15 22:03:06 +02:00
Florian Müllner
9a3041004b shell: Don't shadow existing variables 2015-09-23 21:32:50 +02:00
Florian Müllner
169b00aa64 gtk-embed: Handle unmap/map of the embedded window
The current code assumes that an embedded window will correspond to
a single MetaWindow over the entire lifetime of the icon, which is
incorrect - the embedded window is unmanaged on Unmap and a new
MetaWindow will be created the next time the embedded window is
mapped. As we currently ignore the new MetaWindow completely, it
will be shown normally in the scene instead of the embedded clone
as intended.
Fix this by setting up clone and window actor each time the embedded
window is mapped rather than once in shell_gtk_embed_set_window().

https://bugzilla.gnome.org/show_bug.cgi?id=745824
2015-03-22 09:33:33 +01:00
Florian Müllner
f0c0687b43 gtk-embed: Fix typo in comment 2015-03-20 02:32:01 +01:00
Jasper St. Pierre
dbf16d6ea3 shell-gtk-embed: Remove old hack workaround for a mutter bug
The window actor shouldn't have been picked since it has an empty
input shape, but bugs in mutter weren't properly interpreting that.

Since the Wayland restructure, the MetaWindowActor isn't actually
reactive anymore, it's the MetaSurfaceActorX11, so this code isn't
doing anything.
2014-11-26 12:54:37 -08:00
Jasper St. Pierre
ae80e81b75 shell-gtk-embed: Make the MetaWindowActor for a tray icon unreactive
The MetaWindowActor isn't painted, and we empty its input shape in
the X scene graph, but Clutter still picked it. Set it as unreactive
so that it can't be picked.

https://bugzilla.gnome.org/show_bug.cgi?id=706536
2013-08-21 16:53:05 -04:00
Adel Gadllah
0509bb9bb4 shell-gtk-embed: Lower tray icon windows to the bottom of the stack
Otherwise they break the "top level window" detection used by the
unredirect code in mutter, causes game windows not to be unredirected
when tray icons are present.

https://bugzilla.gnome.org/show_bug.cgi?id=701224
2013-05-30 00:57:37 +02:00
Neil Roberts
5001bd8810 Don't use ClutterX11TexturePixmap directly to embed docked windows
Previously when a client requests that a window should be docked the
shell would reparent the socket window onto the stage's window and
then use ClutterX11TexturePixmap to get a texture to represent the
window. This will not work if Clutter is no longer using the X11
winsys for example if it becomes its own display server. Instead this
patch leaves the socket window as a child of the root window and lets
mutter create a MetaWindow out of it. If Mutter is acting as a display
server then this mechanism will still work via the headless x server.

The ShellGtkEmbed instance now registers for notification of the
‘window-created’ signal of the display so that it can find the
MetaWindow that gets created to represent the socket window. When this
window is found it is prevented from being displayed on the screen by
setting the actor's opacity to 0. An input shape is then set on the
window to prevent it receiving any input.

Instead of being a subclass of ClutterX11TexturePixmap, ShellGtkEmbed
is now a subclass of ClutterClone. When the MetaWindow is found for
the socket window the clone's source is set to the invisible actor for
the window so it can be displayed in the panel as before.

The ShellEmbeddedWindow no longer needs to know what the stage is
because it no longer reparents the socket window. Therefore the
ShellTrayManager doesn't need to know the stage either so
shell_tray_manager_manage_stage has been replaced with just
shell_tray_manager_manage_screen.

https://bugzilla.gnome.org/show_bug.cgi?id=693438
2013-03-18 16:49:47 +00:00
Jasper St. Pierre
f563fb124e shell-gtk-embed: Fix NULL pointer dereference
Clutter will try to unmap during a dispose if we have a parent, so if we
set our own actor to NULL before the chain up, we're going to attempt to
unmap our own NULL actor. Fix that by swapping the order in which we
chain up.

https://bugzilla.gnome.org/show_bug.cgi?id=672790
2012-09-04 19:21:30 -03:00
Jasper St. Pierre
d212d57466 shell-embedded-window: Remove hacks for old and fixed Clutter bug
We used to use realize/unrealize instead of map/unmap in ShellEmbeddedWindow
because there originally was no map/unmap. The days of this are long gone...

https://bugzilla.gnome.org/show_bug.cgi?id=672790
2012-07-13 17:28:50 -04:00
Rico Tzschichholz
167ca75388 Replace deprecated gtk_widget_size_request 2011-11-11 09:50:18 +01:00
Dan Winship
84bac4414c ShellGtkEmbed: revert to old actor/window position-syncing code
Synchronizing the actor and window position on paint resulted in lots
of syncing, and also resulted in the window mistakenly being left at
0,0 if the actor wasn't visible when the window first mapped.

Revert back to the old way of doing it, by tying into
clutter_actor_allocate, which was only failing before because of a bug
elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=635695
2011-01-10 15:22:50 -05:00
Giovanni Campagna
0ba7188625 Remove Gtk 2 compatibility code
It is useless now that we require Gtk 3.

https://bugzilla.gnome.org/show_bug.cgi?id=638315
2010-12-30 21:36:37 +01:00
Jason D. Clinton
7ce65e421b Fix compilation against latest GTK+-3 changes
GDK_WINDOW_XWINDOW has been removed. All calls should use
gdk_x11_window_get_xid() instead.
2010-12-02 17:12:07 -06:00
Florian Müllner
e967807acf shell-gtk-embed: Use GtkWidget instead of GtkObject
GtkObject has been deprecated and removed from GTK+.
2010-09-27 17:05:40 +02:00
Dan Winship
63f2066135 [ShellGtkEmbed] do a better job of tracking the actor's position
Previously the code to keep the X window aligned with its actor made
various assumptions that were true in the panel status tray area but
that are not true in the message tray. Fix it up by repositioning the
X window at clutter_actor_paint() time, which will definitely be
called every time the actor moves, whether it's because of its own or
its parent/ancestor's changes.

https://bugzilla.gnome.org/show_bug.cgi?id=608869
2010-09-23 09:49:47 -04:00
Dan Winship
745e8f608f [ShellGtkEmbed] base this on ClutterX11TexturePixmap, not ClutterGLX
As of 1.4, ClutterGLXTexturePixmap is identical to
ClutterX11TexturePixmap (with the differences having been moved into
the cogl layer). So make ShellGtkEmbed use the (introspected) X11
version, which then allows us to make the instance and class structs
public as well.

https://bugzilla.gnome.org/show_bug.cgi?id=608869
2010-09-23 09:49:47 -04:00
Florian Müllner
6318c8e95b Add compatibility with GTK+ 2.18
To replace all calls to deprecated code, GTK+ 2.20 is required - add
some basic compatibility code, so that is still possible to build the
shell with GTK+ 2.18 when not using -DGSEAL_ENABLE.

https://bugzilla.gnome.org/show_bug.cgi?id=618258
2010-05-10 18:31:51 +02:00
Florian Müllner
8c5bb8655d Use accessor functions instead of direct access
With the transition to GTK+ 3.0, direct access to struct members
will no longer be possible.
This bumps the required minimum version of GTK+ to 2.20.

https://bugzilla.gnome.org/show_bug.cgi?id=618258
2010-05-10 18:31:51 +02:00
Dan Winship
dd8f05c81d include "config.h" in all .c files
Also, fix shell-global.c to actually compile with config.h included.

Was supposed to fix bug 602802, but doesn't...
2009-11-24 09:15:35 -05:00
Owen W. Taylor
2c7d33bad2 Port gnome-shell to the Clutter-1.0 API
- clutter_actor_get_transformed_position()/size() return floats
- clutter_stage_get_actor_at_pos() takes a pick mode
- ClutterTimeline no longer has a concept of frames
- ClutterUnit is now replaced by float
- cogl_texture_new_from_data() signature changed

http://bugzilla.gnome.org/show_bug.cgi?id=585013
2009-06-08 13:49:53 -04:00
Owen W. Taylor
3327a198e1 Add size negotiation to the tray icons
* Rename ShellGtkWindowActor to ShellGtkEmbed, and make it require
  a ShellEmbeddedWindow rather than a general GtkWindow.

* Add ShellEmbeddedWindow subclass of GtkWindow that bypasses most
  of the GtkWindow complexity for size negotiation, and calls out
  to a clutter actor instead; also automatically handle reparenting
  the GtkWindow into the stage window.

* Use the reworked ShellGtkEmbed in ShellTrayManager, this simplifies
  the code a bit, and more importantly results in the tray icons
  having the correct size negotiation, rather than having a fixed
  24x24 size.

http://bugzilla.gnome.org/show_bug.cgi?id=580047
2009-05-04 14:24:05 -04:00