Compare commits

..

57 Commits

Author SHA1 Message Date
Owen W. Taylor
8d402971a8 Bump version to 2.27.3 2009-08-28 19:14:34 -04:00
Steve Frécinaux
7e0087304b Add meta_window_is_skip_taskbar
Accessor for the 'skip-taskbar', which will allow gnome-shell not to
consider windows with this hint in its overview thunbnails.
2009-08-28 19:05:17 +02:00
Owen W. Taylor
20b02e738c Make MUTTER_DEBUG_XINERAMA override active Xinerama
It seems a bit cleaner to make the MUTTER_DEBUG_XINERAMA variable
that sets up fake Xinerama take effect even if Xinerama is active;
this means we don't count on Xinerama (or Xrandr if we switch tot
that) special casing the case of one monitor.

http://bugzilla.gnome.org/show_bug.cgi?id=593404
2009-08-28 12:57:29 -04:00
Owen W. Taylor
d042dba4d6 Add meta_display_get_grab_op()
Add a function to determine the current grab op. This can be useful
in a plugin to avoid over-grabbing an X grab held by Mutter.

http://bugzilla.gnome.org/show_bug.cgi?id=593399
2009-08-28 12:27:46 -04:00
Volker Sobek
a69ce37546 Unminimize windows passed to meta_workspace_activate_with_focus()
Unminimize minimized windows passed to meta_workspace_activate_with_focus()
by calling meta_window_activate() on them instead of meta_window_focus()
and meta_window_raise(). This fix makes sense because for the existing
usage inside Mutter meta_workspace_activate_with_focus() is never called
on a minimized window and for calls from outside Mutter there is no
point in focusing a minimized window without unminimizing it first.

Add a doc comment to meta_workspace_activate_with_focus().

http://bugzilla.gnome.org/show_bug.cgi?id=592393
2009-08-28 12:10:41 -04:00
Tomas Frydrych
3e09b4a725 Check for NULL in meta_screen_tab_popup_destroy() instead of asserting
This function is getting called even when no MetaAltTabHandler object is
installed on the screen, so we need to handle the NULL gracefully.
2009-08-27 17:49:13 +01:00
Daniel Nylander
c2c0de1696 Updated Swedish translation 2009-08-27 08:52:02 +02:00
Javier Jardón
cc46d2ebb4 Stop using gtk_toolbar_insert_stock()
Add helper functions instead of using this deprecated symbol.

http://bugzilla.gnome.org/show_bug.cgi?id=587991

A#	../stamp-mutter-marshal.h
2009-08-26 12:57:29 -04:00
Javier Jardón
d0510d8ea2 Stop using GTK_SIGNAL_FUNC, gdk_pixbuf_render_to_drawable
Replace with non-deprecated gdk_draw_pixbuf(), G_CALLBACK()

http://bugzilla.gnome.org/show_bug.cgi?id=587991
2009-08-26 12:56:04 -04:00
Owen W. Taylor
7b0ba87b24 Fix custom-alt-tabs for single-handling of key events
The changes to enforce single handling of all key events were breaking
custom-alt-tab keypress handlers, since that code was assuming that
key event would get to process_tab_grab(), and then maybe to
process_event() and then to the plugin's xevent_filter to detect a
key release.

We centeralize all of this handling into process_tab_grab() and either

 - Invoke a custom handler for the key press
 - Select the current window on modifier release by calling a  new
   pseudo-binding "tab_popup_select"
 - Cancel the grab on an unbound key by calling a new pseudo-binding
   "tab_popup_cancel"

http://bugzilla.gnome.org/show_bug.cgi?id=590754
2009-08-26 12:26:58 -04:00
Owen W. Taylor
67682a2683 Add a modal mode for plugins
mutter_plugin_begin_modal() and mutter_plugin_begin_modal() allow putting
a plugin into a "modal" state. This means:

 - The plugin has the keyboard and mouse grabbed
 - All keyboard and mouse events go exclusively to the plugin

mutter-plugin.[ch]: Add public API
compositor.c compositor-private.h: Implement the API
mutter-plugin-manager.c: When reloading plugins, make sure none of them
  are modal at that moment, and if so force-unmodal them.
common.h: Add META_GRAB_OP_COMPOSITOR
display: When display->grab_op is META_GRAB_OP_COMPOSITOR forward relevant
  events exclusively to the compositor.

http://bugzilla.gnome.org/show_bug.cgi?id=590754
2009-08-26 12:26:58 -04:00
Owen W. Taylor
b1776b5ae5 Enforce a policy of single-handling of key events
Only process each key event once. If all keys are grabbed, then
don't also look for handlers for a key shortcut after processing
the grab op. If all keys are grabbed or we find a key shortcut,
don't pass the event on to the compositing mananger.

http://bugzilla.gnome.org/show_bug.cgi?id=590754
2009-08-26 12:26:58 -04:00
Thomas James Alexander Thurman
7a6968cb46 Only skip the first window in the alt-tab chain if it's actually the
* src/core/display.c: Only skip the first window in
        the alt-tab chain if it's actually the current window
        (urgent windows on other workspaces may precede it).
        Fixes #535887.

http://bugzilla.gnome.org/show_bug.cgi?id=591913

(Metacity commit 92bfe34716)
2009-08-26 15:29:09 +01:00
Owen W. Taylor
d58c9a57c6 Avoid accessing freed memory when being replaced
If we are replaced via the window manager selection, then we close
the MetaDisplay before meta_finalize() runs. We should be careful
not to try to close the display again (and access already freed
memory) in that case, so clear the global 'the_display' variable.

See Metacity bug http://bugzilla.gnome.org/show_bug.cgi?id=588119

http://bugzilla.gnome.org/show_bug.cgi?id=592742
2009-08-24 14:29:16 -04:00
Frédéric Péters
d804a1f146 Remove deprecated Encoding key from desktop files 2009-08-22 14:24:22 +02:00
Colin Walters
01581dc61c [MetaWindow]: Always notify on title property change
The previous notification code was attempting to use the "modified"
boolean returned from set_title_text, but "that boolean doesn't mean
what you think it means".  It actually means "I truncated the title".

Just always notify, it's far simpler than trying to compute
when we don't need to, and callers can compress if they really need
to.
2009-08-21 12:38:30 -04:00
Colin Walters
9cc70a3fb6 Make meta_display_xwindow_is_a_no_focus_window public
Useful for window analysis in plugins.
2009-08-20 14:20:01 -04:00
Fran Dieguez
7396f5709e Updated Galician Translation 2009-08-15 10:05:52 +02:00
Colin Walters
41cf9134a6 Add meta_window_is_mapped, remove usage of window-private.h from mutter-window.c
mutter-window.c originally grew an #include "window-private.h" for
window->override_redirect, but that was just fixed.  However since
then it also ended up relying on a few other minor private bits.

To fix that, add meta_window_is_mapped, promote meta_window_toplevel_is_mapped
to public, and use the public MetaDisplay accessor.
2009-08-14 19:47:13 -04:00
Colin Walters
e960269653 Add meta_window_is_override_redirect
Trivial function, useful for plugins which are doing analysis
of windows.
2009-08-14 19:47:13 -04:00
Gabor Kelemen
5e581b409c Hungarian translation updated 2009-08-15 01:40:29 +02:00
Owen W. Taylor
f03d39eefb Check the opacity of the right actor
When determining if the window is opaque or not, look at it's opacity,
not the opacity of the window group.

Reported by Matthias Clasen
http://bugzilla.gnome.org/show_bug.cgi?id=591836
2009-08-14 15:58:07 -04:00
Owen W. Taylor
91baf552cf Remove meta_errors_register_foreign_display()
The functionality to propagate errors for other displays to other
a "foreign error handler" was Soeren's compositor and is no longer
being used. Remove it.

(Now that error.h is being installed and scanned, we need to either
do this or add XErrorEvent to xlib-2.0.gir and rename ErrorHandler
to MetaErrorHandler. This way is a bit simpler.)
2009-08-13 07:38:08 -04:00
Michael Meeks
16466cf7d6 install errors.h header, bug 591566 2009-08-13 09:46:15 +01:00
Tomas Frydrych
f3e6913d57 Added meta_window_is_modal()
Queries whether the window is in a modal state, as per the _NET_WM_STATE
protocol.
2009-08-12 07:49:08 +01:00
Tomas Frydrych
2c8df7d12e Do not run effects during WM startup
When we first start up, we do not want to run effects on any pre-exising
windows (this is either the case we are starting up and there are no windows,
or we are replacing an exisint window manager, or worse, we crashed, and we
just want to get to the desired desktop as quick as possible).

Dithered about where to place the check; putting into the plugin manager
reduces the number of places (and files) in which it needs to be done.
2009-08-12 07:45:03 +01:00
Owen W. Taylor
dafdecb4e8 Be silent by default
We might as well turn on the AM_SILENT_RULES by default if a new-enough
automake is found rather than requiring --enable-silent-rules.

http://bugzilla.gnome.org/show_bug.cgi?id=591367
2009-08-11 18:53:30 -04:00
Owen W. Taylor
c5874e0da5 Bump version to 2.27.2 2009-08-10 12:24:03 -04:00
Colin Walters
422cd1fbbf Fix use of uninitialized memory in edge-resistance.c
g_new bad, g_new0 good.
2009-08-09 23:40:22 -04:00
Colin Walters
8a9e2877da Export meta_screen_get_startup_sequences, add change signal
It's useful for plugins to be able to get access to the
startup-notification data that Mutter already has.  Add
an accessor and change signal when recieve an event.
2009-08-09 23:36:08 -04:00
Kjartan Maraas
ff84b35e5d Updated Norwegian bokmål translation. 2009-08-09 15:48:46 +02:00
Tomas Frydrych
ae32ac86b4 Use correct timestamp for focus stealing prevention
When window initially maps, use the more recent of NET_WM_USER_TIME and
startup notification timestamps to compare against last known user action to
decide whether to focus the window or not. Once we show the window, clear
the initial_timestamp_set flag, so the startup notification timestamp is not
taken into account again.

Based on patch for metacity by Alexander Larsson

http://bugzilla.gnome.org/show_bug.cgi?id=573922
2009-08-08 17:59:01 +01:00
Tomas Frydrych
bca3eaf709 Removed custom 'GIR' label for gir generation in silent-rules mode
http://bugzilla.gnome.org/show_bug.cgi?id=591120
2009-08-08 13:47:31 +01:00
Tomas Frydrych
0f64202a29 Added --enable-silent-rules if automake-1.11 is available 2009-08-07 17:58:02 +01:00
Tomas Frydrych
6b36e64e00 Take extra reference on the texture inside MutterWindow
We store a pointer to the texture independently of the ClutterContainer
internals, and rely on the pointer remaining valid until we run dispose.
Since we also provide public API to access this pointer, we should not
rely on the reference ClutterContainer holds to ensure that texture will
not be destroyed (e.g., some nasty developer could reparent the texture).
2009-08-07 17:38:11 +01:00
Tomas Frydrych
84059f1faa Free MutterWindow description string in finalize() not dispose()
We were freeing the description string in dispose and not setting it to NULL,
thus leaving around a dangling pointer for the duration of the disposal.
This commit moves the free into the finalize vfuction, where it belongs.
2009-08-07 16:47:43 +01:00
Owen W. Taylor
15376957f7 Don't allow override-redirect windows to be META_WINDOW_NORMAL
Many override-redirect windows (including the Metacity UI windows!)
will have NET_WM_WINDOW_TYPE_NORMAL set on them because of shared
code paths with normal windows in toolkits.

Some current Compositor plugins (default plugin and gnome-shell)
check type == NORMAL to determine if to run effects. While fixing
such plugins to also check if the window is override-redirect is
posisble, it seems cleanest to simply not allow any of the decorated
window types to be set on an override-redirect window and to force
these types to META_WINDOW_OVERRIDE_OTHER. This will prevent other
similar problems from showing up in the future.

http://bugzilla.gnome.org/show_bug.cgi?id=590971
2009-08-06 12:16:24 -04:00
Owen W. Taylor
da934be354 Elimitate use of arithmetic expansion for portability
Use expr rather than $(( <arithmetic> )) - this is needed at least
for the default Solaris shell.

Based on patch by Halton Huo
http://bugzilla.gnome.org/show_bug.cgi?id=590719
2009-08-04 11:18:43 -04:00
Tomas Frydrych
3eee6b4218 Handle FocusIn events for override redirect windows correctly
Do not try to insert / remove the window from the MRU list; just reset the
MetaDisplay focus window to NULL.

http://bugzilla.gnome.org/show_bug.cgi?id=590611
2009-08-04 14:31:13 +01:00
Tomas Frydrych
ff9400abde Remove deprecated GTK symbols
http://bugzilla.gnome.org/show_bug.cgi?id=587991

(adapted from metacity commit 3f76affbd2,
original patch by Thomas Andersen)
2009-08-04 09:23:37 +01:00
Tomas Frydrych
e985bf0e7a use g_signal_handlers_disconnect_by_func instead of an old deprecated
http://bugzilla.gnome.org/show_bug.cgi?id=587991

(adapted from metacity commit a8f8970601,
original patch by Matt Kraai)
2009-08-04 09:22:49 +01:00
Tomas Frydrych
245908909b Fix check for zero-sized textures in MutterShaped texture
Patch by Jon Nettleton <jon.nettleton@gmail.com>

http://bugzilla.openedhand.com/show_bug.cgi?id=1538
http://bugzilla.gnome.org/show_bug.cgi?id=590646
2009-08-04 08:47:46 +01:00
Xu Li
2f63d321d1 [constraints] Avoid overflow when window maximum size hint is set to INT_MAX
When calculating maximum permissible size of our frame window, we need to
avoid an overflow if the application set its max size hint to INT_MAX.

http://bugzilla.gnome.org/show_bug.cgi?id=590627
2009-08-04 08:38:56 +01:00
Tomas Frydrych
2222cb8fbf Added public prototype for meta_window_is_ancestor_of_transient()
http://bugzilla.gnome.org/show_bug.cgi?id=590439
2009-08-04 08:32:36 +01:00
Tomas Frydrych
897814a153 Added MetaWindow::window-type property
Read-only property for querying the type of MetaWindow.

http://bugzilla.gnome.org/show_bug.cgi?id=588230
2009-08-04 08:06:30 +01:00
Tomas Frydrych
8b7b41df41 Accessors for pid and name of client machine associated with MetaWindow
http://bugzilla.gnome.org/show_bug.cgi?id=590388
2009-08-04 07:58:11 +01:00
Tomas Frydrych
8f9a174f0a Fixed warnings due to missing casts 2009-08-01 11:11:11 +01:00
Colin Walters
df90187e06 Add focus-window property to MetaDisplay
Useful mainly for notify::focus-window.
2009-08-01 04:38:26 -04:00
Tomas Frydrych
c9e0613b53 Set up correct initial values for override redirect windows
As a sideffect of commit a576f7a1ea, override
redirect windows of type _NET_WM_WINDOW_TYPE_NORMAL do not have their
features recalculated during MetaWindow construction (same as regular
windows of type _NET_WM_WINDOW_TYPE_NORMAL), so we need to set the initial
values accordingly.
2009-08-01 09:11:06 +01:00
Tomas Frydrych
a576f7a1ea Tolerate all standard _NET_WM_WINDOW_TYPE types for managed windows
Although the spec designates some window types as typically used for
override redirect windows, it does not prohibit the use of these with
managed windows, so we should not abort if we encounter one of these.

http://bugzilla.gnome.org/show_bug.cgi?id=583870
2009-07-31 19:11:54 +01:00
Owen W. Taylor
239b39cf52 Pass through all scroll events to compositor
As with other events, we want to pass through scroll events (button 4/5 presses)
to the compositor, whether or not they are associated with a particular MetaWindow;
do this by simply falling through to the normal code path instead of
separately delivering the events to the compositor.

http://bugzilla.gnome.org/show_bug.cgi?id=588232
2009-07-31 10:37:26 -04:00
Thomas Wood
1f90529365 Don't explicitly set the size of the MutterWindow texture
Setting the size of the texture causes the minimum and preferred width and
height values to be fixed at the set value. The normal requisition functions
of ClutterTexture will already report the size of the texture pixmap as the
natural size, but also allow scaling down as needed if less space is
available. We don't need that here, but we want to allow someone to make
a ClutterClone of the texture actor.
2009-07-31 13:36:59 +01:00
Colin Walters
acfc498344 Also update Clutter 1.0 pkg-config requirement and README
We need to also change the pkg-config requirement to be 1.0.
2009-07-29 13:04:18 -04:00
Colin Walters
a1ac1f4b2e Build using Clutter 1.0
Clutter just released 1.0, sync to that.
2009-07-29 12:08:53 -04:00
Owen W. Taylor
d91d503eb2 Pass event to clutter when the plugin doesn't have xevent_filter
With recent changes, Clutter no longer sets up the viewport correctly,
unless it receives ConfigureNotify events. If there is a plugin with
an xevent_filter function, then it's that plugins responsibility to pass
the event to Clutter if it doesn't want it. If there is no plugin,
or the plugin doesn't have an xevent_filter function, then we should
call clutter_x11_handle_event() ourselves.

http://bugzilla.gnome.org/show_bug.cgi?id=589419
2009-07-28 16:00:24 -04:00
Owen W. Taylor
e84bf7144c Queue redraws on MutterWindow's MutterShapedTexture
When a windows contents or shape changes, we schedule a redraw
with clutter_actor_queue_redraw(); we need to queue the redraw
on the shaped texture rather than on the window actor to support
cloning of just the shaped texture without the shadow: that
is, the shaped is what is really changing and it may be
visible via a clone even if the MutterWindow itself is not
visible.

http://bugzilla.gnome.org/show_bug.cgi?id=589429
2009-07-28 15:50:28 -04:00
Owen W. Taylor
ec2c197e1f Fix confusion about MetaPreview in introspection build
MetaPreview is only built into libmutter-private, and not included in
the mutter executable. Linking mutter against libmutter-private was
inadvertently added when the introspection build process was set up,
but isn't actually needed, and if -Wl,-as-needed is added during the
build process, then the libmutter-private dependency will be skipped.

* Don't link mutter (or the test programs) against libmutter-private

* Exclude meta-preview.h from the set of headers we feed into the
  introspection build process

Reported by Patryk Zawadzki

http://bugzilla.gnome.org/show_bug.cgi?id=587975
2009-07-17 07:56:19 -04:00
53 changed files with 2764 additions and 3239 deletions

2
README
View File

@@ -20,7 +20,7 @@ libstartup-notification at
http://www.freedesktop.org/software/startup-notification/ or on the
GNOME ftp site. You also need GConf 1.2 (unless building a funky
extra-small embedded metacity with --disable-gconf, see below).
You need Clutter 0.9.3. You need gobject-introspection 0.6.3.
You need Clutter 1.0. You need gobject-introspection 0.6.3.
REPORTING BUGS AND SUBMITTING PATCHES
===

View File

@@ -4,7 +4,7 @@ m4_define([mutter_major_version], [2])
m4_define([mutter_minor_version], [27])
# Fibonacci sequence for micro version numbering:
# 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987
m4_define([mutter_micro_version], [1])
m4_define([mutter_micro_version], [3])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])
@@ -18,6 +18,7 @@ AC_CONFIG_SRCDIR(src/core/display.c)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
AM_MAINTAINER_MODE
MUTTER_MAJOR_VERSION=mutter_major_version
@@ -227,8 +228,8 @@ else
AC_MSG_ERROR([no. Mutter requires the Xcomposite extension to build.])
fi
CLUTTER_VERSION=0.9.3
CLUTTER_PACKAGE=clutter-0.9
CLUTTER_VERSION=1.0.0
CLUTTER_PACKAGE=clutter-1.0
AC_SUBST(CLUTTER_PACKAGE)
if $PKG_CONFIG --atleast-version $CLUTTER_VERSION $CLUTTER_PACKAGE ; then
MUTTER_PC_MODULES="$MUTTER_PC_MODULES $CLUTTER_PACKAGE "
@@ -540,9 +541,10 @@ mutter-$VERSION:
Xcursor: ${have_xcursor}
"
MUTTER_MINOR_VERSION=mutter_minor_version
if test $(( $(echo $MUTTER_MINOR_VERSION) %2)) == "1"; then
stable_version=$(( ($MUTTER_MINOR_VERSION / 2) * 2))
if expr $MUTTER_MINOR_VERSION % 2 > /dev/null ; then
stable_version=`expr $MUTTER_MINOR_VERSION - 1`
echo "This is the UNSTABLE branch of mutter"
echo -n "Use 2.$stable_version.x for stable "
echo "(gnome-2-$stable_version branch in Subversion)"

1567
po/gl.po

File diff suppressed because it is too large Load Diff

1080
po/hu.po

File diff suppressed because it is too large Load Diff

1053
po/nb.po

File diff suppressed because it is too large Load Diff

783
po/sv.po

File diff suppressed because it is too large Load Diff

View File

@@ -147,6 +147,8 @@ libmutter_private_la_LIBADD = @MUTTER_LIBS@
libmutterincludedir = $(includedir)/mutter/mutter-private
# Headers installed for plugins; introspected information will
# be extracted into Mutter-<version>.gir
libmutterinclude_base_headers = \
include/alttabhandler.h \
include/boxes.h \
@@ -154,7 +156,6 @@ libmutterinclude_base_headers = \
include/main.h \
include/util.h \
include/common.h \
ui/preview-widget.h \
ui/theme-parser.h \
ui/theme.h \
include/prefs.h \
@@ -163,6 +164,7 @@ libmutterinclude_base_headers = \
include/compositor.h \
include/compositor-mutter.h \
include/types.h \
include/errors.h \
include/screen.h \
include/display.h \
include/group.h \
@@ -171,7 +173,10 @@ libmutterinclude_base_headers = \
include/mutter-window.h
# Excluded from scanning for introspection but installed
# preview-widget.h: only part of libmutter-private
# atomnames.h: macros cause problems for scanning process
libmutterinclude_extra_headers = \
ui/preview-widget.h \
include/atomnames.h
libmutterinclude_HEADERS = \
@@ -198,7 +203,7 @@ typelib_DATA = Meta-$(api_version).typelib
# We need to strip out the attribute that would point back to libmutter-introspect
# so that libgirepository looks for symbols in the executable instead
Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mutter_SOURCES)
pwd=`pwd` ; \
$(AM_V_GEN) pwd=`pwd` ; \
cd $(srcdir) && \
$(G_IR_SCANNER) \
--namespace=Meta \
@@ -206,8 +211,8 @@ Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mu
--include=GObject-2.0 \
--include=Gdk-2.0 \
--include=Gtk-2.0 \
--include=Clutter-0.9 \
--pkg=clutter-0.9 \
--include=Clutter-1.0 \
--pkg=clutter-1.0 \
--pkg=gtk+-2.0 \
--include=xfixes-4.0 \
--program=$$pwd/mutter \
@@ -217,11 +222,11 @@ Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mu
-o $$pwd/$@
Meta-$(api_version).typelib: $(G_IR_COMPILER) Meta-$(api_version).gir
LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) Meta-$(api_version).gir -o $@
$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) Meta-$(api_version).gir -o $@
endif
EFENCE=
mutter_LDADD=@MUTTER_LIBS@ libmutter-private.la $(EFENCE)
mutter_LDADD=@MUTTER_LIBS@ $(EFENCE)
mutter_LDFLAGS=-export-dynamic
mutter_theme_viewer_LDADD= @MUTTER_LIBS@ libmutter-private.la
@@ -232,9 +237,9 @@ testasyncgetprop_SOURCES=core/async-getprop.h core/async-getprop.c core/testasyn
noinst_PROGRAMS=testboxes testgradient testasyncgetprop
testboxes_LDADD= @MUTTER_LIBS@ libmutter-private.la
testgradient_LDADD= @MUTTER_LIBS@ libmutter-private.la
testasyncgetprop_LDADD= @MUTTER_LIBS@ libmutter-private.la
testboxes_LDADD= @MUTTER_LIBS@
testgradient_LDADD= @MUTTER_LIBS@
testasyncgetprop_LDADD= @MUTTER_LIBS@
@INTLTOOL_DESKTOP_RULE@
@@ -304,7 +309,7 @@ CLEANFILES += $(MUTTER_STAMP_FILES)
mutter-marshal.h: stamp-mutter-marshal.h
@true
stamp-mutter-marshal.h: Makefile mutter-marshal.list
$(GLIB_GENMARSHAL) \
$(AM_V_GEN) $(GLIB_GENMARSHAL) \
--prefix=_mutter_marshal \
--header \
$(srcdir)/mutter-marshal.list > xgen-tmh && \
@@ -313,7 +318,7 @@ stamp-mutter-marshal.h: Makefile mutter-marshal.list
echo timestamp > $(@F)
mutter-marshal.c: Makefile mutter-marshal.list
(echo "#include \"mutter-marshal.h\"" ; \
$(AM_V_GEN) (echo "#include \"mutter-marshal.h\"" ; \
$(GLIB_GENMARSHAL) \
--prefix=_mutter_marshal \
--body \
@@ -324,16 +329,16 @@ mutter-marshal.c: Makefile mutter-marshal.list
mutter-enum-types.h: stamp-mutter-enum-types.h Makefile
@true
stamp-mutter-enum-types.h: $(mutter_source_h) mutter-enum-types.h.in
( cd $(srcdir) && \
$(AM_V_GEN) ( cd $(srcdir) && \
$(GLIB_MKENUMS) \
--template $(srcdir)/mutter-enum-types.h.in \
$(libmutterinclude_base_headers) ) >> xgen-teth && \
(cmp xgen-teth mutter-enum-types.h || cp xgen-teth mutter-enum-types.h) && \
(cmp -s xgen-teth mutter-enum-types.h || cp xgen-teth mutter-enum-types.h) && \
rm -f xgen-teth && \
echo timestamp > $(@F)
mutter-enum-types.c: stamp-mutter-enum-types.h mutter-enum-types.c.in
( cd $(srcdir) && \
$(AM_V_GEN) ( cd $(srcdir) && \
$(GLIB_MKENUMS) \
--template $(srcdir)/mutter-enum-types.c.in \
$(libmutterinclude_base_headers) ) >> xgen-tetc && \

View File

@@ -23,6 +23,8 @@ struct _MetaCompositor
ClutterActor *shadow_src;
MutterPlugin *modal_plugin;
gboolean show_redraw : 1;
gboolean debug : 1;
gboolean no_mipmaps : 1;
@@ -51,4 +53,16 @@ void mutter_set_stage_input_region (MetaScreen *screen,
XserverRegion region);
void mutter_empty_stage_input_region (MetaScreen *screen);
gboolean mutter_begin_modal_for_plugin (MetaScreen *screen,
MutterPlugin *plugin,
Window grab_window,
Cursor cursor,
MetaModalOptions options,
guint32 timestamp);
void mutter_end_modal_for_plugin (MetaScreen *screen,
MutterPlugin *plugin,
guint32 timestamp);
void mutter_check_end_modal (MetaScreen *screen);
#endif /* META_COMPOSITOR_PRIVATE_H */

View File

@@ -350,6 +350,117 @@ mutter_empty_stage_input_region (MetaScreen *screen)
mutter_set_stage_input_region (screen, region);
}
gboolean
mutter_begin_modal_for_plugin (MetaScreen *screen,
MutterPlugin *plugin,
Window grab_window,
Cursor cursor,
MetaModalOptions options,
guint32 timestamp)
{
/* To some extent this duplicates code in meta_display_begin_grab_op(), but there
* are significant differences in how we handle grabs that make it difficult to
* merge the two.
*/
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdpy = meta_display_get_xdisplay (display);
MetaCompositor *compositor = display->compositor;
gboolean pointer_grabbed = FALSE;
gboolean keyboard_grabbed = FALSE;
int result;
if (compositor->modal_plugin != NULL || display->grab_op != META_GRAB_OP_NONE)
return FALSE;
if ((options & META_MODAL_POINTER_ALREADY_GRABBED) == 0)
{
result = XGrabPointer (xdpy, grab_window,
False, /* owner_events */
(ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask | PointerMotionMask),
GrabModeAsync, GrabModeAsync,
None, /* confine to */
cursor,
timestamp);
if (result != Success)
goto fail;
pointer_grabbed = TRUE;
}
if ((options & META_MODAL_KEYBOARD_ALREADY_GRABBED) == 0)
{
XGrabKeyboard (xdpy, grab_window,
False, /* owner_events */
GrabModeAsync, GrabModeAsync,
timestamp);
if (result != Success)
goto fail;
keyboard_grabbed = TRUE;
}
display->grab_op = META_GRAB_OP_COMPOSITOR;
display->grab_window = NULL;
display->grab_screen = screen;
display->grab_have_pointer = TRUE;
display->grab_have_keyboard = TRUE;
compositor->modal_plugin = plugin;
return TRUE;
fail:
if (pointer_grabbed)
XUngrabPointer (xdpy, timestamp);
if (keyboard_grabbed)
XUngrabKeyboard (xdpy, timestamp);
return FALSE;
}
void
mutter_end_modal_for_plugin (MetaScreen *screen,
MutterPlugin *plugin,
guint32 timestamp)
{
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdpy = meta_display_get_xdisplay (display);
MetaCompositor *compositor = display->compositor;
g_return_if_fail (compositor->modal_plugin == plugin);
XUngrabPointer (xdpy, timestamp);
XUngrabKeyboard (xdpy, timestamp);
display->grab_op = META_GRAB_OP_NONE;
display->grab_window = NULL;
display->grab_screen = NULL;
display->grab_have_pointer = FALSE;
display->grab_have_keyboard = FALSE;
compositor->modal_plugin = NULL;
}
/* This is used when reloading plugins to make sure we don't have
* a left-over modal grab for this screen.
*/
void
mutter_check_end_modal (MetaScreen *screen)
{
MetaDisplay *display = meta_screen_get_display (screen);
MetaCompositor *compositor = display->compositor;
if (compositor->modal_plugin &&
mutter_plugin_get_screen (compositor->modal_plugin) == screen)
{
mutter_end_modal_for_plugin (screen,
compositor->modal_plugin,
CurrentTime);
}
}
void
meta_compositor_manage_screen (MetaCompositor *compositor,
MetaScreen *screen)
@@ -513,11 +624,41 @@ meta_compositor_set_updates (MetaCompositor *compositor,
{
}
static gboolean
is_grabbed_event (XEvent *event)
{
switch (event->xany.type)
{
case ButtonPress:
case ButtonRelease:
case EnterNotify:
case LeaveNotify:
case MotionNotify:
case KeyPressMask:
case KeyReleaseMask:
return TRUE;
}
return FALSE;
}
gboolean
meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
MetaWindow *window)
{
if (compositor->modal_plugin && is_grabbed_event (event))
{
MutterPluginClass *klass = MUTTER_PLUGIN_GET_CLASS (compositor->modal_plugin);
if (klass->xevent_filter)
klass->xevent_filter (compositor->modal_plugin, event);
/* We always consume events even if the plugin says it didn't handle them;
* exclusive is exclusive */
return TRUE;
}
if (window)
{
MetaCompScreen *info;

View File

@@ -22,14 +22,18 @@
*/
#include "config.h"
#include "compositor-private.h"
#include "mutter-plugin-manager.h"
#include "prefs.h"
#include "errors.h"
#include "workspace.h"
#include "mutter-module.h"
#include "../core/window-private.h"
#include <string.h>
#include <clutter/x11/clutter-x11.h>
/*
* There is only one instace of each module per the process.
*/
@@ -337,6 +341,10 @@ mutter_plugin_manager_reload (MutterPluginManager *plugin_mgr)
* plugins to unload? We are probably not going to have large numbers of
* plugins loaded at the same time, so it might not be worth it.
*/
/* Prevent stale grabs on unloaded plugins */
mutter_check_end_modal (plugin_mgr->screen);
mutter_plugin_manager_unload (plugin_mgr);
return mutter_plugin_manager_load (plugin_mgr);
}
@@ -399,6 +407,10 @@ mutter_plugin_manager_event_simple (MutterPluginManager *plugin_mgr,
{
GList *l = plugin_mgr->plugins;
gboolean retval = FALSE;
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
if (display->display_opening)
return FALSE;
while (l)
{
@@ -474,6 +486,10 @@ mutter_plugin_manager_event_maximize (MutterPluginManager *plugin_mgr,
{
GList *l = plugin_mgr->plugins;
gboolean retval = FALSE;
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
if (display->display_opening)
return FALSE;
while (l)
{
@@ -543,6 +559,10 @@ mutter_plugin_manager_switch_workspace (MutterPluginManager *plugin_mgr,
{
GList *l = plugin_mgr->plugins;
gboolean retval = FALSE;
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
if (display->display_opening)
return FALSE;
while (l)
{
@@ -585,12 +605,31 @@ mutter_plugin_manager_xevent_filter (MutterPluginManager *plugin_mgr,
XEvent *xev)
{
GList *l;
gboolean have_plugin_xevent_func;
if (!plugin_mgr)
return FALSE;
l = plugin_mgr->plugins;
/* We need to make sure that clutter gets certain events, like
* ConfigureNotify on the stage window. If there is a plugin that
* provides an xevent_filter function, then it's the responsibility
* of that plugin to pass events to Clutter. Otherwise, we send the
* event directly to Clutter ourselves.
*
* What happens if there are two plugins with xevent_filter functions
* is undefined; in general, multiple competing plugins are something
* we don't support well or care much about.
*
* FIXME: Really, we should just always handle sending the event to
* clutter if a plugin doesn't report the event as handled by
* returning TRUE, but it doesn't seem worth breaking compatibility
* of the plugin interface right now to achieve this; the way it is
* now works fine in practice.
*/
have_plugin_xevent_func = FALSE;
while (l)
{
MutterPlugin *plugin = l->data;
@@ -598,6 +637,7 @@ mutter_plugin_manager_xevent_filter (MutterPluginManager *plugin_mgr,
if (klass->xevent_filter)
{
have_plugin_xevent_func = TRUE;
if (klass->xevent_filter (plugin, xev) == TRUE)
return TRUE;
}
@@ -605,5 +645,8 @@ mutter_plugin_manager_xevent_filter (MutterPluginManager *plugin_mgr,
l = l->next;
}
if (!have_plugin_xevent_func)
return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
return FALSE;
}

View File

@@ -467,6 +467,64 @@ mutter_plugin_get_windows (MutterPlugin *plugin)
return mutter_get_windows (priv->screen);
}
/**
* mutter_plugin_begin_modal:
* @plugin: a #MutterPlugin
* @grab_window: the X window to grab the keyboard and mouse on
* @cursor: the cursor to use for the pointer grab, or None,
* to use the normal cursor for the grab window and
* its descendants.
* @options: flags that modify the behavior of the modal grab
* @timestamp: the timestamp used for establishing grabs
*
* This function is used to grab the keyboard and mouse for the exclusive
* use of the plugin. Correct operation requires that both the keyboard
* and mouse are grabbed, or thing will break. (In particular, other
* passive X grabs in Mutter can trigger but not be handled by the normal
* keybinding handling code.) However, the plugin can establish the keyboard
* and/or mouse grabs ahead of time and pass in the
* %META_MODAL_POINTER_ALREADY_GRABBED and/or %META_MODAL_KEYBOARD_ALREADY_GRABBED
* options. This facility is provided for two reasons: first to allow using
* this function to establish modality after a passive grab, and second to
* allow using obscure features of XGrabPointer() and XGrabKeyboard() without
* having to add them to this API.
*
* Return value: whether we successfully grabbed the keyboard and
* mouse and made the plugin modal.
*/
gboolean
mutter_plugin_begin_modal (MutterPlugin *plugin,
Window grab_window,
Cursor cursor,
MetaModalOptions options,
guint32 timestamp)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
return mutter_begin_modal_for_plugin (priv->screen, plugin,
grab_window, cursor, options, timestamp);
}
/**
* mutter_plugin_end_modal
* @plugin: a #MutterPlugin
* @timestamp: the time used for releasing grabs
*
* Ends the modal operation begun with meta_plugin_begin_modal(). This
* ungrabs both the mouse and keyboard even when
* %META_MODAL_POINTER_ALREADY_GRABBED or
* %META_MODAL_KEYBOARD_ALREADY_GRABBED were provided as options
* when beginnning the modal operation.
*/
void
mutter_plugin_end_modal (MutterPlugin *plugin,
guint32 timestamp)
{
MutterPluginPrivate *priv = MUTTER_PLUGIN (plugin)->priv;
mutter_end_modal_for_plugin (priv->screen, plugin, timestamp);
}
Display *
mutter_plugin_get_xdisplay (MutterPlugin *plugin)
{

View File

@@ -274,7 +274,7 @@ mutter_shaped_texture_paint (ClutterActor *actor)
tex_width = cogl_texture_get_width (paint_tex);
tex_height = cogl_texture_get_height (paint_tex);
if (tex_width == 0 || tex_width == 0) /* no contents yet */
if (tex_width == 0 || tex_height == 0) /* no contents yet */
return;
if (paint_tex == COGL_INVALID_HANDLE)
@@ -419,8 +419,8 @@ mutter_shaped_texture_pick (ClutterActor *actor,
tex_width = cogl_texture_get_width (paint_tex);
tex_height = cogl_texture_get_height (paint_tex);
if (tex_width == 0 || tex_width == 0) /* no contents yet */
return;
if (tex_width == 0 || tex_height == 0) /* no contents yet */
return;
mutter_shaped_texture_ensure_mask (stex);

View File

@@ -136,7 +136,7 @@ mutter_window_group_paint (ClutterActor *actor)
mutter_window_set_visible_region (cw, visible_region);
if (clutter_actor_get_paint_opacity (actor) == 0xff)
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (cw)) == 0xff)
{
GdkRegion *obscured_region = mutter_window_get_obscured_region (cw);
if (obscured_region)

View File

@@ -10,7 +10,6 @@
#include <clutter/x11/clutter-x11.h>
#include "../core/window-private.h" /* FIXME: add meta_window_is_override_redirect */
#include "display.h"
#include "errors.h"
#include "frame.h"
@@ -362,6 +361,15 @@ mutter_window_constructed (GObject *object)
clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->actor);
/*
* Since we are holding a pointer to this actor independently of the
* ClutterContainer internals, and provide a public API to access it,
* add a reference here, so that if someone is messing about with us
* via the container interface, we do not end up with a dangling pointer.
* We will release it in dispose().
*/
g_object_ref (priv->actor);
g_signal_connect (priv->window, "notify::decorated",
G_CALLBACK (mutter_meta_window_decorated_notify), self);
}
@@ -415,7 +423,11 @@ mutter_window_dispose (GObject *object)
info->windows = g_list_remove (info->windows, (gconstpointer) self);
g_hash_table_remove (info->windows_by_xid, (gpointer) priv->xwindow);
g_free (priv->desc);
/*
* Release the extra reference we took on the actor.
*/
g_object_unref (priv->actor);
priv->actor = NULL;
G_OBJECT_CLASS (mutter_window_parent_class)->dispose (object);
}
@@ -423,6 +435,11 @@ mutter_window_dispose (GObject *object)
static void
mutter_window_finalize (GObject *object)
{
MutterWindow *self = MUTTER_WINDOW (object);
MutterWindowPrivate *priv = self->priv;
g_free (priv->desc);
G_OBJECT_CLASS (mutter_window_parent_class)->finalize (object);
}
@@ -683,10 +700,7 @@ mutter_window_get_window_type (MutterWindow *self)
gboolean
mutter_window_is_override_redirect (MutterWindow *self)
{
if (self->priv->window->override_redirect)
return TRUE;
return FALSE;
return meta_window_is_override_redirect (self->priv->window);
}
const char *mutter_window_get_description (MutterWindow *self)
@@ -768,7 +782,7 @@ mutter_window_mark_for_repair (MutterWindow *self)
*
* The compositor paint function repairs all windows.
*/
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (priv->actor);
}
static gboolean
@@ -829,11 +843,11 @@ mutter_window_after_effects (MutterWindow *self)
mutter_window_sync_visibility (self);
mutter_window_sync_actor_position (self);
if (!priv->window->mapped)
if (!meta_window_is_mapped (priv->window))
mutter_window_detach (self);
if (priv->needs_repair)
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (priv->actor);
}
void
@@ -1168,7 +1182,7 @@ mutter_window_new (MetaWindow *window)
/* FIXME: Remove the redundant data we store in self->priv->attrs, and
* simply query metacity core for the data. */
if (!XGetWindowAttributes (display->xdisplay, top_window, &attrs))
if (!XGetWindowAttributes (meta_display_get_xdisplay (display), top_window, &attrs))
return NULL;
self = g_object_new (MUTTER_TYPE_COMP_WINDOW,
@@ -1512,8 +1526,6 @@ check_needs_repair (MutterWindow *self)
"pixmap-height", &pxm_height,
NULL);
clutter_actor_set_size (priv->actor, pxm_width, pxm_height);
if (priv->shadow)
clutter_actor_set_size (priv->shadow, pxm_width, pxm_height);
@@ -1620,7 +1632,7 @@ check_needs_reshape (MutterWindow *self)
#ifdef HAVE_SHAPE
if (priv->shaped)
{
Display *xdisplay = meta_display_get_xdisplay (priv->window->display);
Display *xdisplay = meta_display_get_xdisplay (meta_window_get_display (priv->window));
XRectangle *rects;
int n_rects, ordering;
@@ -1654,7 +1666,7 @@ mutter_window_update_shape (MutterWindow *self,
priv->shaped = shaped;
priv->needs_reshape = TRUE;
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
clutter_actor_queue_redraw (priv->actor);
}
void

View File

@@ -700,8 +700,17 @@ get_size_limits (const MetaWindow *window,
min_size->width += fw;
min_size->height += fh;
max_size->width += fw;
max_size->height += fh;
/* Do check to avoid overflow (e.g. max_size->width & max_size->height
* may be set to G_MAXINT by meta_set_normal_hints()).
*/
if (max_size->width < (G_MAXINT - fw))
max_size->width += fw;
else
max_size->width = G_MAXINT;
if (max_size->height < (G_MAXINT - fh))
max_size->height += fh;
else
max_size->height = G_MAXINT;
}
}

View File

@@ -348,9 +348,6 @@ void meta_display_register_x_window (MetaDisplay *display,
MetaWindow *window);
void meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow);
/* Return whether the xwindow is a no focus window for any of the screens */
gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
Window xwindow);
GSList* meta_display_list_windows (MetaDisplay *display,
MetaListWindowsFlags flags);

View File

@@ -128,9 +128,16 @@ G_DEFINE_TYPE(MetaDisplay, meta_display, G_TYPE_OBJECT);
enum
{
OVERLAY_KEY,
FOCUS_WINDOW,
LAST_SIGNAL
};
enum {
PROP_0,
PROP_FOCUS_WINDOW
};
static guint display_signals [LAST_SIGNAL] = { 0 };
/**
@@ -169,9 +176,47 @@ static void sanity_check_timestamps (MetaDisplay *display,
MetaGroup* get_focussed_group (MetaDisplay *display);
static void
meta_display_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaDisplay *display = META_DISPLAY (object);
switch (prop_id)
{
case PROP_FOCUS_WINDOW:
g_value_set_object (value, display->focus_window);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_display_set_property(GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_display_class_init (MetaDisplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = meta_display_get_property;
object_class->set_property = meta_display_set_property;
display_signals[OVERLAY_KEY] =
g_signal_new ("overlay-key",
G_TYPE_FROM_CLASS (klass),
@@ -179,9 +224,18 @@ meta_display_class_init (MetaDisplayClass *klass)
0,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
G_TYPE_NONE, 0);
g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window",
"Focus window",
"Currently focused window",
META_TYPE_WINDOW,
G_PARAM_READABLE));
}
/**
* Destructor for MetaPingData structs. Will destroy the
* event source for the struct as well.
@@ -953,6 +1007,7 @@ meta_display_close (MetaDisplay *display,
meta_compositor_destroy (display->compositor);
g_object_unref (display);
the_display = NULL;
meta_quit (META_EXIT_SUCCESS);
}
@@ -1144,6 +1199,7 @@ grab_op_is_mouse (MetaGrabOp op)
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
case META_GRAB_OP_KEYBOARD_MOVING:
case META_GRAB_OP_COMPOSITOR:
return TRUE;
default:
@@ -1173,6 +1229,7 @@ grab_op_is_keyboard (MetaGrabOp op)
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
case META_GRAB_OP_KEYBOARD_ESCAPING_GROUP:
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
case META_GRAB_OP_COMPOSITOR:
return TRUE;
default:
@@ -1454,6 +1511,7 @@ event_callback (XEvent *event,
MetaDisplay *display;
Window modified;
gboolean frame_was_receiver;
gboolean bypass_compositor;
gboolean filter_out_event;
display = data;
@@ -1467,6 +1525,7 @@ event_callback (XEvent *event,
sn_display_process_event (display->sn_display, event);
#endif
bypass_compositor = FALSE;
filter_out_event = FALSE;
display->current_time = event_get_time (display, event);
display->xinerama_cache_invalidated = TRUE;
@@ -1613,21 +1672,26 @@ event_callback (XEvent *event,
{
case KeyPress:
case KeyRelease:
meta_display_process_key_event (display, window, event);
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break;
/* For key events, it's important to enforce single-handling, or
* we can get into a confused state. So if a keybinding is
* handled (because it's one of our hot-keys, or because we are
* in a keyboard-grabbed mode like moving a window, we don't
* want to pass the key event to the compositor at all.
*/
bypass_compositor = meta_display_process_key_event (display, window, event);
break;
case ButtonPress:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break;
if (event->xbutton.button == 4 || event->xbutton.button == 5)
{
if (display->compositor && window)
{
return meta_compositor_process_event (display->compositor,
event,
window);
}
else
return FALSE;
}
else if ((window &&
/* Scrollwheel event, do nothing and deliver event to compositor below */
break;
if ((window &&
grab_op_is_mouse (display->grab_op) &&
display->grab_button != (int) event->xbutton.button &&
display->grab_window == window) ||
@@ -1817,16 +1881,25 @@ event_callback (XEvent *event,
}
break;
case ButtonRelease:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break;
if (display->grab_window == window &&
grab_op_is_mouse (display->grab_op))
meta_window_handle_mouse_grab_op_event (window, event);
break;
case MotionNotify:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break;
if (display->grab_window == window &&
grab_op_is_mouse (display->grab_op))
meta_window_handle_mouse_grab_op_event (window, event);
break;
case EnterNotify:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break;
if (display->grab_window == window &&
grab_op_is_mouse (display->grab_op))
{
@@ -1919,6 +1992,9 @@ event_callback (XEvent *event,
}
break;
case LeaveNotify:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
break;
if (display->grab_window == window &&
grab_op_is_mouse (display->grab_op))
meta_window_handle_mouse_grab_op_event (window, event);
@@ -2485,7 +2561,7 @@ event_callback (XEvent *event,
break;
}
if (display->compositor)
if (display->compositor && !bypass_compositor)
{
if (meta_compositor_process_event (display->compositor,
event,
@@ -3127,6 +3203,15 @@ meta_display_unregister_x_window (MetaDisplay *display,
remove_pending_pings_for_window (display, xwindow);
}
/**
* meta_display_xwindow_is_a_no_focus_window:
* @display: A #MetaDisplay
* @xwindow: An X11 window
*
* Returns %TRUE iff window is one of mutter's internal "no focus" windows
* (there is one per screen) which will have the focus when there is no
* actual client window focused.
*/
gboolean
meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
Window xwindow)
@@ -3640,6 +3725,21 @@ meta_display_end_grab_op (MetaDisplay *display,
}
}
/**
* meta_display_get_grab_op:
* Gets the current grab operation, if any.
*
* Return value: the current grab operation, or %META_GRAB_OP_NONE if
* Mutter doesn't currently have a grab. %META_GRAB_OP_COMPOSITOR will
* be returned if a compositor-plugin modal operation is in effect
* (See mutter_begin_modal_for_plugin())
*/
MetaGrabOp
meta_display_get_grab_op (MetaDisplay *display)
{
return display->grab_op;
}
void
meta_display_check_threshold_reached (MetaDisplay *display,
int x,
@@ -4481,7 +4581,7 @@ meta_display_get_tab_next (MetaDisplay *display,
else
{
skip = display->focus_window != NULL &&
IN_TAB_CHAIN (display->focus_window, type);
tab_list->data == display->focus_window;
if (backward)
ret = find_tab_backward (display, type, screen, workspace,
tab_list, skip);

View File

@@ -844,7 +844,7 @@ cache_edges (MetaDisplay *display,
* 2nd: Allocate the edges
*/
g_assert (display->grab_edge_resistance_data == NULL);
display->grab_edge_resistance_data = g_new (MetaEdgeResistanceData, 1);
display->grab_edge_resistance_data = g_new0 (MetaEdgeResistanceData, 1);
edge_data = display->grab_edge_resistance_data;
edge_data->left_edges = g_array_sized_new (FALSE,
FALSE,

View File

@@ -40,31 +40,6 @@ meta_errors_init (void)
XSetIOErrorHandler (x_io_error_handler);
}
typedef struct ForeignDisplay ForeignDisplay;
struct ForeignDisplay
{
Display *dpy;
ErrorHandler handler;
gpointer data;
ForeignDisplay *next;
};
static ForeignDisplay *foreign_displays;
void
meta_errors_register_foreign_display (Display *foreign_dpy,
ErrorHandler handler,
gpointer data)
{
ForeignDisplay *info = g_new0 (ForeignDisplay, 1);
info->dpy = foreign_dpy;
info->handler = handler;
info->data = data;
info->next = foreign_displays;
foreign_displays = info;
}
static void
meta_error_trap_push_internal (MetaDisplay *display,
gboolean need_sync)
@@ -206,18 +181,7 @@ x_error_handler (Display *xdisplay,
int retval;
gchar buf[64];
MetaDisplay *display;
ForeignDisplay *foreign;
for (foreign = foreign_displays; foreign != NULL; foreign = foreign->next)
{
if (foreign->dpy == xdisplay)
{
foreign->handler (xdisplay, error, foreign->data);
return 0;
}
}
XGetErrorText (xdisplay, error->error_code, buf, 63);
display = meta_display_for_x_display (xdisplay);

View File

@@ -45,7 +45,7 @@ gboolean meta_window_grab_all_keys (MetaWindow *window,
guint32 timestamp);
void meta_window_ungrab_all_keys (MetaWindow *window,
guint32 timestamp);
void meta_display_process_key_event (MetaDisplay *display,
gboolean meta_display_process_key_event (MetaDisplay *display,
MetaWindow *window,
XEvent *event);
void meta_set_keybindings_disabled (gboolean setting);

View File

@@ -475,11 +475,11 @@ regrab_key_bindings (MetaDisplay *display)
g_slist_free (windows);
}
static MetaKeyBindingAction
display_get_keybinding_action (MetaDisplay *display,
unsigned int keysym,
unsigned int keycode,
unsigned long mask)
static MetaKeyBinding *
display_get_keybinding (MetaDisplay *display,
unsigned int keysym,
unsigned int keycode,
unsigned long mask)
{
int i;
@@ -490,13 +490,29 @@ display_get_keybinding_action (MetaDisplay *display,
display->key_bindings[i].keycode == keycode &&
display->key_bindings[i].mask == mask)
{
return meta_prefs_get_keybinding_action (display->key_bindings[i].name);
return &display->key_bindings[i];
}
--i;
}
return META_KEYBINDING_ACTION_NONE;
return NULL;
}
static MetaKeyBindingAction
display_get_keybinding_action (MetaDisplay *display,
unsigned int keysym,
unsigned int keycode,
unsigned long mask)
{
MetaKeyBinding *binding;
binding = display_get_keybinding (display, keysym, keycode, mask);
if (binding)
return meta_prefs_get_keybinding_action (binding->name);
else
return META_KEYBINDING_ACTION_NONE;
}
void
@@ -1197,6 +1213,45 @@ process_overlay_key (MetaDisplay *display,
return TRUE;
}
static void
invoke_handler (MetaDisplay *display,
MetaScreen *screen,
MetaKeyHandler *handler,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding)
{
if (handler->func)
(* handler->func) (display, screen,
handler->flags & BINDING_PER_WINDOW ?
window : NULL,
event,
binding,
handler->user_data);
else
(* handler->default_func) (display, screen,
handler->flags & BINDING_PER_WINDOW ?
window: NULL,
event,
binding,
NULL);
}
static void
invoke_handler_by_name (MetaDisplay *display,
MetaScreen *screen,
const char *handler_name,
MetaWindow *window,
XEvent *event)
{
MetaKeyHandler *handler;
handler = find_handler (key_handlers, handler_name);
if (handler)
invoke_handler (display, screen, handler, window, event, NULL);
}
/* now called from only one place, may be worth merging */
static gboolean
process_event (MetaKeyBinding *bindings,
@@ -1253,20 +1308,7 @@ process_event (MetaKeyBinding *bindings,
*/
display->allow_terminal_deactivation = TRUE;
if (handler->func)
(* handler->func) (display, screen,
bindings[i].handler->flags & BINDING_PER_WINDOW ?
window: NULL,
event,
&bindings[i],
handler->user_data);
else
(* handler->default_func) (display, screen,
bindings[i].handler->flags & BINDING_PER_WINDOW ?
window: NULL,
event,
&bindings[i],
NULL);
invoke_handler (display, screen, handler, window, event, &bindings[i]);
return TRUE;
}
@@ -1281,13 +1323,16 @@ process_event (MetaKeyBinding *bindings,
* right. This cannot cause infinite recursion because we never call
* ourselves when there wasn't a grab, and we always clear the grab
* first; the invariant is enforced using an assertion. See #112560.
*
* The return value is whether we handled the key event.
*
* FIXME: We need to prove there are no race conditions here.
* FIXME: Does it correctly handle alt-Tab being followed by another
* grabbing keypress without letting go of alt?
* FIXME: An iterative solution would probably be simpler to understand
* (and help us solve the other fixmes).
*/
void
gboolean
meta_display_process_key_event (MetaDisplay *display,
MetaWindow *window,
XEvent *event)
@@ -1303,7 +1348,7 @@ meta_display_process_key_event (MetaDisplay *display,
all_bindings_disabled ? ReplayKeyboard : AsyncKeyboard,
event->xkey.time);
if (all_bindings_disabled)
return;
return FALSE;
/* if key event was on root window, we have a shortcut */
screen = meta_display_screen_for_root (display, event->xkey.window);
@@ -1314,12 +1359,12 @@ meta_display_process_key_event (MetaDisplay *display,
event->xany.window);
if (screen == NULL)
return; /* event window is destroyed */
return FALSE; /* event window is destroyed */
/* ignore key events on popup menus and such. */
if (window == NULL &&
meta_ui_window_is_widget (screen->ui, event->xany.window))
return;
return FALSE;
/* window may be NULL */
@@ -1339,7 +1384,7 @@ meta_display_process_key_event (MetaDisplay *display,
if (all_keys_grabbed)
{
if (display->grab_op == META_GRAB_OP_NONE)
return;
return TRUE;
/* If we get here we have a global grab, because
* we're in some special keyboard mode such as window move
* mode.
@@ -1416,18 +1461,20 @@ meta_display_process_key_event (MetaDisplay *display,
"Ending grab op %u on key event sym %s\n",
display->grab_op, XKeysymToString (keysym));
meta_display_end_grab_op (display, event->xkey.time);
return;
}
}
return TRUE;
}
handled = process_overlay_key (display, screen, event, keysym);
if (handled)
return TRUE;
/* Do the normal keybindings */
if (!handled)
process_event (display->key_bindings,
display->n_key_bindings,
display, screen, window, event, keysym,
!all_keys_grabbed && window);
return process_event (display->key_bindings,
display->n_key_bindings,
display, screen, window, event, keysym,
!all_keys_grabbed && window);
}
static gboolean
@@ -1980,6 +2027,7 @@ process_tab_grab (MetaDisplay *display,
XEvent *event,
KeySym keysym)
{
MetaKeyBinding *binding;
MetaKeyBindingAction action;
gboolean popup_not_showing;
gboolean backward;
@@ -1989,79 +2037,78 @@ process_tab_grab (MetaDisplay *display,
if (screen != display->grab_screen)
return FALSE;
action = display_get_keybinding_action (display,
keysym,
event->xkey.keycode,
display->grab_mask);
binding = display_get_keybinding (display,
keysym,
event->xkey.keycode,
display->grab_mask);
if (binding)
action = meta_prefs_get_keybinding_action (binding->name);
else
action = META_KEYBINDING_ACTION_NONE;
/*
* If there is no tab_pop up object, i.e., there is some custom handler
* implementing Alt+Tab & Co., we call this custom handler; we do not
* mess about with the grab, as that is up to the handler to deal with.
* There are currently two different ways of customizing Alt-Tab, you can either
* provide a replacement AltTabHandler object, or you can hook into the keybindings
* meta_keybindings_set_custom_handler() and call meta_display_begin_grab_op()
* yourself with one of the "tabbing" grab ops META_GRAB_OP_KEYBOARD_TABBING_NORMAL,
* etc. See meta_display_process_key_event() for the complete list. If screen->tab_handler
* is NULL, the latter mechanism is being used. We skip most of our normal
* processing and just make sure that the right custom handlers get called.
*/
if (!screen->tab_handler)
{
MetaKeyHandler *handler = NULL;
const gchar *handler_name = NULL;
if (event->type == KeyRelease)
{
if (end_keyboard_grab (display, event->xkey.keycode))
{
invoke_handler_by_name (display, screen, "tab_popup_select", NULL, event);
/* We return FALSE to end the grab; if the handler ended the grab itself
* that will be a noop. If the handler didn't end the grab, then it's a
* safety measure to prevent a stuck grab.
*/
return FALSE;
}
return TRUE;
}
switch (action)
{
case META_KEYBINDING_ACTION_CYCLE_PANELS:
handler_name = "cycle_group";
break;
case META_KEYBINDING_ACTION_CYCLE_WINDOWS:
handler_name = "cycle_windows";
break;
case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD:
handler_name = "cycle_panels_backward";
break;
case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD:
handler_name = "cycle_windows_backward";
break;
case META_KEYBINDING_ACTION_SWITCH_PANELS:
handler_name = "switch_panels";
break;
case META_KEYBINDING_ACTION_SWITCH_WINDOWS:
handler_name = "switch_windows";
break;
case META_KEYBINDING_ACTION_SWITCH_PANELS_BACKWARD:
handler_name = "switch_panels_backward";
break;
case META_KEYBINDING_ACTION_SWITCH_WINDOWS_BACKWARD:
handler_name = "switch_windows_backward";
break;
case META_KEYBINDING_ACTION_CYCLE_GROUP:
handler_name = "cycle_group";
break;
case META_KEYBINDING_ACTION_CYCLE_GROUP_BACKWARD:
handler_name = "cycle_group_backward";
break;
case META_KEYBINDING_ACTION_SWITCH_GROUP:
handler_name = "switch_group";
break;
case META_KEYBINDING_ACTION_SWITCH_GROUP_BACKWARD:
handler_name = "switch_group_backward";
/* These are the tab-popup bindings. If a custom Alt-Tab implementation
* is in effect, we expect it to want to handle all of these as a group
*
* If there are some of them that the custom implementation didn't
* handle, we treat them as "unbound" for the duration - running the
* normal handlers could get us into trouble.
*/
if (binding->handler &&
binding->handler->func &&
binding->handler->func != binding->handler->default_func)
{
invoke_handler (display, screen, binding->handler, NULL, event, binding);
return TRUE;
}
break;
default:
/*
* This is the case when the Alt key is released; we preserve
* the grab, as it is up to the custom implementaiton to free it
* (a plugin can catch this in their xevent_filter function).
*/
return TRUE;
break;
}
/*
* We do not want to actually call the handler, we just want to ensure
* that if a custom handler is installed, we do not release the grab here.
* The handler will get called as normal in the process_event() function.
*/
handler = find_handler (key_handlers, handler_name);
if (!handler || !handler->func || handler->func == handler->default_func)
return FALSE;
return TRUE;
/* Some unhandled key press */
invoke_handler_by_name (display, screen, "tab_popup_cancel", NULL, event);
return FALSE;
}
if (event->type == KeyRelease &&
@@ -3043,6 +3090,27 @@ handle_cycle (MetaDisplay *display,
backwards, FALSE);
}
static void
handle_tab_popup_select (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
/* Stub for custom handlers; no default implementation */
}
static void
handle_tab_popup_cancel (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
/* Stub for custom handlers; no default implementation */
}
static void
handle_toggle_fullscreen (MetaDisplay *display,

View File

@@ -427,8 +427,11 @@ meta_select_display (gchar *display_name)
static void
meta_finalize (void)
{
meta_display_close (meta_get_display (),
CurrentTime); /* I doubt correct timestamps matter here */
MetaDisplay *display = meta_get_display ();
if (display)
meta_display_close (display,
CurrentTime); /* I doubt correct timestamps matter here */
meta_session_shutdown ();
}

View File

@@ -85,6 +85,7 @@ enum
WORKSPACE_ADDED,
WORKSPACE_REMOVED,
WORKSPACE_SWITCHED,
STARTUP_SEQUENCE_CHANGED,
LAST_SIGNAL
};
@@ -199,6 +200,15 @@ meta_screen_class_init (MetaScreenClass *klass)
G_TYPE_INT,
MUTTER_TYPE_MOTION_DIRECTION);
screen_signals[STARTUP_SEQUENCE_CHANGED] =
g_signal_new ("startup-sequence-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
screen_signals[TOGGLE_RECORDING] =
g_signal_new ("toggle-recording",
G_TYPE_FROM_CLASS (klass),
@@ -317,9 +327,28 @@ reload_xinerama_infos (MetaScreen *screen)
screen->last_xinerama_index = 0;
screen->display->xinerama_cache_invalidated = TRUE;
if (g_getenv ("MUTTER_DEBUG_XINERAMA"))
{
meta_topic (META_DEBUG_XINERAMA,
"Pretending a single monitor has two Xinerama screens\n");
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 2);
screen->n_xinerama_infos = 2;
screen->xinerama_infos[0].number = 0;
screen->xinerama_infos[0].rect = screen->rect;
screen->xinerama_infos[0].rect.width = screen->rect.width / 2;
screen->xinerama_infos[1].number = 1;
screen->xinerama_infos[1].rect = screen->rect;
screen->xinerama_infos[1].rect.x = screen->rect.width / 2;
screen->xinerama_infos[1].rect.width = screen->rect.width / 2;
}
#ifdef HAVE_XFREE_XINERAMA
if (XineramaIsActive (display->xdisplay))
if (screen->n_xinerama_infos == 0 &&
XineramaIsActive (display->xdisplay))
{
XineramaScreenInfo *infos;
int n_infos;
@@ -360,7 +389,7 @@ reload_xinerama_infos (MetaScreen *screen)
meta_XFree (infos);
}
else
else if (screen->n_xinerama_infos > 0)
{
meta_topic (META_DEBUG_XINERAMA,
"No XFree86 Xinerama extension or XFree86 Xinerama inactive on display %s\n",
@@ -436,34 +465,14 @@ reload_xinerama_infos (MetaScreen *screen)
*/
if (screen->n_xinerama_infos == 0)
{
if (g_getenv ("MUTTER_DEBUG_XINERAMA"))
{
meta_topic (META_DEBUG_XINERAMA,
"Pretending a single monitor has two Xinerama screens\n");
meta_topic (META_DEBUG_XINERAMA,
"No Xinerama screens, using default screen info\n");
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 2);
screen->n_xinerama_infos = 2;
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 1);
screen->n_xinerama_infos = 1;
screen->xinerama_infos[0].number = 0;
screen->xinerama_infos[0].rect = screen->rect;
screen->xinerama_infos[0].rect.width = screen->rect.width / 2;
screen->xinerama_infos[1].number = 1;
screen->xinerama_infos[1].rect = screen->rect;
screen->xinerama_infos[1].rect.x = screen->rect.width / 2;
screen->xinerama_infos[1].rect.width = screen->rect.width / 2;
}
else
{
meta_topic (META_DEBUG_XINERAMA,
"No Xinerama screens, using default screen info\n");
screen->xinerama_infos = g_new (MetaXineramaScreenInfo, 1);
screen->n_xinerama_infos = 1;
screen->xinerama_infos[0].number = 0;
screen->xinerama_infos[0].rect = screen->rect;
}
screen->xinerama_infos[0].number = 0;
screen->xinerama_infos[0].rect = screen->rect;
}
g_assert (screen->n_xinerama_infos > 0);
@@ -1553,7 +1562,8 @@ meta_screen_tab_popup_get_selected (MetaScreen *screen)
void
meta_screen_tab_popup_destroy (MetaScreen *screen)
{
g_return_if_fail (screen->tab_handler != NULL);
if (!screen->tab_handler)
return;
meta_alt_tab_handler_destroy (screen->tab_handler);
g_object_unref (screen->tab_handler);
@@ -2662,9 +2672,9 @@ add_sequence (MetaScreen *screen,
* to compute exactly when we may next time out
*/
if (screen->startup_sequence_timeout == 0)
screen->startup_sequence_timeout = g_timeout_add (1000,
startup_sequence_timeout,
screen);
screen->startup_sequence_timeout = g_timeout_add_seconds (1,
startup_sequence_timeout,
screen);
update_startup_feedback (screen);
}
@@ -2679,8 +2689,7 @@ remove_sequence (MetaScreen *screen,
screen->startup_sequences = g_slist_remove (screen->startup_sequences,
sequence);
sn_startup_sequence_unref (sequence);
if (screen->startup_sequences == NULL &&
screen->startup_sequence_timeout != 0)
{
@@ -2689,6 +2698,8 @@ remove_sequence (MetaScreen *screen,
}
update_startup_feedback (screen);
sn_startup_sequence_unref (sequence);
}
typedef struct
@@ -2779,7 +2790,9 @@ meta_screen_sn_event (SnMonitorEvent *event,
screen = user_data;
sequence = sn_monitor_event_get_startup_sequence (event);
sn_startup_sequence_ref (sequence);
switch (sn_monitor_event_get_type (event))
{
case SN_MONITOR_EVENT_INITIATED:
@@ -2818,6 +2831,22 @@ meta_screen_sn_event (SnMonitorEvent *event,
sn_startup_sequence_get_id (sequence));
break;
}
g_signal_emit (G_OBJECT (screen), screen_signals[STARTUP_SEQUENCE_CHANGED], 0, sequence);
sn_startup_sequence_unref (sequence);
}
/**
* meta_screen_get_startup_sequences:
* @screen:
*
* Return value: (transfer none): Currently active #SnStartupSequence items
*/
GSList *
meta_screen_get_startup_sequences (MetaScreen *screen)
{
return screen->startup_sequences;
}
#endif

View File

@@ -456,8 +456,6 @@ void meta_window_resize_with_gravity (MetaWindow *window,
/* Return whether the window should be currently mapped */
gboolean meta_window_should_be_showing (MetaWindow *window);
gboolean meta_window_toplevel_is_mapped (MetaWindow *window);
/* See warning in window.c about this function */
gboolean __window_is_terminal (MetaWindow *window);
@@ -574,8 +572,6 @@ void meta_window_free_delete_dialog (MetaWindow *window);
void meta_window_foreach_transient (MetaWindow *window,
MetaWindowForeachFunc func,
void *data);
gboolean meta_window_is_ancestor_of_transient (MetaWindow *window,
MetaWindow *transient);
void meta_window_foreach_ancestor (MetaWindow *window,
MetaWindowForeachFunc func,
void *data);

View File

@@ -472,8 +472,8 @@ set_window_title (MetaWindow *window,
meta_ui_set_frame_title (window->screen->ui,
window->frame->xwindow,
window->title);
if (modified)
g_object_notify (G_OBJECT (window), "title");
g_object_notify (G_OBJECT (window), "title");
}
static void

View File

@@ -42,6 +42,7 @@
#include "group.h"
#include "window-props.h"
#include "constraints.h"
#include "mutter-enum-types.h"
#include <X11/Xatom.h>
#include <string.h>
@@ -135,6 +136,7 @@ enum {
PROP_MINI_ICON,
PROP_DECORATED,
PROP_FULLSCREEN,
PROP_WINDOW_TYPE
};
enum
@@ -197,6 +199,9 @@ meta_window_get_property(GObject *object,
case PROP_FULLSCREEN:
g_value_set_boolean (value, win->fullscreen);
break;
case PROP_WINDOW_TYPE:
g_value_set_enum (value, win->type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -266,6 +271,15 @@ meta_window_class_init (MetaWindowClass *klass)
FALSE,
G_PARAM_READABLE));
g_object_class_install_property (object_class,
PROP_WINDOW_TYPE,
g_param_spec_enum ("window-type",
"Window Type",
"The type of the window",
MUTTER_TYPE_WINDOW_TYPE,
META_WINDOW_NORMAL,
G_PARAM_READABLE));
window_signals[WORKSPACE_CHANGED] =
g_signal_new ("workspace-changed",
G_TYPE_FROM_CLASS (object_class),
@@ -762,6 +776,16 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->compositor_private = NULL;
if (window->override_redirect)
{
window->decorated = FALSE;
window->always_sticky = TRUE;
window->has_close_func = FALSE;
window->has_shade_func = FALSE;
window->has_move_func = FALSE;
window->has_resize_func = FALSE;
}
meta_display_register_x_window (display, &window->xwindow, window);
@@ -1279,7 +1303,10 @@ meta_window_unmanage (MetaWindow *window,
g_assert (window->display->grab_window != window);
if (window->display->focus_window == window)
window->display->focus_window = NULL;
{
window->display->focus_window = NULL;
g_object_notify (G_OBJECT (window->display), "focus-window");
}
if (window->maximized_horizontally || window->maximized_vertically)
unmaximize_window_before_freeing (window);
@@ -2015,13 +2042,22 @@ intervening_user_event_occurred (MetaWindow *window)
/* To determine the "launch" time of an application,
* startup-notification can set the TIMESTAMP and the
* application (usually via its toolkit such as gtk or qt) can
* set the _NET_WM_USER_TIME. If both are set, then it means
* the user has interacted with the application since it
* launched, and _NET_WM_USER_TIME is the value that should be
* used in the comparison.
* set the _NET_WM_USER_TIME. If both are set, we need to be
* using the newer of the two values.
*
* See http://bugzilla.gnome.org/show_bug.cgi?id=573922
*/
compare = window->initial_timestamp_set ? window->initial_timestamp : 0;
compare = window->net_wm_user_time_set ? window->net_wm_user_time : compare;
compare = 0;
if (window->net_wm_user_time_set &&
window->initial_timestamp_set)
compare =
XSERVER_TIME_IS_BEFORE (window->net_wm_user_time,
window->initial_timestamp) ?
window->initial_timestamp : window->net_wm_user_time;
else if (window->net_wm_user_time_set)
compare = window->net_wm_user_time;
else if (window->initial_timestamp_set)
compare = window->initial_timestamp;
if ((focus_window != NULL) &&
XSERVER_TIME_IS_BEFORE (compare, focus_window->net_wm_user_time))
@@ -2285,6 +2321,18 @@ unmap_client_window (MetaWindow *window,
return FALSE;
}
/**
* meta_window_is_mapped:
* @window: a #MetaWindow
*
* Determines whether the X window for the MetaWindow is mapped.
*/
gboolean
meta_window_is_mapped (MetaWindow *window)
{
return window->mapped;
}
/**
* meta_window_toplevel_is_mapped:
* @window: a #MetaWindow
@@ -2557,6 +2605,15 @@ meta_window_show (MetaWindow *window)
window->desc);
invalidate_work_areas (window);
}
/*
* Now that we have shown the window, we no longer want to consider the
* initial timestamp in any subsequent deliberations whether to focus this
* window or not, so clear the flag.
*
* See http://bugzilla.gnome.org/show_bug.cgi?id=573922
*/
window->initial_timestamp_set = FALSE;
}
static void
@@ -5674,6 +5731,13 @@ meta_window_notify_focus (MetaWindow *window,
if (event->type == FocusIn)
{
if (window->override_redirect)
{
window->display->focus_window = NULL;
g_object_notify (G_OBJECT (window->display), "focus-window");
return FALSE;
}
if (window != window->display->focus_window)
{
meta_topic (META_DEBUG_FOCUS,
@@ -5737,7 +5801,7 @@ meta_window_notify_focus (MetaWindow *window,
meta_display_ungrab_focus_window_button (window->display, window);
g_signal_emit (window, window_signals[FOCUS], 0);
g_object_notify (G_OBJECT (window->display), "focus-window");
}
}
else if (event->type == FocusOut ||
@@ -5763,6 +5827,7 @@ meta_window_notify_focus (MetaWindow *window,
"* Focus --> NULL (was %s)\n", window->desc);
window->display->focus_window = NULL;
g_object_notify (G_OBJECT (window->display), "focus-window");
window->has_focus = FALSE;
if (window->frame)
meta_frame_queue_draw (window->frame);
@@ -6413,24 +6478,7 @@ recalc_window_type (MetaWindow *window)
old_type = window->type;
if (window->override_redirect)
{
if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
window->type = META_WINDOW_DROPDOWN_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU)
window->type = META_WINDOW_POPUP_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP)
window->type = META_WINDOW_TOOLTIP;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION)
window->type = META_WINDOW_NOTIFICATION;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO)
window->type = META_WINDOW_COMBO;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND)
window->type = META_WINDOW_DND;
else
window->type = META_WINDOW_OVERRIDE_OTHER;
}
else if (window->type_atom != None)
if (window->type_atom != None)
{
if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DESKTOP)
window->type = META_WINDOW_DESKTOP;
@@ -6448,9 +6496,42 @@ recalc_window_type (MetaWindow *window)
window->type = META_WINDOW_DIALOG;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NORMAL)
window->type = META_WINDOW_NORMAL;
/* The below are *typically* override-redirect windows, but the spec does
* not disallow using them for managed windows.
*/
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
window->type = META_WINDOW_DROPDOWN_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_POPUP_MENU)
window->type = META_WINDOW_POPUP_MENU;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_TOOLTIP)
window->type = META_WINDOW_TOOLTIP;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_NOTIFICATION)
window->type = META_WINDOW_NOTIFICATION;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_COMBO)
window->type = META_WINDOW_COMBO;
else if (window->type_atom == window->display->atom__NET_WM_WINDOW_TYPE_DND)
window->type = META_WINDOW_DND;
else
meta_bug ("Set a type atom for %s that wasn't handled in recalc_window_type\n",
window->desc);
{
char *atom_name;
/*
* Fallback on a normal type, and print warning. Don't abort.
*/
window->type = META_WINDOW_NORMAL;
meta_error_trap_push (window->display);
atom_name = XGetAtomName (window->display->xdisplay,
window->type_atom);
meta_error_trap_pop (window->display, TRUE);
meta_warning ("Unrecognized type atom [%s] set for %s \n",
atom_name ? atom_name : "unknown",
window->desc);
if (atom_name)
XFree (atom_name);
}
}
else if (window->xtransient_for != None)
{
@@ -6465,12 +6546,46 @@ recalc_window_type (MetaWindow *window)
window->wm_state_modal)
window->type = META_WINDOW_MODAL_DIALOG;
/* We don't want to allow override-redirect windows to have decorated-window
* types since that's just confusing.
*/
if (window->override_redirect)
{
switch (window->type)
{
/* Decorated types */
case META_WINDOW_NORMAL:
case META_WINDOW_DIALOG:
case META_WINDOW_MODAL_DIALOG:
case META_WINDOW_MENU:
case META_WINDOW_UTILITY:
window->type = META_WINDOW_OVERRIDE_OTHER;
break;
/* Undecorated types, normally not override-redirect */
case META_WINDOW_DESKTOP:
case META_WINDOW_DOCK:
case META_WINDOW_TOOLBAR:
case META_WINDOW_SPLASHSCREEN:
/* Undecorated types, normally override-redirect types */
case META_WINDOW_DROPDOWN_MENU:
case META_WINDOW_POPUP_MENU:
case META_WINDOW_TOOLTIP:
case META_WINDOW_NOTIFICATION:
case META_WINDOW_COMBO:
case META_WINDOW_DND:
/* To complete enum */
case META_WINDOW_OVERRIDE_OTHER:
break;
}
}
meta_verbose ("Calculated type %u for %s, old type %u\n",
window->type, window->desc, old_type);
if (old_type != window->type)
{
gboolean old_decorated = window->decorated;
GObject *object = G_OBJECT (window);
recalc_window_features (window);
@@ -6488,8 +6603,14 @@ recalc_window_type (MetaWindow *window)
meta_window_grab_keys (window);
g_object_freeze_notify (object);
if (old_decorated != window->decorated)
g_object_notify (G_OBJECT (window), "decorated");
g_object_notify (object, "decorated");
g_object_notify (object, "window-type");
g_object_thaw_notify (object);
}
}
@@ -8061,6 +8182,17 @@ find_ancestor_func (MetaWindow *window,
return TRUE;
}
/**
* meta_window_is_ancestor_of_transient:
* @window: a #MetaWindow
* @transient: a #MetaWindow
*
* The function determines whether @window is an ancestor of @transient; it does
* so by traversing the @transient's ancestors until it either locates @window
* or reaches an ancestor that is not transient.
*
* Return Value: (transfer none): %TRUE if window is an ancestor of transient.
*/
gboolean
meta_window_is_ancestor_of_transient (MetaWindow *window,
MetaWindow *transient)
@@ -8459,6 +8591,36 @@ meta_window_is_shaded (MetaWindow *window)
return window->shaded;
}
/**
* meta_window_is_override_redirect:
* @window: A #MetaWindow
*
* Returns if this window isn't managed by mutter; it will
* control its own positioning and mutter won't draw decorations
* among other things. In X terminology this is "override redirect".
*/
gboolean
meta_window_is_override_redirect (MetaWindow *window)
{
return window->override_redirect;
}
/**
* meta_window_is_skip_taskbar:
* @window: A #MetaWindow
*
* Gets whether this window should be ignored by task lists.
*
* Return value: %TRUE if the skip bar hint is set.
*/
gboolean
meta_window_is_skip_taskbar (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), FALSE);
return window->skip_taskbar;
}
MetaRectangle *
meta_window_get_rect (MetaWindow *window)
{
@@ -8636,3 +8798,56 @@ meta_window_get_transient_for (MetaWindow *window)
else
return NULL;
}
/**
* meta_window_get_pid:
* @window: a #MetaWindow
*
* Returns pid of the process that created this window, if known (obtained from
* the _NET_WM_PID property).
*
* Return value: (transfer none): the pid, or -1 if not known.
*/
int
meta_window_get_pid (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), -1);
return window->net_wm_pid;
}
/**
* meta_window_get_client_machine:
* @window: a #MetaWindow
*
* Returns name of the client machine from which this windows was created,
* if known (obtained from the WM_CLIENT_MACHINE property).
*
* Return value: (transfer none): the machine name, or NULL; the string is
* owned by the window manager and should not be freed or modified by the
* caller.
*/
const char *
meta_window_get_client_machine (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), NULL);
return window->wm_client_machine;
}
/**
* meta_window_is_modal:
* @window: a #MetaWindow
*
* Queries whether the window is in a modal state as described by the
* _NET_WM_STATE protocol.
*
* Return value: (transfer none): TRUE if the window is in modal state.
*/
gboolean
meta_window_is_modal (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), FALSE);
return window->wm_state_modal;
}

View File

@@ -439,6 +439,25 @@ meta_workspace_queue_calc_showing (MetaWorkspace *workspace)
}
}
/**
* meta_workspace_activate_with_focus:
* @workspace: a #MetaWorkspace
* @focus_this: the #MetaWindow to be focused, or %NULL
* @timestamp: timestamp for @focus_this
*
* Switches to @workspace and possibly activates the window @focus_this.
*
* The window @focus_this is activated by calling meta_window_activate()
* which will unminimize it and transient parents, raise it and give it
* the focus.
*
* If a window is currently being moved by the user, it will be
* moved to @workspace.
*
* The advantage of calling this function instead of meta_workspace_activate()
* followed by meta_window_activate() is that it happens as a unit, so
* no other window gets focused first before @focus_this.
*/
void
meta_workspace_activate_with_focus (MetaWorkspace *workspace,
MetaWindow *focus_this,
@@ -562,8 +581,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
*/
if (focus_this)
{
meta_window_focus (focus_this, timestamp);
meta_window_raise (focus_this);
meta_window_activate (focus_this, timestamp);
}
else if (move_window)
{

View File

@@ -186,6 +186,18 @@ keybind (cycle_panels_backward, handle_cycle, META_TAB_LIST_DOCKS,
_("Move backward between panels and the desktop immediately"))
/***********************************/
/* These two are special pseudo-bindings that are provided for allowing
* custom handlers, but will never be bound to a key. While a tab
* grab is in effect, they are invoked for releasing the primary modifier
* or pressing some unbound key, respectively.
*/
keybind (tab_popup_select, handle_tab_popup_select, 0, 0, NULL,
"Select window from tab popup")
keybind (tab_popup_cancel, handle_tab_popup_cancel, 0, 0, NULL,
"Cancel tab popup")
/***********************************/
keybind (show_desktop, handle_show_desktop, 0, 0, "<Control><Alt>d",
_("Hide all normal windows and set focus to the desktop"))

View File

@@ -138,7 +138,10 @@ typedef enum
META_GRAB_OP_CLICKING_ABOVE,
META_GRAB_OP_CLICKING_UNABOVE,
META_GRAB_OP_CLICKING_STICK,
META_GRAB_OP_CLICKING_UNSTICK
META_GRAB_OP_CLICKING_UNSTICK,
/* Special grab op when the compositor asked for a grab */
META_GRAB_OP_COMPOSITOR
} MetaGrabOp;
typedef enum

View File

@@ -75,6 +75,9 @@ MetaScreen *meta_display_screen_for_root (MetaDisplay *display,
Window xroot);
MetaWindow *meta_display_get_focus_window (MetaDisplay *display);
gboolean meta_display_xwindow_is_a_no_focus_window (MetaDisplay *display,
Window xwindow);
int meta_display_get_damage_event_base (MetaDisplay *display);
int meta_display_get_shape_event_base (MetaDisplay *display);
Atom meta_display_get_atom (MetaDisplay *display, MetaAtom meta_atom);
@@ -111,6 +114,10 @@ gboolean meta_display_begin_grab_op (MetaDisplay *display,
int root_y);
void meta_display_end_grab_op (MetaDisplay *display,
guint32 timestamp);
MetaGrabOp meta_display_get_grab_op (MetaDisplay *display);
/* meta_display_set_input_focus_window is like XSetInputFocus, except
* that (a) it can't detect timestamps later than the current time,
* since Mutter isn't part of the XServer, and thus gives erroneous

View File

@@ -29,15 +29,8 @@
#include "util.h"
#include "display.h"
typedef void (* ErrorHandler) (Display *dpy,
XErrorEvent *error,
gpointer data);
void meta_errors_init (void);
void meta_errors_register_foreign_display (Display *foreign_dpy,
ErrorHandler handler,
gpointer data);
void meta_error_trap_push (MetaDisplay *display);
void meta_error_trap_pop (MetaDisplay *display,
gboolean last_request_was_roundtrip);

View File

@@ -255,6 +255,31 @@ void
mutter_plugin_set_stage_input_region (MutterPlugin *plugin,
XserverRegion region);
/**
* MetaModalOptions:
* @META_MODAL_POINTER_ALREADY_GRABBED: if set the pointer is already
* grabbed by the plugin and should not be grabbed again.
* @META_MODAL_KEYBOARD_ALREADY_GRABBED: if set the keyboard is already
* grabbed by the plugin and should not be grabbed again.
*
* Options that can be provided when calling mutter_plugin_begin_modal().
*/
typedef enum {
META_MODAL_POINTER_ALREADY_GRABBED = 1 << 0,
META_MODAL_KEYBOARD_ALREADY_GRABBED = 1 << 1
} MetaModalOptions;
gboolean
mutter_plugin_begin_modal (MutterPlugin *plugin,
Window grab_window,
Cursor cursor,
MetaModalOptions options,
guint32 timestamp);
void
mutter_plugin_end_modal (MutterPlugin *plugin,
guint32 timestamp);
GList *
mutter_plugin_get_windows (MutterPlugin *plugin);

View File

@@ -55,6 +55,8 @@ MetaScreen *meta_screen_for_x_screen (Screen *xscreen);
void meta_screen_set_cm_selection (MetaScreen *screen);
void meta_screen_unset_cm_selection (MetaScreen *screen);
GSList *meta_screen_get_startup_sequences (MetaScreen *screen);
GList *meta_screen_get_workspaces (MetaScreen *screen);
int meta_screen_get_n_workspaces (MetaScreen *screen);

View File

@@ -134,11 +134,11 @@ GPid meta_show_dialog (const char *type,
#include <glib-object.h>
#define META_TYPE_NEXUS (meta_nexus_get_type ())
#define META_NEXUS(obj) (GTK_CHECK_CAST ((obj), META_TYPE_NEXUS, MetaNexus))
#define META_NEXUS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_NEXUS, MetaNexusClass))
#define META_IS_NEXUS(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_NEXUS))
#define META_IS_NEXUS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_NEXUS))
#define META_NEXUS_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_NEXUS, MetaNexusClass))
#define META_NEXUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_NEXUS, MetaNexus))
#define META_NEXUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_NEXUS, MetaNexusClass))
#define META_IS_NEXUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_NEXUS))
#define META_IS_NEXUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_NEXUS))
#define META_NEXUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_NEXUS, MetaNexusClass))
typedef struct _MetaNexus
{

View File

@@ -70,6 +70,8 @@ GType meta_window_get_type (void);
MetaFrame *meta_window_get_frame (MetaWindow *window);
gboolean meta_window_has_focus (MetaWindow *window);
gboolean meta_window_is_shaded (MetaWindow *window);
gboolean meta_window_is_override_redirect (MetaWindow *window);
gboolean meta_window_is_skip_taskbar (MetaWindow *window);
MetaRectangle *meta_window_get_rect (MetaWindow *window);
void meta_window_get_outer_rect (const MetaWindow *window, MetaRectangle *rect);
MetaScreen *meta_window_get_screen (MetaWindow *window);
@@ -100,6 +102,10 @@ void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);
const char *meta_window_get_role (MetaWindow *window);
MetaStackLayer meta_window_get_layer (MetaWindow *window);
MetaWindow* meta_window_find_root_ancestor (MetaWindow *window);
gboolean meta_window_is_ancestor_of_transient (MetaWindow *window,
MetaWindow *transient);
gboolean meta_window_is_mapped (MetaWindow *window);
gboolean meta_window_toplevel_is_mapped (MetaWindow *window);
gboolean meta_window_get_icon_geometry (MetaWindow *window,
MetaRectangle *rect);
void meta_window_maximize (MetaWindow *window,
@@ -112,5 +118,7 @@ const char *meta_window_get_title (MetaWindow *window);
MetaWindow *meta_window_get_transient_for (MetaWindow *window);
void meta_window_delete (MetaWindow *window,
guint32 timestamp);
int meta_window_get_pid (MetaWindow *window);
const char *meta_window_get_client_machine (MetaWindow *window);
gboolean meta_window_is_modal (MetaWindow *window);
#endif

View File

@@ -1,6 +1,5 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
_Name=Mutter
Exec=mutter
# name of loadable control center module

View File

@@ -1,6 +1,5 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
_Name=Mutter
Exec=mutter
NoDisplay=true

View File

@@ -171,10 +171,8 @@ mouse_release (GtkWidget *invisible,
shutdown_grab ();
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (mouse_motion), NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (mouse_release), NULL);
g_signal_handlers_disconnect_by_func (invisible, mouse_motion, NULL);
g_signal_handlers_disconnect_by_func (invisible, mouse_release, NULL);
return TRUE;
}
@@ -194,12 +192,8 @@ key_press (GtkWidget *invisible,
{
shutdown_grab ();
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (mouse_press),
NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (key_press),
NULL);
g_signal_handlers_disconnect_by_func (invisible, mouse_press, NULL);
g_signal_handlers_disconnect_by_func (invisible, key_press, NULL);
return TRUE;
}
@@ -219,12 +213,8 @@ mouse_press (GtkWidget *invisible,
G_CALLBACK (mouse_motion), NULL);
g_signal_connect (invisible, "button_release_event",
G_CALLBACK (mouse_release), NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (mouse_press),
NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (key_press),
NULL);
g_signal_handlers_disconnect_by_func (invisible, mouse_press, NULL);
g_signal_handlers_disconnect_by_func (invisible, key_press, NULL);
return TRUE;
}

View File

@@ -285,7 +285,7 @@ response_cb (GtkDialog *dialog,
}
static void
dialog_cb (gpointer callback_data,
dialog_cb (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
@@ -812,6 +812,26 @@ destroy_cb (GtkWidget *w, gpointer data)
gtk_main_quit ();
}
static void
insert_stock_button (GtkWidget *toolbar,
const gchar *stock_id,
const gchar *text,
GCallback callback,
gpointer user_data)
{
GtkToolItem *button;
button = gtk_tool_button_new_from_stock (stock_id);
gtk_tool_item_set_tooltip_text (button, text);
g_signal_connect (G_OBJECT (button),
"clicked",
callback,
user_data);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
button,
-1); /*-1 means append to end of toolbar*/
}
static GtkWidget *
do_appwindow (void)
{
@@ -853,8 +873,7 @@ do_appwindow (void)
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
/* Set up item factory to go away with the window */
g_object_ref (item_factory);
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_ref_sink (item_factory);
g_object_set_data_full (G_OBJECT (window),
"<main>",
item_factory,
@@ -904,45 +923,25 @@ do_appwindow (void)
*/
toolbar = gtk_toolbar_new ();
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_NEW,
"Open another one of these windows",
NULL,
G_CALLBACK (do_appwindow),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"This is a demo button that locks up the demo",
NULL,
G_CALLBACK (sleep_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
insert_stock_button (toolbar, GTK_STOCK_NEW,
"Open another one of these windows",
G_CALLBACK (do_appwindow), window);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"This is a demo button that toggles window decorations",
NULL,
G_CALLBACK (toggle_decorated_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"This is a demo button that locks the aspect ratio using a hint",
NULL,
G_CALLBACK (toggle_aspect_ratio),
contents, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_QUIT,
"This is a demo button with a 'quit' icon",
NULL,
G_CALLBACK (clicked_toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
insert_stock_button (toolbar, GTK_STOCK_OPEN,
"This is a demo button that locks up the demo",
G_CALLBACK (sleep_cb), window);
insert_stock_button (toolbar, GTK_STOCK_OPEN,
"This is a demo button that toggles window decorations",
G_CALLBACK (toggle_decorated_cb), window);
insert_stock_button (toolbar, GTK_STOCK_OPEN,
"This is a demo button that locks the aspect ratio using a hint",
G_CALLBACK (toggle_aspect_ratio), contents);
insert_stock_button (toolbar, GTK_STOCK_QUIT,
"This is a demo button with a 'quit' icon",
G_CALLBACK (clicked_toolbar_cb), window);
handlebox = gtk_handle_box_new ();

View File

@@ -87,7 +87,7 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number,
}
gtk_widget_set_app_paintable (tip, TRUE);
gtk_window_set_policy (GTK_WINDOW (tip), FALSE, FALSE, TRUE);
gtk_window_set_resizable (GTK_WINDOW (tip), FALSE);
gtk_widget_set_name (tip, "gtk-tooltips");
gtk_container_set_border_width (GTK_CONTAINER (tip), 4);

View File

@@ -108,10 +108,10 @@ static void invalidate_whole_window (MetaFrames *frames,
static GtkWidgetClass *parent_class = NULL;
GtkType
GType
meta_frames_get_type (void)
{
static GtkType frames_type = 0;
static GType frames_type = 0;
if (!frames_type)
{
@@ -593,7 +593,7 @@ meta_frames_attach_style (MetaFrames *frames,
gtk_style_detach (frame->style);
/* Weirdly, gtk_style_attach() steals a reference count from the style passed in */
gtk_style_ref (GTK_WIDGET (frames)->style);
g_object_ref (GTK_WIDGET (frames)->style);
frame->style = gtk_style_attach (GTK_WIDGET (frames)->style, frame->window);
}

View File

@@ -60,11 +60,11 @@ typedef enum
*/
#define META_TYPE_FRAMES (meta_frames_get_type ())
#define META_FRAMES(obj) (GTK_CHECK_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
#define META_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
#define META_IS_FRAMES(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_FRAMES))
#define META_IS_FRAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
#define META_FRAMES_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
#define META_FRAMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
#define META_FRAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
#define META_IS_FRAMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_FRAMES))
#define META_IS_FRAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
#define META_FRAMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
typedef struct _MetaFrames MetaFrames;
typedef struct _MetaFramesClass MetaFramesClass;

View File

@@ -445,7 +445,7 @@ meta_window_menu_new (MetaFrames *frames,
gtk_signal_connect_full (GTK_OBJECT (submi),
"activate",
GTK_SIGNAL_FUNC (activate_cb),
G_CALLBACK (activate_cb),
NULL,
md,
g_free, FALSE, FALSE);
@@ -473,7 +473,7 @@ meta_window_menu_new (MetaFrames *frames,
gtk_signal_connect_full (GTK_OBJECT (mi),
"activate",
GTK_SIGNAL_FUNC (activate_cb),
G_CALLBACK (activate_cb),
NULL,
md,
g_free, FALSE, FALSE);

View File

@@ -53,10 +53,10 @@ static int meta_accel_label_get_accel_width (MetaAccelLabel *accel_label);
static GtkLabelClass *parent_class = NULL;
GtkType
GType
meta_accel_label_get_type (void)
{
static GtkType accel_label_type = 0;
static GType accel_label_type = 0;
if (!accel_label_type)
{

View File

@@ -43,11 +43,11 @@ extern "C" {
#define META_TYPE_ACCEL_LABEL (meta_accel_label_get_type ())
#define META_ACCEL_LABEL(obj) (GTK_CHECK_CAST ((obj), META_TYPE_ACCEL_LABEL, MetaAccelLabel))
#define META_ACCEL_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_ACCEL_LABEL, MetaAccelLabelClass))
#define META_IS_ACCEL_LABEL(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_ACCEL_LABEL))
#define META_IS_ACCEL_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_ACCEL_LABEL))
#define META_ACCEL_LABEL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_ACCEL_LABEL, MetaAccelLabelClass))
#define META_ACCEL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_ACCEL_LABEL, MetaAccelLabel))
#define META_ACCEL_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_ACCEL_LABEL, MetaAccelLabelClass))
#define META_IS_ACCEL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_ACCEL_LABEL))
#define META_IS_ACCEL_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_ACCEL_LABEL))
#define META_ACCEL_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_ACCEL_LABEL, MetaAccelLabelClass))
typedef struct _MetaAccelLabel MetaAccelLabel;
@@ -91,7 +91,7 @@ struct _MetaAccelLabelClass
void (*_gtk_reserved4) (void);
};
GtkType meta_accel_label_get_type (void) G_GNUC_CONST;
GType meta_accel_label_get_type (void) G_GNUC_CONST;
GtkWidget* meta_accel_label_new_with_mnemonic (const gchar *string);
void meta_accel_label_set_accelerator (MetaAccelLabel *accel_label,
guint accelerator_key,

View File

@@ -40,10 +40,10 @@ static void meta_preview_finalize (GObject *object);
static GtkWidgetClass *parent_class;
GtkType
GType
meta_preview_get_type (void)
{
static GtkType preview_type = 0;
static GType preview_type = 0;
if (!preview_type)
{

View File

@@ -28,11 +28,11 @@
#define META_PREVIEW_WIDGET_H
#define META_TYPE_PREVIEW (meta_preview_get_type ())
#define META_PREVIEW(obj) (GTK_CHECK_CAST ((obj), META_TYPE_PREVIEW, MetaPreview))
#define META_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_PREVIEW, MetaPreviewClass))
#define META_IS_PREVIEW(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_PREVIEW))
#define META_IS_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_PREVIEW))
#define META_PREVIEW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_PREVIEW, MetaPreviewClass))
#define META_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_PREVIEW, MetaPreview))
#define META_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_PREVIEW, MetaPreviewClass))
#define META_IS_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_PREVIEW))
#define META_IS_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_PREVIEW))
#define META_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_PREVIEW, MetaPreviewClass))
typedef struct _MetaPreview MetaPreview;
typedef struct _MetaPreviewClass MetaPreviewClass;
@@ -63,7 +63,7 @@ struct _MetaPreviewClass
};
GtkType meta_preview_get_type (void) G_GNUC_CONST;
GType meta_preview_get_type (void) G_GNUC_CONST;
GtkWidget* meta_preview_new (void);
void meta_preview_set_theme (MetaPreview *preview,

View File

@@ -597,7 +597,7 @@ meta_ui_tab_popup_select (MetaTabPopup *popup,
}
#define META_TYPE_SELECT_IMAGE (meta_select_image_get_type ())
#define META_SELECT_IMAGE(obj) (GTK_CHECK_CAST ((obj), META_TYPE_SELECT_IMAGE, MetaSelectImage))
#define META_SELECT_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SELECT_IMAGE, MetaSelectImage))
typedef struct _MetaSelectImage MetaSelectImage;
typedef struct _MetaSelectImageClass MetaSelectImageClass;
@@ -650,7 +650,7 @@ static GtkImageClass *parent_class;
GType
meta_select_image_get_type (void)
{
static GtkType image_type = 0;
static GType image_type = 0;
if (!image_type)
{
@@ -678,7 +678,7 @@ meta_select_image_class_init (MetaSelectImageClass *klass)
{
GtkWidgetClass *widget_class;
parent_class = gtk_type_class (gtk_image_get_type ());
parent_class = g_type_class_peek (gtk_image_get_type ());
widget_class = GTK_WIDGET_CLASS (klass);
@@ -737,7 +737,7 @@ meta_select_image_expose_event (GtkWidget *widget,
}
#define META_TYPE_SELECT_WORKSPACE (meta_select_workspace_get_type ())
#define META_SELECT_WORKSPACE(obj) (GTK_CHECK_CAST ((obj), META_TYPE_SELECT_WORKSPACE, MetaSelectWorkspace))
#define META_SELECT_WORKSPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SELECT_WORKSPACE, MetaSelectWorkspace))
typedef struct _MetaSelectWorkspace MetaSelectWorkspace;
typedef struct _MetaSelectWorkspaceClass MetaSelectWorkspaceClass;
@@ -803,7 +803,7 @@ static gboolean meta_select_workspace_expose_event (GtkWidget *widget,
GType
meta_select_workspace_get_type (void)
{
static GtkType workspace_type = 0;
static GType workspace_type = 0;
if (!workspace_type)
{

View File

@@ -194,13 +194,14 @@ render_multi (GdkDrawable *drawable,
colors, N_COLORS,
type);
gdk_pixbuf_render_to_drawable (pixbuf,
drawable,
gc,
0, 0,
0, 0, width, height,
GDK_RGB_DITHER_NORMAL,
0, 0);
gdk_draw_pixbuf (drawable,
gc,
pixbuf,
0, 0,
0, 0,
width, height,
GDK_RGB_DITHER_NORMAL,
0, 0);
g_object_unref (G_OBJECT (pixbuf));
#undef N_COLORS
@@ -248,13 +249,14 @@ render_interwoven_func (GdkDrawable *drawable,
colors, height / 10,
colors + 2, height / 14);
gdk_pixbuf_render_to_drawable (pixbuf,
drawable,
gc,
0, 0,
0, 0, width, height,
GDK_RGB_DITHER_NORMAL,
0, 0);
gdk_draw_pixbuf (drawable,
gc,
pixbuf,
0, 0,
0, 0,
width, height,
GDK_RGB_DITHER_NORMAL,
0, 0);
g_object_unref (G_OBJECT (pixbuf));
}

View File

@@ -86,6 +86,22 @@ static GtkItemFactoryEntry menu_items[] =
{ N_("/Windows/Des_ktop"), NULL, NULL, 0, NULL }
};
static void
insert_stock_button (GtkWidget *toolbar,
const gchar *stock_id,
const gchar *text)
{
GtkToolItem *button;
button = gtk_tool_button_new_from_stock (stock_id);
gtk_tool_item_set_tooltip_text (button, text);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
button,
-1); /*-1 means append to end of toolbar*/
return;
}
static GtkWidget *
normal_contents (void)
{
@@ -109,7 +125,8 @@ normal_contents (void)
/* Set up item factory to go away */
g_object_ref (item_factory);
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_ref_sink (item_factory);
g_object_unref (item_factory);
g_object_set_data_full (G_OBJECT (table),
"<main>",
item_factory,
@@ -130,26 +147,12 @@ normal_contents (void)
*/
toolbar = gtk_toolbar_new ();
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_NEW,
_("Open another one of these windows"),
NULL,
NULL, NULL,
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
_("This is a demo button with an 'open' icon"),
NULL,
NULL, NULL,
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_QUIT,
_("This is a demo button with a 'quit' icon"),
NULL,
NULL, NULL,
-1); /* -1 means "append" */
insert_stock_button (toolbar, GTK_STOCK_NEW,
_("Open another one of these windows"));
insert_stock_button (toolbar, GTK_STOCK_OPEN,
_("This is a demo button with an 'open' icon"));
insert_stock_button (toolbar, GTK_STOCK_QUIT,
_("This is a demo button with a 'quit' icon"));
handlebox = gtk_handle_box_new ();

View File

@@ -35,10 +35,10 @@ static void meta_area_finalize (GObject *object);
static GtkMiscClass *parent_class;
GtkType
GType
meta_area_get_type (void)
{
static GtkType area_type = 0;
static GType area_type = 0;
if (!area_type)
{

View File

@@ -28,11 +28,11 @@
#define META_THEME_WIDGET_H
#define META_TYPE_AREA (meta_area_get_type ())
#define META_AREA(obj) (GTK_CHECK_CAST ((obj), META_TYPE_AREA, MetaArea))
#define META_AREA_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), META_TYPE_AREA, MetaAreaClass))
#define META_IS_AREA(obj) (GTK_CHECK_TYPE ((obj), META_TYPE_AREA))
#define META_IS_AREA_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), META_TYPE_AREA))
#define META_AREA_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), META_TYPE_AREA, MetaAreaClass))
#define META_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_AREA, MetaArea))
#define META_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_AREA, MetaAreaClass))
#define META_IS_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_AREA))
#define META_IS_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_AREA))
#define META_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_AREA, MetaAreaClass))
typedef struct _MetaArea MetaArea;
typedef struct _MetaAreaClass MetaAreaClass;
@@ -65,7 +65,7 @@ struct _MetaAreaClass
};
GtkType meta_area_get_type (void) G_GNUC_CONST;
GType meta_area_get_type (void) G_GNUC_CONST;
GtkWidget* meta_area_new (void);
void meta_area_setup (MetaArea *area,

View File

@@ -58,7 +58,7 @@ gtk_widget_get_type (void)
/* dummy */
}
GtkType
GType
gtk_object_get_type (void)
{
/* dummy */