1
0
Fork 0
Commit graph

102 commits

Author SHA1 Message Date
Benjamin Otte
33489c8cb8 Adapt to GTK API changes
This code adapts mutter to the latest changes to GTK in
http://git.gnome.org/browse/gtk+/commit/?id=872ef111ecabf6cd4453590b1e17afd3c9757f28
that remove the dest argument from gdk_pixbuf_get_from_window() and
gdk_pixbuf_get_from_surface().

It also removes the dest argument from meta_gdk_pixbuf_get_from_pixmap()
to match. The function is internal and the argument wasn't used.

https://bugzilla.gnome.org/show_bug.cgi?id=631147
2010-10-02 04:27:05 +02:00
Alban Browaeys
ff04e38326 Replace gtk_window_set_visual() with gtk_widget_set_visual()
gtk_window_set_visual() was changed back to work on a widget level
for more compatibility with 2.x.

https://bugzilla.gnome.org/show_bug.cgi?id=630843
2010-09-28 15:37:53 -04:00
Matthias Clasen
33e2d15495 Adapt to GtkObject removal in GTK3
The destroy signal has been moved to GtkWidget, so change the class_init
functions of MetaFrames and MetaAccelLabel to match.

https://bugzilla.gnome.org/show_bug.cgi?id=630671
2010-09-27 13:58:36 -04:00
Benjamin Otte
b265e8099a theme: Get rid of x/y_offset usage when drawing frames
Commit aa65f94c67 that started passing
cairo_t around broke offsets. Since passing cairo_t makes them
unnecessary, this patches removes them rather than fixing them.

This patch changes API.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-27 17:07:23 +02:00
Benjamin Otte
a2b3f9aeb0 frames.c: Clip the client area correctly
The code switched the x and y variables. Oops.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-27 17:07:23 +02:00
Benjamin Otte
9f5d8d1a2a Fix compilation against latest GTK3 changes
With the newest changes to GTK3, some things were changed. This patch
now uses the features introduced in gtk3-compat.h in previous patches.

This patch also introduces a macro named USE_GTK3 that is used to
differentiate between GTK3 and GTK2. Its main use is differenting
between expose and draw handlers for GtkWidget subclasses.

The draw vs expose handlers question is usually handled by using ifdefs
at the beginning and end to set up/tear down a cairo_t and then use it.

However, when the function is too different and too many ifdefs would be
necessary, two versions of the function are written. This is currently
the case for:
- MetaAccelLabel
- MetaFrames

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
e75abacec6 frames.c: Make cached_pixels_draw() take a cairo_t
This basically just moves the creation of the cairo_t out of the
function. It is done in preparation for GTK3.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
1c31e8ffc2 ui: Port draw_workspace() to take a cairo_t
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
1083a4c0b7 Introduce MetaPixmap compatibility wrapper
Similar to the region compatibility shim, we will soon need a
compatibility shim around GdkPixmap/cairo_surface_t. For now, the patch
just introduces the compatibility layer.

This patch also does not include the function
meta_gdk_pixbuf_get_from_pixmap() as that function will need special
treatment in GTK3 anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
d212be799a frames.c: Merge clear_backing() function into its only user
Avoids creating a cairo_t twice. And without the code to create a
cairo_t, there was not a lot left to warrant a separate function.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
84986c7695 frames.c: Change meta_frames_paint() to take a cairo_t
Rename meta_frames_paint_to_drawable() to meta_frames_paint() and make
it take a cairo_t as an argument instead of creating the cairo_t itself.

This patch refactors code for GTK3 changes where code needs to handle
cairo_t and not GdkDrawable arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
aa65f94c67 theme: Upgrade to use Cairo for painting (changes API)
This commit is in preparation for the work happening in GTK3, which will
use Cairo for drawing exclusively. So it is necessary to move all
drawing code to Cairo. In this commit the "gtk2" code is used for both
gtk2 and gtk3; compatibility with newer versions of gtk3 where different
code is needed will be added subsequently.
For compatibility with older GTK versions, the file gdk2-drawing-utils.h
provides a compatibility layer.

The commit changes the API of libmutter-private.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
f2c63e5eec ui: Remove unused meta_gdk_pixbuf_get_from_window()
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-26 17:09:20 +02:00
Benjamin Otte
5c3b0cda2e ui: gtk_widget_show() the MetaFrames object
The widget needs to be visible and mapped for GTK3 to deliver expose
events to the widget. This is achieved by making the map function a
no-op and calling gtk_widget_show() instead of just calling
gtk_widget_realize().
Apart from making GTK think the widget is drawable, the effect is the
same.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
a3c6486e52 Remove MetaImageWindow
The code isn't used anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
741d2b761a frames.c: Simplify cached area subtraction code
Because we store the affected rectangle in the piece, we can just
subtract it and don't need any complicated computations.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
a0ffe71db3 Change the cached rectangle ares to a GdkRectangle
Simplifies the code as the rectangle is mainly interacting with GDK
APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
ecf812db83 frames.c: Do not create pixmaps when there's nothing to draw
https://bugzilla.gnome.org/show_bug.cgi?id=630203

Take advantage of existing handling for CachedFramePiece.piece == NULL
to avoid generating pixmaps when width/height are 0
2010-09-23 12:54:14 +02:00
Benjamin Otte
afd3b96e2e Simplify code: Use cairo_paint() to paint the whole pixmap
Also, gdk_drawable_get_size() is going away soon

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
b79e6c0b3e Remove unused code
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
c6f8ad24bd Remove MetaArea widget
It's unused.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
d4d05e496a Remove meta_ui_get_pixbuf_from_pixmap() function
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:14 +02:00
Benjamin Otte
0a88329526 Move begin_paint() handling to expose handler
This way, we can remove the special casing in
meta_frames_paint_to_drawable().
Since the setup in meta_frames_paint_to_drawable() is relatively cheap,
doing it once per rectangle in the expose area should be fine.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:54:00 +02:00
Benjamin Otte
b4344b5ab5 Remove NULL checks in meta_frame_layout_get_borders()
This function actually handles NULL. (And I'm going to pass some NULLs
soon).

https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:31:02 +02:00
Benjamin Otte
4ac836fde4 Remove client area from region in expose event
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:31:02 +02:00
Benjamin Otte
7897448a5b frames.c: Remove workaround now that clip_to_screen() works properly
This code seems to be basically broken. It looks like it tried to clip
the expose area to the screen, but used screen coordinates for the
screen area but frame coordinates for the frame area. So someone tried
to work around this by adding a border around the screen, which made the
broken clipping work most of the time (see bugs below for examples where
it didn't).
Anyway, all of this is gone now.

https://bugzilla.gnome.org/show_bug.cgi?id=399529
https://bugzilla.redhat.com/show_bug.cgi?id=557402
https://bugzilla.gnome.org/show_bug.cgi?id=538438
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:31:01 +02:00
Benjamin Otte
94f4011844 frames.c: Make clip_to_screen() actually clip to the screen
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:31:01 +02:00
Benjamin Otte
3f8e6020f7 ui: Clip the region once, not every rectangle manually
https://bugzilla.gnome.org/show_bug.cgi?id=630203
2010-09-23 12:31:01 +02:00
Florian Müllner
beb65f011d tile-preview: Fix crash when falling back to default style
gtk_rc_get_style_by_paths() returns NULL if no matching style was
found and the default style should be used. Actually use the default
style in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=630003
2010-09-22 00:11:14 +02:00
Florian Müllner
97e2b4666b Implement side-by-side tiling
When dragging a window over a screen edge and dropping it there,
maximize it vertically and scale it horizontally to cover the
corresponding half of the current monitor.

Whenever a "hot area" which triggers this behavior is entered, an
indication of window's target size is displayed after a short delay
to avoid distraction when moving a window between monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=606260
2010-09-17 16:00:03 +02:00
Jasper St. Pierre
0d51d9e4cf Remove usage of 'gdk_display', a removed symbol in gtk3.
https://bugzilla.gnome.org/show_bug.cgi?id=629232
2010-09-10 15:18:06 -04:00
Colin Walters
4c0763792d introspection: Build with --warn-fatal, drop fix-meta-rectangle.py hack
Cleanly build with --warn-fatal.  Implementation:

* Liberally apply (skip) where the API is clearly C only, e.g. uses
  XLib.  The theming code and MutterPlugin are skipped too.
* Add missing (transfer) and (element-type) annotations

For a few functions that had a comment, I turned it into gtk-doc, but
I didn't (with a few exceptions) try to write new documentation in
this pass.
2010-09-07 10:48:07 -04:00
Thierry Reding
4544fe7571 Fix build against gtk+ older than 2.21.6.
The gdk_window_get_background_pattern() function copied from GDK and
introduced in commit 0839c10 has a small syntax error and uses a private
API (_gdk_drawable_ref_cairo_surface()). This patch imports the missing
API and fixes the syntax error.

https://bugzilla.gnome.org/show_bug.cgi?id=626583
2010-08-23 11:11:50 +01:00
Florian Müllner
0839c100c0 Use gdk_window_get_background_pattern() to clear the background
gdk_window_get_back_pixmap() and gdk_window_get_background() have
been removed/deprecated. Use gdk_window_get_background_pattern()
as replacement.

https://bugzilla.gnome.org/show_bug.cgi?id=626583
2010-08-17 20:57:47 +02:00
Florian Müllner
08cfdcd802 Replace GDK drawing API with cairo
The GDK drawing API was deprecated/removed.

https://bugzilla.gnome.org/show_bug.cgi?id=626583
2010-08-17 20:42:05 +02:00
Florian Müllner
7feeb72721 Use cairo_region_t when building with gtk+-3.0
GdkRegion has been removed from Gtk+. The replacement is a
yet-unreleased cairo API, so use it only when building with
Gtk+-3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=587991
2010-07-02 04:36:28 +02:00
Florian Müllner
e267a63330 Add compatibility with GTK+ 2.18
In order to replace calls to deprecated GDK code, the current
development version of GTK+ is required. Add some basic compatibility
code to allow building mutter with GTK+ 2.18.

https://bugzilla.gnome.org/show_bug.cgi?id=587991
2010-07-01 20:55:12 +02:00
Florian Müllner
c65a24486d Replace deprecated GDK symbols
The fix depends on new API added in this cycle, so the required
GTK+ version is bumped to 2.21.1.

https://bugzilla.gnome.org/show_bug.cgi?id=587991
2010-07-01 20:55:11 +02:00
Nickolas Lloyd
42e786b15b Remove deprecated Gtk+ symbols
This patch removes all uses of deprecated Gtk+ symbols from mutter.

https://bugzilla.gnome.org/show_bug.cgi?id=587991
2010-07-01 20:55:11 +02:00
Claudio Saavedra
7a04673dd7 Don't use deprecated GtkTooltips type unnecessarily
Bug 622800.
2010-06-30 01:35:42 +03:00
Claudio Saavedra
fd12eddb5d Use g_signal_connect_data() instead of deprecated gtk_signal_connect_full()
Bug 622800.
2010-06-30 01:35:26 +03:00
Claudio Saavedra
0b56599d28 Don't use gtk_type_unique()
Replace usage of deprecated gtk_type_unique() by switching to defining
types with G_DEFINE_TYPE.

Bug 622800.
2010-06-30 01:34:54 +03:00
Florian Müllner
c6c7b05d7b Add compatibility with GTK+ 2.18
To replace all calls to deprecated code, GTK+ 2.20 is required - add
some basic compatibility code, so that it is still possible to build
mutter with GTK+ 2.18 when not using -DGSEAL_ENABLE.

https://bugzilla.gnome.org/show_bug.cgi?id=595496
2010-05-12 11:02:52 +02:00
Florian Müllner
5526e91b6e Replace left-over accesses of struct members
When replacing direct accesses with accessor functions, two snippets
were left out. Mutter now builds with GSEAL_ENABLE.

https://bugzilla.gnome.org/show_bug.cgi?id=595496
2010-05-12 11:02:52 +02:00
Javier Jardón
9e123695d0 Use accessor functions instead direct access.
GTK+ 2.20 is now the required version

Still missing:
GTK_MENU_SHELL ()->have_xgrab

https://bugzilla.gnome.org/show_bug.cgi?id=595496
2010-05-12 11:02:45 +02:00
Owen W. Taylor
1d7476a725 Allow a theme to specify ellipsize width for a title
It's nice to indicate when a title is truncated with an ellipsis.
Because themes may draw a title multiple times to draw a shadow, or
may include the window icon within the title area, we can't determine
the proper ellipsization width automatically, so add an optional
attribute to the <title/> element "ellipsize_width" which, if set,
is the width to ellipsize at.

This is only enabled if a theme version of 3.1 is required.

When it's not set, we keep the old behavior of just letting the
title be clipped with a hard edge.

https://bugzilla.gnome.org/show_bug.cgi?id=591842
2010-04-13 14:10:54 -04:00
Owen W. Taylor
e8e78ebfdd Add frame_x_center/frame_y_center variables for themes
Sometimes you want to position something (usually the title) to be centered
with respect to the entire frame instead of centered with respect to the
individual piece currently being drawn.

This patch adds frame_x_center and frame_y_center variables that represent
the X/Y centers of the frame in the coordinate system of the piece being
drawn.

The theme version is bumped from 3.0 to 3.1 (3.0 is just the new version
system, 3.1 will have all the features we add for Mutter-2.28.)
position expressions

https://bugzilla.gnome.org/show_bug.cgi?id=591842
2010-04-13 14:07:50 -04:00
Owen W. Taylor
020aea033c metacity-theme-3.xml: Add a flexible version mechanism
The current mechanism of metacity-theme-1.xml and metacity-theme-2.xml
is not flexible for allowing small-scale additions. With this patch
we bump the major version version once more to metacity-theme-3.xml
and add a single feature:

Any element in the DTD can have an attribute:

 version="[<|<=|=>|>] MAJOR.MINOR"

And it will be ignored unless the predicate is met. (< and > should
be to be entity escaped as &lt; and &gt;)

This allows having alternate sections of the theme file for older and
newer version.

* Required GLib version is bumped to 2.14 so we can parse versions
  with a regular expression.

* We switch internal version numbers to be "1000 * major + minor"

* We keep a stack of the maximum required version for the current portion
  the XML tree so that the "cannot use versions you don't require" stricture
  of the old code can be made local to a subpart of the tree.

* A version on the top metacity_theme element causes the entire file to
  be ignored; this allows having one metacity-theme-3.xml for version 3.2
  and newer (say) and a metacity-1.xml for everything old.

Actual new features will be added starting with 3.1 - 3.0 is just the
version="" feature.

http://bugzilla.gnome.org/show_bug.cgi?id=592503
2010-04-13 13:40:16 -04:00
Owen W. Taylor
0ac46316af Clean up code to find themes
Simplify code to find the right theme to load and loading it by moving
all the loading code into a load_theme() helper function, and making
meta_load_theme() use that as it searches through the directories.

Look for old-version themes even when loading relative to the working
in debug mode.

Don't unnecessarily duplicate and then free info->theme_file and
info->theme_dir.

http://bugzilla.gnome.org/show_bug.cgi?id=592503
2010-04-13 11:15:10 -04:00
Owen W. Taylor
4d62977c7b Accept an empty string as well as "disabled" for keybindings
Treat the empty string the same as "disabled" for GConf keybinding
keys. gnome-keybinding-properties was changed to write disabled
keys as the empty string a year or so ago.

https://bugzilla.gnome.org/show_bug.cgi?id=559816
2010-02-11 13:02:50 -05:00