summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-10-15 15:39:12 +0300
committermonsta <[email protected]>2016-10-15 15:39:12 +0300
commit40e26ed6d0e9ef84522ad0723f630bd7d796beec (patch)
tree67374984e9b7d2c60525976a008889775f7de4f3 /src
parent3b69fd200912e27ce64caf3bf5d4338aab73177b (diff)
downloadmarco-40e26ed6d0e9ef84522ad0723f630bd7d796beec.tar.bz2
marco-40e26ed6d0e9ef84522ad0723f630bd7d796beec.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am16
-rw-r--r--src/compositor/compositor-private.h5
-rw-r--r--src/compositor/compositor-xrender.c29
-rw-r--r--src/compositor/compositor.c16
-rw-r--r--src/core/display.c11
-rw-r--r--src/core/errors.c264
-rw-r--r--src/core/main.c3
-rw-r--r--src/core/screen.c15
-rw-r--r--src/core/window-private.h1
-rw-r--r--src/include/compositor.h7
-rw-r--r--src/include/errors.h1
-rw-r--r--src/include/ui.h6
-rw-r--r--src/libmarco-private.pc.in2
-rw-r--r--src/tools/marco-mag.c37
-rw-r--r--src/tools/marco-window-demo.c324
-rw-r--r--src/ui/draw-workspace.c80
-rw-r--r--src/ui/draw-workspace.h4
-rw-r--r--src/ui/fixedtip.c65
-rw-r--r--src/ui/fixedtip.h3
-rw-r--r--src/ui/frames.c463
-rw-r--r--src/ui/frames.h12
-rw-r--r--src/ui/gradient.c177
-rw-r--r--src/ui/gradient.h21
-rw-r--r--src/ui/menu.c8
-rw-r--r--src/ui/metaaccellabel.c181
-rw-r--r--src/ui/preview-widget.c178
-rw-r--r--src/ui/preview-widget.h12
-rw-r--r--src/ui/resizepopup.c4
-rw-r--r--src/ui/tabpopup.c302
-rw-r--r--src/ui/testgradient.c160
-rw-r--r--src/ui/theme-viewer.c30
-rw-r--r--src/ui/theme.c627
-rw-r--r--src/ui/theme.h115
-rw-r--r--src/ui/tile-preview.c111
-rw-r--r--src/ui/ui.c206
-rw-r--r--src/wm-tester/main.c24
36 files changed, 77 insertions, 3443 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4ecd110c..f6982fb0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -125,11 +125,7 @@ libmarco_private_la_SOURCES = \
ui/theme.c \
ui/theme.h
-if HAVE_GTK3
libmarco_private_la_LDFLAGS = -no-undefined -version-info 1:0:0
-else
-libmarco_private_la_LDFLAGS = -no-undefined -version-info 0:0:0
-endif
libmarco_private_la_LIBADD = @MARCO_LIBS@
libmarcoincludedir = $(includedir)/marco-1/marco-private
@@ -143,18 +139,18 @@ libmarcoinclude_HEADERS = \
ui/theme-parser.h \
ui/theme.h
-marco_theme_viewer_SOURCES= \
- ui/theme-viewer.c
+#marco_theme_viewer_SOURCES= \
+# ui/theme-viewer.c
bin_PROGRAMS=marco
-if HAVE_GTK2
-bin_PROGRAMS += marco-theme-viewer
-endif
+# FIXME make it buildable with GTK+3
+#bin_PROGRAMS += marco-theme-viewer
EFENCE=
marco_LDADD=@MARCO_LIBS@ $(EFENCE)
-marco_theme_viewer_LDADD= @MARCO_LIBS@ libmarco-private.la
+
+#marco_theme_viewer_LDADD= @MARCO_LIBS@ libmarco-private.la
testboxes_SOURCES=include/util.h core/util.c include/boxes.h core/boxes.c core/testboxes.c
testgradient_SOURCES=ui/gradient.h ui/gradient.c ui/testgradient.c
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index 1eef9633..1fa64695 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -44,13 +44,8 @@ struct _MetaCompositor
void (*process_event) (MetaCompositor *compositor,
XEvent *event,
MetaWindow *window);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *(* get_window_surface) (MetaCompositor *compositor,
MetaWindow *window);
-#else
- Pixmap (*get_window_pixmap) (MetaCompositor *compositor,
- MetaWindow *window);
-#endif
void (*set_active_window) (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window);
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index 1da598c5..4ad4a6aa 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -36,9 +36,7 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <cairo/cairo-xlib.h>
-#endif
#include "display.h"
#include "screen.h"
@@ -2802,7 +2800,6 @@ xrender_process_event (MetaCompositor *compositor,
#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_surface_t *
xrender_get_window_surface (MetaCompositor *compositor,
MetaWindow *window)
@@ -2841,28 +2838,6 @@ xrender_get_window_surface (MetaCompositor *compositor,
cw->attrs.width, cw->attrs.height);
#endif
}
-#else
-static Pixmap
-xrender_get_window_pixmap (MetaCompositor *compositor,
- MetaWindow *window)
-{
-#ifdef HAVE_COMPOSITE_EXTENSIONS
- MetaCompWindow *cw = NULL;
- MetaScreen *screen = meta_window_get_screen (window);
- MetaFrame *frame = meta_window_get_frame (window);
-
- cw = find_window_for_screen (screen, frame ? meta_frame_get_xwindow (frame) :
- meta_window_get_xwindow (window));
- if (cw == NULL)
- return None;
-
- if (meta_window_is_shaded (window))
- return cw->shaded_back_pixmap;
- else
- return cw->back_pixmap;
-#endif
-}
-#endif /* GTK_CHECK_VERSION */
static void
xrender_set_active_window (MetaCompositor *compositor,
@@ -3046,11 +3021,7 @@ static MetaCompositor comp_info = {
xrender_remove_window,
xrender_set_updates,
xrender_process_event,
-#if GTK_CHECK_VERSION (3, 0, 0)
xrender_get_window_surface,
-#else
- xrender_get_window_pixmap,
-#endif
xrender_set_active_window,
xrender_free_window,
xrender_maximize_window,
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 4d3f370b..39344e82 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -107,7 +107,6 @@ meta_compositor_process_event (MetaCompositor *compositor,
#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *
meta_compositor_get_window_surface (MetaCompositor *compositor,
MetaWindow *window)
@@ -121,21 +120,6 @@ meta_compositor_get_window_surface (MetaCompositor *compositor,
return NULL;
#endif
}
-#else
-Pixmap
-meta_compositor_get_window_pixmap (MetaCompositor *compositor,
- MetaWindow *window)
-{
-#ifdef HAVE_COMPOSITE_EXTENSIONS
- if (compositor && compositor->get_window_pixmap)
- return compositor->get_window_pixmap (compositor, window);
- else
- return None;
-#else
- return None;
-#endif
-}
-#endif /* GTK_CHECK_VERSION */
void
meta_compositor_set_active_window (MetaCompositor *compositor,
diff --git a/src/core/display.c b/src/core/display.c
index caa76247..7b3ec502 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1471,23 +1471,15 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent)
* (client-side) subwindow for individual menu items.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *device_manager = gdk_display_get_device_manager (gdk_display);
GdkDevice *device = gdk_device_manager_get_client_pointer (device_manager);
if (gdk_display_device_is_grabbed(gdk_display, device))
-#else
- if (gdk_display_pointer_is_grabbed(gdk_display))
-#endif
{
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
if (gdk_display_device_is_grabbed(gdk_display, device))
-#else
- if (gdk_display_pointer_is_grabbed(gdk_display))
-#endif
{
return FALSE;
}
@@ -1586,9 +1578,8 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent)
g_assert_not_reached();
break;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
gdk_event_set_device (gdk_event, device);
-#endif
/* If we've gotten here, we've filled in the gdk_event and should send it on */
gtk_main_do_event(gdk_event);
diff --git a/src/core/errors.c b/src/core/errors.c
index c2cf82d0..19d2e015 100644
--- a/src/core/errors.c
+++ b/src/core/errors.c
@@ -30,23 +30,6 @@
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static int x_error_handler (Display *display,
- XErrorEvent *error);
-static int x_io_error_handler (Display *display);
-#endif
-
-void
-meta_errors_init (void)
-{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- XSetErrorHandler (x_error_handler);
- XSetIOErrorHandler (x_io_error_handler);
-#endif
-}
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-
void
meta_error_trap_push (MetaDisplay *display)
{
@@ -73,250 +56,3 @@ meta_error_trap_pop_with_return (MetaDisplay *display,
return gdk_error_trap_pop ();
}
-#else
-
-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)
-{
- /* GDK resets the error handler on each push */
- int (* old_error_handler) (Display *,
- XErrorEvent *);
-
- if (need_sync)
- {
- XSync (display->xdisplay, False);
- }
-
- gdk_error_trap_push ();
-
- /* old_error_handler will just be equal to x_error_handler
- * for nested traps
- */
- old_error_handler = XSetErrorHandler (x_error_handler);
-
- /* Replace GDK handler, but save it so we can chain up */
- if (display->error_trap_handler == NULL)
- {
- g_assert (display->error_traps == 0);
- display->error_trap_handler = old_error_handler;
- g_assert (display->error_trap_handler != x_error_handler);
- }
-
- display->error_traps += 1;
-
- meta_topic (META_DEBUG_ERRORS, "%d traps remain\n", display->error_traps);
-}
-
-static int
-meta_error_trap_pop_internal (MetaDisplay *display,
- gboolean need_sync)
-{
- int result;
-
- g_assert (display->error_traps > 0);
-
- if (need_sync)
- {
- XSync (display->xdisplay, False);
- }
-
- result = gdk_error_trap_pop ();
-
- display->error_traps -= 1;
-
- if (display->error_traps == 0)
- {
- /* check that GDK put our handler back; this
- * assumes that there are no pending GDK traps from GDK itself
- */
-
- XSetErrorHandler (x_error_handler);
-
- /* remove this */
- display->error_trap_handler = NULL;
- }
-
- meta_topic (META_DEBUG_ERRORS, "%d traps\n", display->error_traps);
-
- return result;
-}
-
-void
-meta_error_trap_push (MetaDisplay *display)
-{
- meta_error_trap_push_internal (display, FALSE);
-}
-
-void
-meta_error_trap_pop (MetaDisplay *display,
- gboolean last_request_was_roundtrip)
-{
- gboolean need_sync;
-
- /* we only have to sync when popping the outermost trap */
- need_sync = (display->error_traps == 1 && !last_request_was_roundtrip);
-
- if (need_sync)
- meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_pop, traps = %d, roundtrip = %d\n",
- display->error_traps, last_request_was_roundtrip);
-
- display->error_trap_synced_at_last_pop = need_sync || last_request_was_roundtrip;
-
- meta_error_trap_pop_internal (display, need_sync);
-}
-
-void
-meta_error_trap_push_with_return (MetaDisplay *display)
-{
- gboolean need_sync;
-
- /* We don't sync on push_with_return if there are no traps
- * currently, because we assume that any errors were either covered
- * by a previous pop, or were fatal.
- *
- * More generally, we don't sync if we were synchronized last time
- * we popped. This is known to be the case if there are no traps,
- * but we also keep a flag so we know whether it's the case otherwise.
- */
-
- if (!display->error_trap_synced_at_last_pop)
- need_sync = TRUE;
- else
- need_sync = FALSE;
-
- if (need_sync)
- meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_push_with_return, traps = %d\n",
- display->error_traps);
-
- meta_error_trap_push_internal (display, FALSE);
-}
-
-int
-meta_error_trap_pop_with_return (MetaDisplay *display,
- gboolean last_request_was_roundtrip)
-{
- if (!last_request_was_roundtrip)
- meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_pop_with_return, traps = %d, roundtrip = %d\n",
- display->error_traps, last_request_was_roundtrip);
-
- display->error_trap_synced_at_last_pop = TRUE;
-
- return meta_error_trap_pop_internal (display,
- !last_request_was_roundtrip);
-}
-
-static int
-x_error_handler (Display *xdisplay,
- XErrorEvent *error)
-{
- 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);
-
- /* Display can be NULL here because the compositing manager
- * has its own Display, but Xlib only has one global error handler
- */
- if (display->error_traps > 0)
- {
- /* we're in an error trap, chain to the trap handler
- * saved from GDK
- */
- meta_verbose ("X error: %s serial %ld error_code %d request_code %d minor_code %d)\n",
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
-
- g_assert (display->error_trap_handler != NULL);
- g_assert (display->error_trap_handler != x_error_handler);
-
- retval = (* display->error_trap_handler) (xdisplay, error);
- }
- else
- {
- meta_bug ("Unexpected X error: %s serial %ld error_code %d request_code %d minor_code %d)\n",
- buf,
- error->serial,
- error->error_code,
- error->request_code,
- error->minor_code);
-
- retval = 1; /* compiler warning */
- }
-
- return retval;
-}
-
-static int
-x_io_error_handler (Display *xdisplay)
-{
- MetaDisplay *display;
-
- display = meta_display_for_x_display (xdisplay);
-
- if (display == NULL)
- meta_bug ("IO error received for unknown display?\n");
-
- if (errno == EPIPE)
- {
- meta_warning (_("Lost connection to the display '%s';\n"
- "most likely the X server was shut down or you killed/destroyed\n"
- "the window manager.\n"),
- display->name);
- }
- else
- {
- meta_warning (_("Fatal IO error %d (%s) on display '%s'.\n"),
- errno, g_strerror (errno),
- display->name);
- }
-
- /* Xlib would force an exit anyhow */
- exit (1);
-
- return 0;
-}
-
-#endif
diff --git a/src/core/main.c b/src/core/main.c
index d6d789e2..b5ffccf1 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -482,9 +482,6 @@ main (int argc, char **argv)
meta_ui_init (&argc, &argv);
- /* must be after UI init so we can override GDK handlers */
- meta_errors_init ();
-
/* Load prefs */
meta_prefs_init ();
meta_prefs_add_listener (prefs_changed_callback, NULL);
diff --git a/src/core/screen.c b/src/core/screen.c
index 162046e8..3c1caf61 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1220,27 +1220,15 @@ get_window_pixbuf (MetaWindow *window,
int *width,
int *height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *surface;
-#else
- Pixmap pmap;
-#endif
GdkPixbuf *pixbuf, *scaled;
double ratio;
-#if GTK_CHECK_VERSION (3, 0, 0)
surface = meta_compositor_get_window_surface (window->display->compositor,
window);
if (surface == None)
return NULL;
-#else
- pmap = meta_compositor_get_window_pixmap (window->display->compositor,
- window);
- if (pmap == None)
- return NULL;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
meta_error_trap_push (NULL);
pixbuf = meta_ui_get_pixbuf_from_surface (surface);
@@ -1248,9 +1236,6 @@ get_window_pixbuf (MetaWindow *window,
if (meta_error_trap_pop_with_return (NULL, FALSE) != Success)
g_clear_object (&pixbuf);
-#else
- pixbuf = meta_ui_get_pixbuf_from_pixmap (pmap);
-#endif
if (pixbuf == NULL)
return NULL;
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 88713101..b3871bb8 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -42,6 +42,7 @@
#include "iconcache.h"
#include <X11/Xutil.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gtk/gtk.h>
typedef struct _MetaGroup MetaGroup;
typedef struct _MetaWindowQueue MetaWindowQueue;
diff --git a/src/include/compositor.h b/src/include/compositor.h
index 0eebe569..7ff380ad 100644
--- a/src/include/compositor.h
+++ b/src/include/compositor.h
@@ -23,8 +23,8 @@
#define META_COMPOSITOR_H
#include <glib.h>
-#include <gtk/gtk.h>
#include <X11/Xlib.h>
+#include <cairo/cairo.h>
#include "types.h"
#include "boxes.h"
@@ -51,13 +51,8 @@ void meta_compositor_set_updates (MetaCompositor *compositor,
void meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
MetaWindow *window);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *meta_compositor_get_window_surface (MetaCompositor *compositor,
MetaWindow *window);
-#else
-Pixmap meta_compositor_get_window_pixmap (MetaCompositor *compositor,
- MetaWindow *window);
-#endif
void meta_compositor_set_active_window (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window);
diff --git a/src/include/errors.h b/src/include/errors.h
index 338dd784..825cd9ff 100644
--- a/src/include/errors.h
+++ b/src/include/errors.h
@@ -33,7 +33,6 @@ 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);
diff --git a/src/include/ui.h b/src/include/ui.h
index 4705eda2..fc7b6b0a 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -29,8 +29,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <glib.h>
-#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <cairo/cairo.h>
/* This is between GTK_PRIORITY_RESIZE (+10) and GDK_PRIORITY_REDRAW (+20) */
#define META_PRIORITY_RESIZE (G_PRIORITY_HIGH_IDLE + 15)
@@ -177,11 +177,7 @@ int meta_ui_get_drag_threshold (MetaUI *ui);
MetaUIDirection meta_ui_get_direction (void);
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf *meta_ui_get_pixbuf_from_surface (cairo_surface_t *surface);
-#else
-GdkPixbuf *meta_ui_get_pixbuf_from_pixmap (Pixmap pmap);
-#endif
#include "tabpopup.h"
#include "tile-preview.h"
diff --git a/src/libmarco-private.pc.in b/src/libmarco-private.pc.in
index f20b9eb2..8abcd2b4 100644
--- a/src/libmarco-private.pc.in
+++ b/src/libmarco-private.pc.in
@@ -6,7 +6,7 @@ libmate_serverdir=@libexecdir@
Name: libmarco-private
Description: Marco internals shared
-Requires: gtk+-@GTK_API_VERSION@
+Requires: gtk+-3.0
Version: @VERSION@
Libs: -L${libdir} -lmarco-private
Cflags: -I${includedir}/marco-1
diff --git a/src/tools/marco-mag.c b/src/tools/marco-mag.c
index 4b9f16c3..6201e7f2 100644
--- a/src/tools/marco-mag.c
+++ b/src/tools/marco-mag.c
@@ -53,15 +53,7 @@ get_pixbuf (void)
#endif
- #if GTK_CHECK_VERSION(3, 0, 0)
screenshot = gdk_pixbuf_get_from_window(gdk_get_default_root_window(), last_grab_x, last_grab_y, last_grab_width, last_grab_height);
- #else
- screenshot = gdk_pixbuf_get_from_drawable (NULL, gdk_get_default_root_window (),
- NULL,
- last_grab_x, last_grab_y, 0, 0,
- last_grab_width, last_grab_height);
- #endif
-
if (screenshot == NULL)
{
g_printerr ("Screenshot failed\n");
@@ -154,16 +146,11 @@ grab_area_at_mouse (GtkWidget *invisible,
static void
shutdown_grab (void)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *manager = gdk_display_get_device_manager (gdk_display_get_default ());
GdkDevice *device = gdk_device_manager_get_client_pointer (manager);
gdk_device_ungrab (device, gtk_get_current_event_time ());
gdk_device_ungrab (gdk_device_get_associated_device (device), gtk_get_current_event_time ());
-#else
- gdk_keyboard_ungrab (gtk_get_current_event_time ());
- gdk_pointer_ungrab (gtk_get_current_event_time ());
-#endif
gtk_grab_remove (grab_widget);
}
@@ -240,11 +227,9 @@ mouse_press (GtkWidget *invisible,
static void
begin_area_grab (void)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkWindow *window;
GdkDeviceManager *manager;
GdkDevice *device;
-#endif
if (grab_widget == NULL)
{
@@ -256,7 +241,6 @@ begin_area_grab (void)
gtk_widget_show (grab_widget);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
window = gtk_widget_get_window (grab_widget);
manager = gdk_display_get_device_manager (gdk_display_get_default ());
device = gdk_device_manager_get_client_pointer (manager);
@@ -285,27 +269,6 @@ begin_area_grab (void)
g_warning ("Failed to grab keyboard to do eyedropper");
return;
}
-#else
- if (gdk_keyboard_grab (gtk_widget_get_window (grab_widget),
- FALSE,
- gtk_get_current_event_time ()) != GDK_GRAB_SUCCESS)
- {
- g_warning ("Failed to grab keyboard to do eyedropper");
- return;
- }
-
- if (gdk_pointer_grab (gtk_widget_get_window (grab_widget),
- FALSE,
- GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK,
- NULL,
- NULL,
- gtk_get_current_event_time ()) != GDK_GRAB_SUCCESS)
- {
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
- g_warning ("Failed to grab pointer to do eyedropper");
- return;
- }
-#endif
gtk_grab_add (grab_widget);
diff --git a/src/tools/marco-window-demo.c b/src/tools/marco-window-demo.c
index e19f0716..ce4f3f73 100644
--- a/src/tools/marco-window-demo.c
+++ b/src/tools/marco-window-demo.c
@@ -24,19 +24,10 @@
#include <X11/Xatom.h>
#include <unistd.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X, Y) gtk_box_new(GTK_ORIENTATION_VERTICAL, Y)
-#define gtk_hbox_new(X, Y) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, Y)
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
do_appwindow (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
-#else
-static GtkWidget* do_appwindow (void);
-#endif
static gboolean aspect_on;
@@ -249,11 +240,7 @@ main (int argc, char **argv)
g_error_free (err);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
do_appwindow (NULL, NULL, NULL);
-#else
- do_appwindow ();
-#endif
gtk_main ();
@@ -319,30 +306,18 @@ response_cb (GtkDialog *dialog,
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
dialog_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-dialog_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
make_dialog (GTK_WIDGET (callback_data), 1);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
modal_dialog_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-modal_dialog_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *dialog;
@@ -359,30 +334,18 @@ modal_dialog_cb (GtkAction *action,
gtk_widget_destroy (dialog);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
no_parent_dialog_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-no_parent_dialog_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
make_dialog (NULL, 1);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
utility_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-utility_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *vbox;
@@ -394,7 +357,7 @@ utility_cb (GtkAction *action,
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -413,16 +376,10 @@ utility_cb (GtkAction *action,
gtk_widget_show_all (window);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
toolbar_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-toolbar_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *vbox;
@@ -434,7 +391,7 @@ toolbar_cb (GtkAction *action,
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -444,16 +401,10 @@ toolbar_cb (GtkAction *action,
gtk_widget_show_all (window);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
menu_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-menu_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *vbox;
@@ -465,7 +416,7 @@ menu_cb (GtkAction *action,
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -475,16 +426,10 @@ menu_cb (GtkAction *action,
gtk_widget_show_all (window);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
override_redirect_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-override_redirect_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *vbox;
@@ -493,7 +438,7 @@ override_redirect_cb (GtkAction *action,
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_title (GTK_WINDOW (window), "Override Redirect");
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -503,16 +448,10 @@ override_redirect_cb (GtkAction *action,
gtk_widget_show_all (window);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
border_only_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-border_only_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *vbox;
@@ -524,7 +463,7 @@ border_only_cb (GtkAction *action,
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (callback_data));
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -579,16 +518,10 @@ focus_label (GtkWidget *window)
return label;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
splashscreen_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-splashscreen_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *image;
@@ -598,7 +531,7 @@ splashscreen_cb (GtkAction *action,
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_SPLASHSCREEN");
gtk_window_set_title (GTK_WINDOW (window), "Splashscreen");
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
@@ -634,11 +567,11 @@ make_dock (int type)
{
case DOCK_LEFT:
case DOCK_RIGHT:
- box = gtk_vbox_new (FALSE, 0);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
break;
case DOCK_TOP:
case DOCK_BOTTOM:
- box = gtk_hbox_new (FALSE, 0);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
break;
case DOCK_ALL:
break;
@@ -694,21 +627,14 @@ make_dock (int type)
gtk_widget_show_all (window);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
dock_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-dock_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
guint callback_action;
const gchar *name;
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_get (G_OBJECT (action), "name", &name, NULL);
if (!g_strcmp0 (name, "top-dock"))
@@ -723,22 +649,7 @@ dock_cb (GtkAction *action,
callback_action = DOCK_ALL;
else
return;
-#else
- name = gtk_action_get_name (action);
- if (!g_strcmp0 (name, "Top dock"))
- callback_action = DOCK_TOP;
- else if (!g_strcmp0 (name, "Bottom dock"))
- callback_action = DOCK_BOTTOM;
- else if (!g_strcmp0 (name, "Left dock"))
- callback_action = DOCK_LEFT;
- else if (!g_strcmp0 (name, "Right dock"))
- callback_action = DOCK_RIGHT;
- else if (!g_strcmp0 (name, "All docks"))
- callback_action = DOCK_ALL;
- else
- return;
-#endif
if (callback_action == DOCK_ALL)
{
make_dock (DOCK_TOP);
@@ -774,24 +685,14 @@ override_background_color (GtkWidget *widget,
}
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
desktop_cb (GSimpleAction *action,
GVariant *parameter,
gpointer callback_data)
-#else
-static void
-desktop_cb (GtkAction *action,
- gpointer callback_data)
-#endif
{
GtkWidget *window;
GtkWidget *label;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA desktop_color;
-#else
- GdkColor desktop_color;
-#endif
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DESKTOP");
@@ -800,7 +701,6 @@ desktop_cb (GtkAction *action,
gdk_screen_width (), gdk_screen_height ());
gtk_window_move (GTK_WINDOW (window), 0, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
desktop_color.red = 0.32;
desktop_color.green = 0.46;
desktop_color.blue = 0.65;
@@ -811,13 +711,6 @@ desktop_cb (GtkAction *action,
#else
gtk_widget_override_background_color (window, 0, &desktop_color);
#endif
-#else
- desktop_color.red = 0x5144;
- desktop_color.green = 0x75D6;
- desktop_color.blue = 0xA699;
-
- gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &desktop_color);
-#endif
label = focus_label (window);
@@ -826,30 +719,18 @@ desktop_cb (GtkAction *action,
gtk_widget_show_all (window);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
sleep_cb (GSimpleAction *action,
GVariant *parameter,
gpointer data)
-#else
-static void
-sleep_cb (GtkAction *action,
- gpointer data)
-#endif
{
sleep (1000);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
toggle_aspect_ratio (GSimpleAction *action,
GVariant *parameter,
gpointer data)
-#else
-static void
-toggle_aspect_ratio (GtkAction *action,
- gpointer data)
-#endif
{
GtkWidget *window;
GdkGeometry geom;
@@ -877,16 +758,10 @@ toggle_aspect_ratio (GtkAction *action,
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
toggle_decorated_cb (GSimpleAction *action,
GVariant *parameter,
gpointer data)
-#else
-static void
-toggle_decorated_cb (GtkWidget *button,
- gpointer data)
-#endif
{
GtkWidget *window;
window = gtk_widget_get_ancestor (data, GTK_TYPE_WINDOW);
@@ -895,16 +770,10 @@ toggle_decorated_cb (GtkWidget *button,
!gtk_window_get_decorated (GTK_WINDOW (window)));
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
clicked_toolbar_cb (GSimpleAction *action,
GVariant *parameter,
gpointer data)
-#else
-static void
-clicked_toolbar_cb (GtkWidget *button,
- gpointer data)
-#endif
{
GtkWidget *dialog;
@@ -970,7 +839,6 @@ destroy_cb (GtkWidget *w, gpointer data)
gtk_main_quit ();
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static const gchar *xml =
"<interface>"
"<menu id='menubar'>"
@@ -1106,114 +974,17 @@ create_toolbar (void)
return toolbar;
}
-#else
-static const gchar *menu_item_string =
- "<ui>\n"
- "<menubar>\n"
- "<menu name='Windows' action='Windows'>\n"
- "<menuitem name='Dialog' action='Dialog'/>\n"
- "<menuitem name='Modal dialog' action='Modal dialog'/>\n"
- "<menuitem name='Parentless dialog' action='Parentless dialog'/>\n"
- "<menuitem name='Utility' action='Utility'/>\n"
- "<menuitem name='Splashscreen' action='Splashscreen'/>\n"
- "<menuitem name='Top dock' action='Top dock'/>\n"
- "<menuitem name='Bottom dock' action='Bottom dock'/>\n"
- "<menuitem name='Left dock' action='Left dock'/>\n"
- "<menuitem name='Right dock' action='Right dock'/>\n"
- "<menuitem name='All docks' action='All docks'/>\n"
- "<menuitem name='Desktop' action='Desktop'/>\n"
- "<menuitem name='Menu' action='Menu'/>\n"
- "<menuitem name='Toolbar' action='Toolbar'/>\n"
- "<menuitem name='Override Redirect' action='Override Redirect'/>\n"
- "<menuitem name='Border Only' action='Border Only'/>\n"
- "</menu>\n"
- "</menubar>\n"
- "<toolbar>\n"
- "<toolitem name='New' action='New'/>\n"
- "<toolitem name='Lock' action='Lock'/>\n"
- "<toolitem name='Decorations' action='Decorations'/>\n"
- "<toolitem name='Ratio' action='Ratio'/>\n"
- "<toolitem name='Quit' action='Quit'/>\n"
- "</toolbar>\n"
- "</ui>\n";
-
-static const GtkActionEntry menu_items[] =
-{
- { "Windows", NULL, "_Windows", NULL,
- NULL, NULL },
- { "Dialog", NULL, "_Dialog", "<control>d",
- NULL, G_CALLBACK (dialog_cb) },
- { "Modal dialog", NULL, "_Modal dialog", NULL,
- NULL, G_CALLBACK (modal_dialog_cb) },
- { "Parentless dialog", NULL, "_Parentless dialog", NULL,
- NULL, G_CALLBACK (no_parent_dialog_cb) },
- { "Utility", NULL, "_Utility", "<control>u",
- NULL, G_CALLBACK (utility_cb) },
- { "Splashscreen", NULL, "_Splashscreen", "<control>s",
- NULL, G_CALLBACK (splashscreen_cb) },
- { "Top dock", NULL, "_Top dock", NULL,
- NULL, G_CALLBACK (dock_cb) },
- { "Bottom dock", NULL, "_Bottom dock", NULL,
- NULL, G_CALLBACK (dock_cb) },
- { "Left dock", NULL, "_Left dock", NULL,
- NULL, G_CALLBACK (dock_cb) },
- { "Right dock", NULL, "_Right dock", NULL,
- NULL, G_CALLBACK (dock_cb) },
- { "All docks", NULL, "_All docks", NULL,
- NULL, G_CALLBACK (dock_cb) },
- { "Desktop", NULL, "Des_ktop", NULL,
- NULL, G_CALLBACK (desktop_cb) },
- { "Menu", NULL, "Me_nu", NULL,
- NULL, G_CALLBACK (menu_cb) },
- { "Toolbar", NULL, "Tool_bar", NULL,
- NULL, G_CALLBACK (toolbar_cb) },
- { "Override Redirect", NULL, "Override Redirect", NULL,
- NULL, G_CALLBACK (override_redirect_cb) },
- { "Border Only", NULL, "Border Only", NULL,
- NULL, G_CALLBACK (border_only_cb) }
-};
-static const GtkActionEntry tool_items[] =
-{
- { "New", GTK_STOCK_NEW, NULL, NULL,
- "Open another one of these windows", G_CALLBACK (do_appwindow) },
- { "Lock", GTK_STOCK_OPEN, NULL, NULL,
- "This is a demo button that"
- " locks up the demo", G_CALLBACK (sleep_cb) },
- { "Decorations", GTK_STOCK_OPEN, NULL, NULL,
- "This is a demo button that "
- "toggles window decorations", G_CALLBACK (toggle_decorated_cb) },
- { "Quit", GTK_STOCK_QUIT, NULL, NULL,
- "This is a demo button with "
- " a 'quit' icon", G_CALLBACK (clicked_toolbar_cb) },
- { "Ratio", GTK_STOCK_OPEN, NULL, NULL,
- "This is a demo button that locks the aspect ratio "
- "using a hint", G_CALLBACK (toggle_aspect_ratio) }
-};
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
do_appwindow (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
-#else
-static GtkWidget *
-do_appwindow (void)
-#endif
{
GtkWidget *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
GtkWidget *toolbar;
GSimpleActionGroup *action_group;
GtkBuilder *builder;
-#else
- GtkWidget *table;
- GtkWidget *handlebox;
- GtkActionGroup *action_group;
- GtkUIManager *ui_manager;
-#endif
GtkWidget *statusbar;
GtkWidget *contents;
GtkWidget *sw;
@@ -1232,20 +1003,13 @@ do_appwindow (void)
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy_cb), NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
gtk_widget_set_vexpand (grid, TRUE);
gtk_widget_set_hexpand (grid, TRUE);
gtk_container_add (GTK_CONTAINER (window), grid);
-#else
- table = gtk_table_new (1, 4, FALSE);
-
- gtk_container_add (GTK_CONTAINER (window), table);
-#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
action_group = g_simple_action_group_new ();
builder = gtk_builder_new_from_string (xml, -1);
@@ -1269,37 +1033,6 @@ do_appwindow (void)
toolbar = create_toolbar ();
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 1, 1, 1);
gtk_widget_set_hexpand (toolbar, TRUE);
-#else
-
- /* Create the menubar
- */
-
- action_group = gtk_action_group_new ("mainmenu");
- gtk_action_group_add_actions (action_group,
- menu_items,
- G_N_ELEMENTS (menu_items),
- window);
- gtk_action_group_add_actions (action_group,
- tool_items,
- G_N_ELEMENTS (tool_items),
- window);
-
- ui_manager = gtk_ui_manager_new ();
-
- gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
-
- /* create menu items */
- gtk_ui_manager_add_ui_from_string (ui_manager, menu_item_string, -1, NULL);
-
- gtk_table_attach (GTK_TABLE (table),
- gtk_ui_manager_get_widget (ui_manager, "/ui/menubar"),
- /* X direction */ /* Y direction */
- 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
-
-
-#endif
/* Create document
*/
@@ -1313,19 +1046,10 @@ do_appwindow (void)
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (GTK_GRID (grid), sw, 0, 2, 1, 1);
gtk_widget_set_hexpand (sw, TRUE);
gtk_widget_set_vexpand (sw, TRUE);
-#else
- gtk_table_attach (GTK_TABLE (table),
- sw,
- /* X direction */ /* Y direction */
- 0, 1, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
- 0, 0);
-#endif
gtk_window_set_default_size (GTK_WINDOW (window),
200, 200);
@@ -1337,36 +1061,11 @@ do_appwindow (void)
gtk_container_add (GTK_CONTAINER (sw),
contents);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- /* Create the toolbar
- */
-
- handlebox = gtk_handle_box_new ();
-
- gtk_container_add (GTK_CONTAINER (handlebox),
- gtk_ui_manager_get_widget (ui_manager, "/ui/toolbar"));
-
- gtk_table_attach (GTK_TABLE (table),
- handlebox,
- /* X direction */ /* Y direction */
- 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
-#endif
/* Create statusbar */
statusbar = gtk_statusbar_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (GTK_GRID (grid), statusbar, 0, 3, 1, 1);
gtk_widget_set_hexpand (statusbar, TRUE);
-#else
- gtk_table_attach (GTK_TABLE (table),
- statusbar,
- /* X direction */ /* Y direction */
- 0, 1, 3, 4,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
-#endif
/* Show text widget info in the statusbar */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
@@ -1394,13 +1093,6 @@ do_appwindow (void)
gtk_widget_show_all (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (action_group);
g_object_unref (builder);
-#else
- g_object_unref (ui_manager);
- return window;
-#endif
}
-
-
diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c
index 694dcae1..bec502a5 100644
--- a/src/ui/draw-workspace.c
+++ b/src/ui/draw-workspace.c
@@ -88,42 +88,24 @@ get_background_color (GtkStyleContext *context,
static void
draw_window (GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- #endif
const WnckWindowDisplayInfo *win,
const GdkRectangle *winrect,
GtkStateType state)
{
- #if !GTK_CHECK_VERSION(3, 0, 0)
- cairo_t *cr;
- #endif
-
GdkPixbuf *icon;
int icon_x, icon_y, icon_w, icon_h;
gboolean is_active;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
GtkStyleContext *style;
-#else
- GdkColor *color;
- GtkStyle *style;
-#endif
is_active = win->is_active;
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_save (cr);
- #else
- cr = gdk_cairo_create (drawable);
- #endif
cairo_rectangle (cr, winrect->x, winrect->y, winrect->width, winrect->height);
cairo_clip (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
style = gtk_widget_get_style_context (widget);
if (is_active)
meta_gtk_style_get_light_color (style, state, &color);
@@ -134,17 +116,6 @@ draw_window (GtkWidget *widget,
gtk_style_context_get_background_color (style, state, &color);
#endif
gdk_cairo_set_source_rgba (cr, &color);
-#else
- style = gtk_widget_get_style (widget);
- if (is_active)
- color = &style->light[state];
- else
- color = &style->bg[state];
- cairo_set_source_rgb (cr,
- color->red / 65535.,
- color->green / 65535.,
- color->blue / 65535.);
-#endif
cairo_rectangle (cr,
winrect->x + 1, winrect->y + 1,
@@ -195,37 +166,21 @@ draw_window (GtkWidget *widget,
cairo_restore (cr);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_get_color (style, state, &color);
gdk_cairo_set_source_rgba (cr, &color);
-#else
- color = &style->fg[state];
- cairo_set_source_rgb (cr,
- color->red / 65535.,
- color->green / 65535.,
- color->blue / 65535.);
-#endif
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr,
winrect->x + 0.5, winrect->y + 0.5,
MAX (0, winrect->width - 1), MAX (0, winrect->height - 1));
cairo_stroke (cr);
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_restore(cr);
- #else
- cairo_destroy (cr);
- #endif
}
void
wnck_draw_workspace (GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- #endif
int x,
int y,
int width,
@@ -239,13 +194,8 @@ wnck_draw_workspace (GtkWidget *widget,
{
int i;
GdkRectangle workspace_rect;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStateFlags state;
GtkStyleContext *style;
-#else
- GtkStateType state;
- cairo_t *cr;
-#endif
workspace_rect.x = x;
workspace_rect.y = y;
@@ -253,30 +203,14 @@ wnck_draw_workspace (GtkWidget *widget,
workspace_rect.height = height;
if (is_active)
-#if GTK_CHECK_VERSION (3, 0, 0)
state = GTK_STATE_FLAG_SELECTED;
-#else
- state = GTK_STATE_SELECTED;
-#endif
else if (workspace_background)
-#if GTK_CHECK_VERSION (3, 0, 0)
state = GTK_STATE_FLAG_PRELIGHT;
-#else
- state = GTK_STATE_PRELIGHT;
-#endif
else
-#if GTK_CHECK_VERSION (3, 0, 0)
state = GTK_STATE_FLAG_NORMAL;
-#else
- state = GTK_STATE_NORMAL;
-#endif
- #if GTK_CHECK_VERSION(3, 0, 0)
style = gtk_widget_get_style_context (widget);
cairo_save (cr);
- #else
- cr = gdk_cairo_create (drawable);
- #endif
if (workspace_background)
{
@@ -285,22 +219,14 @@ wnck_draw_workspace (GtkWidget *widget,
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
meta_gtk_style_get_dark_color (style,state, &color);
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->dark[state]);
-#endif
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
}
- #if !GTK_CHECK_VERSION(3, 0, 0)
- cairo_destroy (cr);
- #endif
-
i = 0;
while (i < n_windows)
{
@@ -311,11 +237,7 @@ wnck_draw_workspace (GtkWidget *widget,
screen_height, &workspace_rect, &winrect);
draw_window (widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cr,
- #else
- drawable,
- #endif
win,
&winrect,
state);
@@ -323,7 +245,5 @@ wnck_draw_workspace (GtkWidget *widget,
++i;
}
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_restore(cr);
- #endif
}
diff --git a/src/ui/draw-workspace.h b/src/ui/draw-workspace.h
index 59a6e6ed..d70568cb 100644
--- a/src/ui/draw-workspace.h
+++ b/src/ui/draw-workspace.h
@@ -46,11 +46,7 @@ typedef struct
} WnckWindowDisplayInfo;
void wnck_draw_workspace (GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- #endif
int x,
int y,
int width,
diff --git a/src/ui/fixedtip.c b/src/ui/fixedtip.c
index 573a670d..7de93d9b 100644
--- a/src/ui/fixedtip.c
+++ b/src/ui/fixedtip.c
@@ -22,6 +22,7 @@
*/
#include <config.h>
+#include <gtk/gtk.h>
#include "fixedtip.h"
#include "ui.h"
@@ -36,7 +37,6 @@ static GtkWidget *tip = NULL;
*/
static GtkWidget *label = NULL;
-#if GTK_CHECK_VERSION(3, 0, 0)
static GdkScreen *screen = NULL;
static gboolean
@@ -60,52 +60,20 @@ draw_handler (GtkWidget *widget,
return FALSE;
}
-#else
-/*
- * X coordinate of the right-hand edge of the screen.
- *
- * \bug This appears to be a bug; screen_right_edge is calculated only when
- * the window is redrawn. Actually we should never cache it because
- * different windows are different sizes.
- */
-static int screen_right_edge = 0;
-/*
- * Y coordinate of the bottom edge of the screen.
- *
- * \bug As with screen_right_edge.
- */
-static int screen_bottom_edge = 0;
-
-static gint
-expose_handler (GtkTooltip *tooltips)
-{
- gtk_paint_flat_box (gtk_widget_get_style (tip), gtk_widget_get_window (tip),
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, tip, "tooltip",
- 0, 0, -1, -1);
-
- return FALSE;
-}
-#endif
void
meta_fixed_tip_show (int screen_number,
int root_x, int root_y,
const char *markup_text)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
gint w;
gint h;
gint mon_num;
GdkRectangle monitor;
gint screen_right_edge;
-#else
- int w, h;
-#endif
if (tip == NULL)
{
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkVisual *visual;
tip = gtk_window_new (GTK_WINDOW_POPUP);
@@ -121,37 +89,10 @@ meta_fixed_tip_show (int screen_number,
if (visual != NULL)
gtk_widget_set_visual (tip, visual);
-#else
- tip = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_window_set_type_hint (GTK_WINDOW(tip), GDK_WINDOW_TYPE_HINT_TOOLTIP);
-
- {
- GdkScreen *gdk_screen;
- GdkRectangle monitor;
- gint mon_num;
-
- gdk_screen = gdk_display_get_screen (gdk_display_get_default (),
- screen_number);
- gtk_window_set_screen (GTK_WINDOW (tip),
- gdk_screen);
- mon_num = gdk_screen_get_monitor_at_point (gdk_screen, root_x, root_y);
- gdk_screen_get_monitor_geometry (gdk_screen, mon_num, &monitor);
- screen_right_edge = monitor.x + monitor.width;
- screen_bottom_edge = monitor.y + monitor.height;
- }
-#endif
gtk_widget_set_app_paintable (tip, TRUE);
gtk_window_set_resizable (GTK_WINDOW (tip), FALSE);
-#if GTK_CHECK_VERSION(3, 0, 0)
g_signal_connect (tip, "draw", G_CALLBACK (draw_handler), NULL);
-#else
- gtk_widget_set_name (tip, "gtk-tooltips");
- gtk_container_set_border_width (GTK_CONTAINER (tip), 4);
-
- g_signal_connect_swapped (tip, "expose_event",
- G_CALLBACK (expose_handler), NULL);
-#endif
label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
@@ -163,20 +104,16 @@ meta_fixed_tip_show (int screen_number,
#endif
gtk_widget_show (label);
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_container_set_border_width (GTK_CONTAINER (tip), 4);
-#endif
gtk_container_add (GTK_CONTAINER (tip), label);
g_signal_connect (tip, "destroy",
G_CALLBACK (gtk_widget_destroyed), &tip);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
mon_num = gdk_screen_get_monitor_at_point (screen, root_x, root_y);
gdk_screen_get_monitor_geometry (screen, mon_num, &monitor);
screen_right_edge = monitor.x + monitor.width;
-#endif
gtk_label_set_markup (GTK_LABEL (label), markup_text);
diff --git a/src/ui/fixedtip.h b/src/ui/fixedtip.h
index f20f0d2c..c108df92 100644
--- a/src/ui/fixedtip.h
+++ b/src/ui/fixedtip.h
@@ -40,9 +40,6 @@
#ifndef META_FIXED_TIP_H
#define META_FIXED_TIP_H
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-
/**
* Displays a tooltip. There can be only one across the entire system.
* This function behaves identically whether or not a tooltip is already
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 99260936..e87e13a8 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -39,26 +39,15 @@
#include <X11/extensions/shape.h>
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
- #include <cairo-xlib.h>
- #define GdkRegion cairo_region_t
- #define gdk_region_destroy cairo_region_destroy
- #define gdk_region_rectangle cairo_region_create_rectangle
- #define gdk_region_offset cairo_region_translate
- #define gdk_region_intersect cairo_region_intersect
- G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_INVISIBLE);
- #define parent_class meta_frames_parent_class
-#endif
+#include <cairo-xlib.h>
+
+G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_INVISIBLE);
#define DEFAULT_INNER_BUTTON_BORDER 3
static void meta_frames_class_init (MetaFramesClass *klass);
static void meta_frames_init (MetaFrames *frames);
-#if GTK_CHECK_VERSION(3, 0, 0)
static void meta_frames_destroy (GtkWidget *object);
-#else
-static void meta_frames_destroy (GtkObject *object);
-#endif
static void meta_frames_finalize (GObject *object);
static void meta_frames_style_set (GtkWidget *widget,
GtkStyle *prev_style);
@@ -76,13 +65,8 @@ static gboolean meta_frames_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event);
static gboolean meta_frames_destroy_event (GtkWidget *widget,
GdkEventAny *event);
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean meta_frames_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gboolean meta_frames_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
static gboolean meta_frames_enter_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean meta_frames_leave_notify_event (GtkWidget *widget,
@@ -93,14 +77,7 @@ static void meta_frames_attach_style (MetaFrames *frames,
static void meta_frames_paint_to_drawable (MetaFrames *frames,
MetaUIFrame *frame,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr);
- #else
- GdkDrawable *drawable,
- GdkRegion *region,
- int x_offset,
- int y_offset);
- #endif
static void meta_frames_set_window_background (MetaFrames *frames,
MetaUIFrame *frame);
@@ -130,37 +107,6 @@ static void invalidate_all_caches (MetaFrames *frames);
static void invalidate_whole_window (MetaFrames *frames,
MetaUIFrame *frame);
-#if !GTK_CHECK_VERSION(3, 0, 0)
-
-static GtkWidgetClass *parent_class = NULL;
-
-GType
-meta_frames_get_type (void)
-{
- static GType frames_type = 0;
-
- if (!frames_type)
- {
- static const GtkTypeInfo frames_info =
- {
- "MetaFrames",
- sizeof (MetaFrames),
- sizeof (MetaFramesClass),
- (GtkClassInitFunc) meta_frames_class_init,
- (GtkObjectInitFunc) meta_frames_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- frames_type = gtk_type_unique (GTK_TYPE_WINDOW, &frames_info);
- }
-
- return frames_type;
-}
-
-#endif
-
static GObject *
meta_frames_constructor (GType gtype,
guint n_properties,
@@ -169,7 +115,7 @@ meta_frames_constructor (GType gtype,
GObject *object;
GObjectClass *gobject_class;
- gobject_class = G_OBJECT_CLASS (parent_class);
+ gobject_class = G_OBJECT_CLASS (meta_frames_parent_class);
object = gobject_class->constructor (gtype, n_properties, properties);
g_object_set (object,
@@ -183,39 +129,19 @@ static void
meta_frames_class_init (MetaFramesClass *class)
{
GObjectClass *gobject_class;
- #if !GTK_CHECK_VERSION(3, 0, 0)
- GtkObjectClass *object_class;
- #endif
GtkWidgetClass *widget_class;
gobject_class = G_OBJECT_CLASS (class);
- #if !GTK_CHECK_VERSION(3, 0, 0)
- object_class = (GtkObjectClass*) class;
- #endif
widget_class = (GtkWidgetClass*) class;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- parent_class = g_type_class_peek_parent (class);
-#endif
-
gobject_class->constructor = meta_frames_constructor;
gobject_class->finalize = meta_frames_finalize;
- #if !GTK_CHECK_VERSION(3, 0, 0)
- object_class->destroy = meta_frames_destroy;
- #else
widget_class->destroy = meta_frames_destroy;
- #endif
-
widget_class->style_set = meta_frames_style_set;
-
widget_class->realize = meta_frames_realize;
widget_class->unrealize = meta_frames_unrealize;
- #if GTK_CHECK_VERSION(3, 0, 0)
widget_class->draw = meta_frames_draw;
- #else
- widget_class->expose_event = meta_frames_expose_event;
- #endif
widget_class->destroy_event = meta_frames_destroy_event;
widget_class->button_press_event = meta_frames_button_press_event;
widget_class->button_release_event = meta_frames_button_release_event;
@@ -290,13 +216,8 @@ listify_func (gpointer key, gpointer value, gpointer data)
*listp = g_slist_prepend (*listp, value);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static void
meta_frames_destroy (GtkWidget *object)
-#else
-static void
-meta_frames_destroy (GtkObject *object)
-#endif
{
GSList *winlist;
GSList *tmp;
@@ -320,11 +241,7 @@ meta_frames_destroy (GtkObject *object)
}
g_slist_free (winlist);
-#if GTK_CHECK_VERSION(3, 0, 0)
- GTK_WIDGET_CLASS (parent_class)->destroy (object);
-#else
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-#endif
+ GTK_WIDGET_CLASS (meta_frames_parent_class)->destroy (object);
}
static void
@@ -346,18 +263,13 @@ meta_frames_finalize (GObject *object)
g_hash_table_destroy (frames->frames);
g_hash_table_destroy (frames->cache);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_frames_parent_class)->finalize (object);
}
typedef struct
{
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_rectangle_int_t rect;
cairo_surface_t *pixmap;
- #else
- MetaRectangle rect;
- GdkPixmap *pixmap;
- #endif
} CachedFramePiece;
typedef struct
@@ -394,11 +306,7 @@ invalidate_cache (MetaFrames *frames,
for (i = 0; i < 4; i++)
if (pixels->piece[i].pixmap)
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_surface_destroy (pixels->piece[i].pixmap);
- #else
- g_object_unref (pixels->piece[i].pixmap);
- #endif
g_free (pixels);
g_hash_table_remove (frames->cache, frame);
@@ -525,7 +433,7 @@ meta_frames_style_set (GtkWidget *widget,
g_hash_table_foreach (frames->frames,
reattach_style_func, frames);
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (meta_frames_parent_class)->style_set (widget, prev_style);
}
static void
@@ -669,20 +577,9 @@ meta_frames_attach_style (MetaFrames *frames,
MetaUIFrame *frame)
{
if (frame->style != NULL)
-#if GTK_CHECK_VERSION(3, 0, 0)
g_object_unref (frame->style);
-#else
- gtk_style_detach (frame->style);
-#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
frame->style = g_object_ref (gtk_widget_get_style_context (GTK_WIDGET (frames)));
-#else
- /* Weirdly, gtk_style_attach() steals a reference count from the style passed in */
- g_object_ref (gtk_widget_get_style (GTK_WIDGET (frames)));
- frame->style = gtk_style_attach (gtk_widget_get_style (GTK_WIDGET (frames)),
- frame->window);
-#endif
}
void
@@ -753,11 +650,7 @@ meta_frames_unmanage_window (MetaFrames *frames,
g_hash_table_remove (frames->frames, &frame->xwindow);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (frame->style);
-#else
- gtk_style_detach (frame->style);
-#endif
gdk_window_destroy (frame->window);
@@ -776,15 +669,15 @@ meta_frames_unmanage_window (MetaFrames *frames,
static void
meta_frames_realize (GtkWidget *widget)
{
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ if (GTK_WIDGET_CLASS (meta_frames_parent_class)->realize)
+ GTK_WIDGET_CLASS (meta_frames_parent_class)->realize (widget);
}
static void
meta_frames_unrealize (GtkWidget *widget)
{
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+ if (GTK_WIDGET_CLASS (meta_frames_parent_class)->unrealize)
+ GTK_WIDGET_CLASS (meta_frames_parent_class)->unrealize (widget);
}
static MetaUIFrame*
@@ -1119,12 +1012,8 @@ meta_frames_move_resize_frame (MetaFrames *frames,
MetaUIFrame *frame = meta_frames_lookup_window (frames, xwindow);
int old_width, old_height;
-#if GTK_CHECK_VERSION(3, 0, 0)
old_width = gdk_window_get_width (frame->window);
old_height = gdk_window_get_height (frame->window);
-#else
- gdk_drawable_get_size(frame->window, &old_width, &old_height);
-#endif
gdk_window_move_resize (frame->window, x, y, width, height);
@@ -2042,12 +1931,8 @@ meta_frames_motion_notify_event (GtkWidget *widget,
MetaFrameControl control;
int x, y;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_device_position (frame->window, event->device,
&x, &y, NULL);
-#else
- gdk_window_get_pointer (frame->window, &x, &y, NULL);
-#endif
/* Control is set to none unless it matches
* the current grab
@@ -2092,12 +1977,8 @@ meta_frames_motion_notify_event (GtkWidget *widget,
MetaFrameControl control;
int x, y;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_device_position (frame->window, event->device,
&x, &y, NULL);
-#else
- gdk_window_get_pointer (frame->window, &x, &y, NULL);
-#endif
control = get_control (frames, frame, x, y);
@@ -2153,35 +2034,8 @@ setup_bg_cr (cairo_t *cr, GdkWindow *window, int x_offset, int y_offset)
}
}
-#if !GTK_CHECK_VERSION(3, 0, 0)
-static void
-clear_backing (GdkPixmap *pixmap,
- GdkWindow *window,
- int xoffset, int yoffset)
-{
- int width, height;
- cairo_t *cr = gdk_cairo_create (pixmap);
-
- setup_bg_cr (cr, window, xoffset, yoffset);
-
- #if GTK_CHECK_VERSION(3, 0, 0)
- width = gdk_window_get_width(GDK_WINDOW(pixmap));
- height = gdk_window_get_height(GDK_WINDOW(pixmap));
- #else
- gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &width, &height);
- #endif
-
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
-
- cairo_destroy (cr);
-}
-#endif
-
/* Returns a pixmap with a piece of the windows frame painted on it.
*/
-#if GTK_CHECK_VERSION(3, 0, 0)
-
static cairo_surface_t *
generate_pixmap (MetaFrames *frames,
MetaUIFrame *frame,
@@ -2211,44 +2065,6 @@ generate_pixmap (MetaFrames *frames,
return result;
}
-#else
-
-static GdkPixmap *
-generate_pixmap (MetaFrames *frames,
- MetaUIFrame *frame,
- MetaRectangle *rect)
-{
- GdkRectangle rectangle;
- GdkRegion *region;
- GdkPixmap *result;
-
- /* do not create a pixmap for nonexisting areas */
- if (rect->width <= 0 || rect->height <= 0)
- return NULL;
-
- rectangle.x = rect->x;
- rectangle.y = rect->y;
- rectangle.width = rect->width;
- rectangle.height = rect->height;
-
- result = gdk_pixmap_new (frame->window,
- rect->width, rect->height, -1);
-
- clear_backing (result, frame->window, rect->x, rect->y);
-
- region = gdk_region_rectangle (&rectangle);
-
- meta_frames_paint_to_drawable (frames, frame, result, region,
- -rectangle.x, -rectangle.y);
-
- gdk_region_destroy (region);
-
- return result;
-}
-
-#endif
-
-
static void
populate_cache (MetaFrames *frames,
MetaUIFrame *frame)
@@ -2327,11 +2143,11 @@ populate_cache (MetaFrames *frames,
}
static void
-clip_to_screen (GdkRegion *region, MetaUIFrame *frame)
+clip_to_screen (cairo_region_t *region, MetaUIFrame *frame)
{
GdkRectangle frame_area;
GdkRectangle screen_area = { 0, 0, 0, 0 };
- GdkRegion *tmp_region;
+ cairo_region_t *tmp_region;
/* Chop off stuff outside the screen; this optimization
* is crucial to handle huge client windows,
@@ -2346,43 +2162,15 @@ clip_to_screen (GdkRegion *region, MetaUIFrame *frame)
META_CORE_GET_SCREEN_HEIGHT, &screen_area.height,
META_CORE_GET_END);
- gdk_region_offset (region, frame_area.x, frame_area.y);
-
- tmp_region = gdk_region_rectangle (&frame_area);
- gdk_region_intersect (region, tmp_region);
- gdk_region_destroy (tmp_region);
-
- gdk_region_offset (region, - frame_area.x, - frame_area.y);
-}
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
-
-static void
-subtract_from_region (GdkRegion *region, GdkDrawable *drawable,
- gint x, gint y)
-{
- GdkRectangle rect;
- GdkRegion *reg_rect;
-
- #if GTK_CHECK_VERSION(3, 0, 0)
- rect.width = gdk_window_get_width(GDK_WINDOW(drawable));
- rect.height = gdk_window_get_height(GDK_WINDOW(drawable));
- #else
- gdk_drawable_get_size (drawable, &rect.width, &rect.height);
- #endif
+ cairo_region_translate (region, frame_area.x, frame_area.y);
- rect.x = x;
- rect.y = y;
+ tmp_region = cairo_region_create_rectangle (&frame_area);
+ cairo_region_intersect (region, tmp_region);
+ cairo_region_destroy (tmp_region);
- reg_rect = gdk_region_rectangle (&rect);
- gdk_region_subtract (region, reg_rect);
- gdk_region_destroy (reg_rect);
+ cairo_region_translate (region, - frame_area.x, - frame_area.y);
}
-#endif
-
-#if GTK_CHECK_VERSION(3, 0, 0)
-
static void
cached_pixels_draw (CachedPixels *pixels,
cairo_t *cr,
@@ -2409,40 +2197,6 @@ cached_pixels_draw (CachedPixels *pixels,
}
}
-#else
-
-static void
-cached_pixels_draw (CachedPixels *pixels,
- GdkWindow *window,
- GdkRegion *region)
-{
- cairo_t *cr;
- int i;
-
- cr = gdk_cairo_create (window);
-
- for (i = 0; i < 4; i++)
- {
- CachedFramePiece *piece;
- piece = &pixels->piece[i];
-
- if (piece->pixmap)
- {
- gdk_cairo_set_source_pixmap (cr, piece->pixmap,
- piece->rect.x, piece->rect.y);
- cairo_paint (cr);
- subtract_from_region (region, piece->pixmap,
- piece->rect.x, piece->rect.y);
- }
- }
-
- cairo_destroy (cr);
-}
-
-#endif
-
-#if GTK_CHECK_VERSION(3, 0, 0)
-
static void
subtract_client_area (cairo_region_t *region, MetaUIFrame *frame)
{
@@ -2536,48 +2290,6 @@ meta_frames_draw (GtkWidget *widget,
return TRUE;
}
-#else
-
-static gboolean
-meta_frames_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- MetaUIFrame *frame;
- MetaFrames *frames;
- GdkRegion *region;
- CachedPixels *pixels;
-
- frames = META_FRAMES (widget);
-
- frame = meta_frames_lookup_window (frames, GDK_WINDOW_XID (event->window));
- if (frame == NULL)
- return FALSE;
-
- if (frames->expose_delay_count > 0)
- {
- /* Redraw this entire frame later */
- frame->expose_delayed = TRUE;
- return TRUE;
- }
-
- populate_cache (frames, frame);
-
- region = gdk_region_copy (event->region);
-
- pixels = get_cache (frames, frame);
-
- cached_pixels_draw (pixels, frame->window, region);
-
- clip_to_screen (region, frame);
- meta_frames_paint_to_drawable (frames, frame, frame->window, region, 0, 0);
-
- gdk_region_destroy (region);
-
- return TRUE;
-}
-
-#endif
-
/* How far off the screen edge the window decorations should
* be drawn. Used only in meta_frames_paint_to_drawable, below.
*/
@@ -2586,14 +2298,7 @@ meta_frames_expose_event (GtkWidget *widget,
static void
meta_frames_paint_to_drawable (MetaFrames *frames,
MetaUIFrame *frame,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr)
- #else
- GdkDrawable *drawable,
- GdkRegion *region,
- int x_offset,
- int y_offset)
- #endif
{
MetaFrameFlags flags;
MetaFrameType type;
@@ -2702,8 +2407,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
meta_prefs_get_button_layout (&button_layout);
- #if GTK_CHECK_VERSION(3, 0, 0)
-
meta_theme_draw_frame_with_style (meta_theme_get_current (),
frame->style,
cr,
@@ -2715,118 +2418,6 @@ meta_frames_paint_to_drawable (MetaFrames *frames,
&button_layout,
button_states,
mini_icon, icon);
-
- #else
-
- if (G_LIKELY (GDK_IS_WINDOW (drawable)))
- {
- /* A window; happens about 2/3 of the time */
-
- GdkRectangle area, *areas;
- int n_areas;
- int screen_width, screen_height;
- GdkRegion *edges, *tmp_region;
- int top, bottom, left, right;
-
- /* Repaint each side of the frame */
-
- meta_theme_get_frame_borders (meta_theme_get_current (),
- type, frame->text_height, flags,
- &top, &bottom, &left, &right);
-
- meta_core_get (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow,
- META_CORE_GET_SCREEN_WIDTH, &screen_width,
- META_CORE_GET_SCREEN_HEIGHT, &screen_height,
- META_CORE_GET_END);
-
- edges = gdk_region_copy (region);
-
- /* Punch out the client area */
-
- area.x = left;
- area.y = top;
- area.width = w;
- area.height = h;
- tmp_region = gdk_region_rectangle (&area);
- gdk_region_subtract (edges, tmp_region);
- gdk_region_destroy (tmp_region);
-
- /* Now draw remaining portion of region */
-
- gdk_region_get_rectangles (edges, &areas, &n_areas);
-
- for (i = 0; i < n_areas; i++)
- {
- /* Bug 399529: clamp areas[i] so that it doesn't go too far
- * off the edge of the screen. This works around a GDK bug
- * which makes gdk_window_begin_paint_rect cause an X error
- * if the window is insanely huge. If the client is a GDK program
- * and does this, it will still probably cause an X error in that
- * program, but the last thing we want is for Marco to crash
- * because it attempted to decorate the silly window.
- */
-
- areas[i].x = MAX (areas[i].x, -DECORATING_BORDER);
- areas[i].y = MAX (areas[i].y, -DECORATING_BORDER);
- if (areas[i].x+areas[i].width > screen_width + DECORATING_BORDER)
- areas[i].width = MIN (0, screen_width - areas[i].x);
- if (areas[i].y+areas[i].height > screen_height + DECORATING_BORDER)
- areas[i].height = MIN (0, screen_height - areas[i].y);
-
- /* Okay, so let's start painting. */
-
- gdk_window_begin_paint_rect (drawable, &areas[i]);
-
- meta_theme_draw_frame_with_style (meta_theme_get_current (),
-#if GTK_CHECK_VERSION (3, 0, 0)
- frame->style,
-#else
- GTK_WIDGET(frames),
-#endif
- drawable,
- NULL, /* &areas[i], */
- x_offset, y_offset,
- type,
- flags,
- w, h,
- frame->layout,
- frame->text_height,
- &button_layout,
- button_states,
- mini_icon, icon);
-
- gdk_window_end_paint (drawable);
- }
-
- g_free (areas);
- gdk_region_destroy (edges);
-
- }
- else
- {
- /* Not a window; happens about 1/3 of the time */
-
- meta_theme_draw_frame_with_style (meta_theme_get_current (),
-#if GTK_CHECK_VERSION (3, 0, 0)
- frame->style,
-#else
- GTK_WIDGET(frames),
-#endif
- drawable,
- NULL,
- x_offset, y_offset,
- type,
- flags,
- w, h,
- frame->layout,
- frame->text_height,
- &button_layout,
- button_states,
- mini_icon, icon);
- }
-
- #endif
-
}
static void
@@ -2852,11 +2443,7 @@ meta_frames_set_window_background (MetaFrames *frames,
if (frame_exists && style->window_background_color != NULL)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
GdkVisual *visual;
meta_color_spec_render (style->window_background_color,
@@ -2867,29 +2454,15 @@ meta_frames_set_window_background (MetaFrames *frames,
visual = gtk_widget_get_visual (GTK_WIDGET (frames));
if (gdk_visual_get_depth (visual) == 32) /* we have ARGB */
- #if GTK_CHECK_VERSION(3, 0, 0)
{
color.alpha = style->window_background_alpha / 255.0;
}
gdk_window_set_background_rgba (frame->window, &color);
- #else
- {
- color.pixel = (color.pixel & 0xffffff) &
- style->window_background_alpha << 24;
- }
-
- gdk_window_set_background (frame->window, &color);
- #endif
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_set_background (frame->style, frame->window);
-#else
- gtk_style_set_background (frame->style,
- frame->window, GTK_STATE_NORMAL);
-#endif
}
}
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 3c4156cb..a5d50011 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -75,11 +75,7 @@ struct _MetaUIFrame
{
Window xwindow;
GdkWindow *window;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style;
-#else
- GtkStyle *style;
-#endif
MetaFrameStyle *cache_style;
PangoLayout *layout;
int text_height;
@@ -93,11 +89,7 @@ struct _MetaUIFrame
struct _MetaFrames
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkInvisible parent_instance;
-#else
- GtkWindow parent_instance;
-#endif
GHashTable *text_heights;
@@ -115,11 +107,7 @@ struct _MetaFrames
struct _MetaFramesClass
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkInvisibleClass parent_class;
-#else
- GtkWindowClass parent_class;
-#endif
};
GType meta_frames_get_type (void) G_GNUC_CONST;
diff --git a/src/ui/gradient.c b/src/ui/gradient.c
index dfdb2fa1..550017e1 100644
--- a/src/ui/gradient.c
+++ b/src/ui/gradient.c
@@ -26,12 +26,11 @@
#include "util.h"
#include <string.h>
-#include <gtk/gtk.h>
+#include <gdk/gdk.h>
/* This is all Alfredo's and Dan's usual very nice WindowMaker code,
* slightly GTK-ized
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf* meta_gradient_create_horizontal (int width,
int height,
const GdkRGBA *from,
@@ -56,32 +55,6 @@ static GdkPixbuf* meta_gradient_create_multi_diagonal (int width,
int height,
const GdkRGBA *colors,
int count);
-#else
-static GdkPixbuf* meta_gradient_create_horizontal (int width,
- int height,
- const GdkColor *from,
- const GdkColor *to);
-static GdkPixbuf* meta_gradient_create_vertical (int width,
- int height,
- const GdkColor *from,
- const GdkColor *to);
-static GdkPixbuf* meta_gradient_create_diagonal (int width,
- int height,
- const GdkColor *from,
- const GdkColor *to);
-static GdkPixbuf* meta_gradient_create_multi_horizontal (int width,
- int height,
- const GdkColor *colors,
- int count);
-static GdkPixbuf* meta_gradient_create_multi_vertical (int width,
- int height,
- const GdkColor *colors,
- int count);
-static GdkPixbuf* meta_gradient_create_multi_diagonal (int width,
- int height,
- const GdkColor *colors,
- int count);
-#endif
/* Used as the destroy notification function for gdk_pixbuf_new() */
@@ -116,21 +89,12 @@ blank_pixbuf (int width, int height, gboolean no_padding)
free_buffer, NULL);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf*
meta_gradient_create_simple (int width,
int height,
const GdkRGBA *from,
const GdkRGBA *to,
MetaGradientType style)
-#else
-GdkPixbuf*
-meta_gradient_create_simple (int width,
- int height,
- const GdkColor *from,
- const GdkColor *to,
- MetaGradientType style)
-#endif
{
switch (style)
{
@@ -151,23 +115,13 @@ meta_gradient_create_simple (int width,
return NULL;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf*
meta_gradient_create_multi (int width,
int height,
const GdkRGBA *colors,
int n_colors,
MetaGradientType style)
-#else
-GdkPixbuf*
-meta_gradient_create_multi (int width,
- int height,
- const GdkColor *colors,
- int n_colors,
- MetaGradientType style)
-#endif
{
-
if (n_colors > 2)
{
switch (style)
@@ -202,7 +156,6 @@ meta_gradient_create_multi (int width,
* are alternated. I'm not sure what it's good for, just copied since
* WindowMaker had it.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf*
meta_gradient_create_interwoven (int width,
int height,
@@ -210,17 +163,7 @@ meta_gradient_create_interwoven (int width,
int thickness1,
const GdkRGBA colors2[2],
int thickness2)
-#else
-GdkPixbuf*
-meta_gradient_create_interwoven (int width,
- int height,
- const GdkColor colors1[2],
- int thickness1,
- const GdkColor colors2[2],
- int thickness2)
-#endif
{
-
int i, j, k, l, ll;
long r1, g1, b1, dr1, dg1, db1;
long r2, g2, b2, dr2, dg2, db2;
@@ -236,7 +179,6 @@ meta_gradient_create_interwoven (int width,
pixels = gdk_pixbuf_get_pixels (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-#if GTK_CHECK_VERSION (3, 0, 0)
r1 = (long)(colors1[0].red*0xffffff);
g1 = (long)(colors1[0].green*0xffffff);
b1 = (long)(colors1[0].blue*0xffffff);
@@ -252,23 +194,6 @@ meta_gradient_create_interwoven (int width,
dr2 = ((colors2[1].red-colors2[0].red)*0xffffff)/(int)height;
dg2 = ((colors2[1].green-colors2[0].green)*0xffffff)/(int)height;
db2 = ((colors2[1].blue-colors2[0].blue)*0xffffff)/(int)height;
-#else
- r1 = colors1[0].red<<8;
- g1 = colors1[0].green<<8;
- b1 = colors1[0].blue<<8;
-
- r2 = colors2[0].red<<8;
- g2 = colors2[0].green<<8;
- b2 = colors2[0].blue<<8;
-
- dr1 = ((colors1[1].red-colors1[0].red)<<8)/(int)height;
- dg1 = ((colors1[1].green-colors1[0].green)<<8)/(int)height;
- db1 = ((colors1[1].blue-colors1[0].blue)<<8)/(int)height;
-
- dr2 = ((colors2[1].red-colors2[0].red)<<8)/(int)height;
- dg2 = ((colors2[1].green-colors2[0].green)<<8)/(int)height;
- db2 = ((colors2[1].blue-colors2[0].blue)<<8)/(int)height;
-#endif
for (i=0,k=0,l=0,ll=thickness1; i<height; i++)
{
@@ -330,17 +255,10 @@ meta_gradient_create_interwoven (int width,
* None
*----------------------------------------------------------------------
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf*
meta_gradient_create_horizontal (int width, int height,
const GdkRGBA *from,
const GdkRGBA *to)
-#else
-static GdkPixbuf*
-meta_gradient_create_horizontal (int width, int height,
- const GdkColor *from,
- const GdkColor *to)
-#endif
{
int i;
long r, g, b, dr, dg, db;
@@ -359,21 +277,12 @@ meta_gradient_create_horizontal (int width, int height,
ptr = pixels;
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-#if GTK_CHECK_VERSION (3, 0, 0)
r0 = (guchar) (from->red * 0xff);
g0 = (guchar) (from->green * 0xff);
b0 = (guchar) (from->blue * 0xff);
rf = (guchar) (to->red * 0xff);
gf = (guchar) (to->green * 0xff);
bf = (guchar) (to->blue * 0xff);
-#else
- r0 = (guchar) (from->red / 256.0);
- g0 = (guchar) (from->green / 256.0);
- b0 = (guchar) (from->blue / 256.0);
- rf = (guchar) (to->red / 256.0);
- gf = (guchar) (to->green / 256.0);
- bf = (guchar) (to->blue / 256.0);
-#endif
r = r0 << 16;
g = g0 << 16;
@@ -414,17 +323,10 @@ meta_gradient_create_horizontal (int width, int height,
* None
*----------------------------------------------------------------------
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf*
meta_gradient_create_vertical (int width, int height,
const GdkRGBA *from,
const GdkRGBA *to)
-#else
-static GdkPixbuf*
-meta_gradient_create_vertical (int width, int height,
- const GdkColor *from,
- const GdkColor *to)
-#endif
{
int i, j;
long r, g, b, dr, dg, db;
@@ -442,21 +344,12 @@ meta_gradient_create_vertical (int width, int height,
pixels = gdk_pixbuf_get_pixels (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-#if GTK_CHECK_VERSION (3, 0, 0)
r0 = (guchar) (from->red * 0xff);
g0 = (guchar) (from->green * 0xff);
b0 = (guchar) (from->blue * 0xff);
rf = (guchar) (to->red * 0xff);
gf = (guchar) (to->green * 0xff);
bf = (guchar) (to->blue * 0xff);
-#else
- r0 = (guchar) (from->red / 256.0);
- g0 = (guchar) (from->green / 256.0);
- b0 = (guchar) (from->blue / 256.0);
- rf = (guchar) (to->red / 256.0);
- gf = (guchar) (to->green / 256.0);
- bf = (guchar) (to->blue / 256.0);
-#endif
r = r0<<16;
g = g0<<16;
@@ -500,17 +393,10 @@ meta_gradient_create_vertical (int width, int height,
*----------------------------------------------------------------------
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf*
meta_gradient_create_diagonal (int width, int height,
const GdkRGBA *from,
const GdkRGBA *to)
-#else
-static GdkPixbuf*
-meta_gradient_create_diagonal (int width, int height,
- const GdkColor *from,
- const GdkColor *to)
-#endif
{
GdkPixbuf *pixbuf, *tmp;
int j;
@@ -554,17 +440,10 @@ meta_gradient_create_diagonal (int width, int height,
return pixbuf;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf*
meta_gradient_create_multi_horizontal (int width, int height,
const GdkRGBA *colors,
int count)
-#else
-static GdkPixbuf*
-meta_gradient_create_multi_horizontal (int width, int height,
- const GdkColor *colors,
- int count)
-#endif
{
int i, j, k;
long r, g, b, dr, dg, db;
@@ -594,28 +473,17 @@ meta_gradient_create_multi_horizontal (int width, int height,
k = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
r = (long)(colors[0].red * 0xffffff);
g = (long)(colors[0].green * 0xffffff);
b = (long)(colors[0].blue * 0xffffff);
-#else
- r = colors[0].red << 8;
- g = colors[0].green << 8;
- b = colors[0].blue << 8;
-#endif
/* render the first line */
for (i=1; i<count; i++)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
dr = (int)((colors[i].red - colors[i-1].red) *0xffffff)/(int)width2;
dg = (int)((colors[i].green - colors[i-1].green)*0xffffff)/(int)width2;
db = (int)((colors[i].blue - colors[i-1].blue) *0xffffff)/(int)width2;
-#else
- dr = ((int)(colors[i].red - colors[i-1].red) <<8)/(int)width2;
- dg = ((int)(colors[i].green - colors[i-1].green)<<8)/(int)width2;
- db = ((int)(colors[i].blue - colors[i-1].blue) <<8)/(int)width2;
-#endif
+
for (j=0; j<width2; j++)
{
*ptr++ = (unsigned char)(r>>16);
@@ -626,16 +494,12 @@ meta_gradient_create_multi_horizontal (int width, int height,
b += db;
k++;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
r = (long)(colors[i].red * 0xffffff);
g = (long)(colors[i].green * 0xffffff);
b = (long)(colors[i].blue * 0xffffff);
-#else
- r = colors[i].red << 8;
- g = colors[i].green << 8;
- b = colors[i].blue << 8;
-#endif
}
+
for (j=k; j<width; j++)
{
*ptr++ = (unsigned char)(r>>16);
@@ -651,17 +515,10 @@ meta_gradient_create_multi_horizontal (int width, int height,
return pixbuf;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf*
meta_gradient_create_multi_vertical (int width, int height,
const GdkRGBA *colors,
int count)
-#else
-static GdkPixbuf*
-meta_gradient_create_multi_vertical (int width, int height,
- const GdkColor *colors,
- int count)
-#endif
{
int i, j, k;
long r, g, b, dr, dg, db;
@@ -691,27 +548,15 @@ meta_gradient_create_multi_vertical (int width, int height,
k = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
r = (long)(colors[0].red * 0xffffff);
g = (long)(colors[0].green * 0xffffff);
b = (long)(colors[0].blue * 0xffffff);
-#else
- r = colors[0].red << 8;
- g = colors[0].green << 8;
- b = colors[0].blue << 8;
-#endif
for (i=1; i<count; i++)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
dr = (int)((colors[i].red - colors[i-1].red) *0xffffff)/(int)height2;
dg = (int)((colors[i].green - colors[i-1].green)*0xffffff)/(int)height2;
db = (int)((colors[i].blue - colors[i-1].blue) *0xffffff)/(int)height2;
-#else
- dr = ((int)(colors[i].red - colors[i-1].red) <<8)/(int)height2;
- dg = ((int)(colors[i].green - colors[i-1].green)<<8)/(int)height2;
- db = ((int)(colors[i].blue - colors[i-1].blue) <<8)/(int)height2;
-#endif
for (j=0; j<height2; j++)
{
@@ -730,15 +575,10 @@ meta_gradient_create_multi_vertical (int width, int height,
b += db;
k++;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
+
r = (long)(colors[i].red * 0xffffff);
g = (long)(colors[i].green * 0xffffff);
b = (long)(colors[i].blue * 0xffffff);
-#else
- r = colors[i].red << 8;
- g = colors[i].green << 8;
- b = colors[i].blue << 8;
-#endif
}
if (k<height)
@@ -765,17 +605,10 @@ meta_gradient_create_multi_vertical (int width, int height,
return pixbuf;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf*
meta_gradient_create_multi_diagonal (int width, int height,
const GdkRGBA *colors,
int count)
-#else
-static GdkPixbuf*
-meta_gradient_create_multi_diagonal (int width, int height,
- const GdkColor *colors,
- int count)
-#endif
{
GdkPixbuf *pixbuf, *tmp;
float a, offset;
diff --git a/src/ui/gradient.h b/src/ui/gradient.h
index 7cbe8977..e40ba8eb 100644
--- a/src/ui/gradient.h
+++ b/src/ui/gradient.h
@@ -26,7 +26,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdk.h>
-#include <gtk/gtk.h>
typedef enum
{
@@ -36,7 +35,6 @@ typedef enum
META_GRADIENT_LAST
} MetaGradientType;
-#if GTK_CHECK_VERSION (3, 0 ,0)
GdkPixbuf* meta_gradient_create_simple (int width,
int height,
const GdkRGBA *from,
@@ -53,25 +51,6 @@ GdkPixbuf* meta_gradient_create_interwoven (int width,
int thickness1,
const GdkRGBA colors2[2],
int thickness2);
-#else
-GdkPixbuf* meta_gradient_create_simple (int width,
- int height,
- const GdkColor *from,
- const GdkColor *to,
- MetaGradientType style);
-GdkPixbuf* meta_gradient_create_multi (int width,
- int height,
- const GdkColor *colors,
- int n_colors,
- MetaGradientType style);
-GdkPixbuf* meta_gradient_create_interwoven (int width,
- int height,
- const GdkColor colors1[2],
- int thickness1,
- const GdkColor colors2[2],
- int thickness2);
-#endif
-
/* Generate an alpha gradient and multiply it with the existing alpha
* channel of the given pixbuf
diff --git a/src/ui/menu.c b/src/ui/menu.c
index 54e1d6dd..58ed1704 100644
--- a/src/ui/menu.c
+++ b/src/ui/menu.c
@@ -106,11 +106,7 @@ static void popup_position_func(GtkMenu* menu, gint* x, gint* y, gboolean* push_
pos = user_data;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
-#else
- gtk_widget_size_request(GTK_WIDGET(menu), &req);
-#endif
*x = pos->x;
*y = pos->y;
@@ -304,11 +300,7 @@ static GtkWidget* menu_item_new(MenuItem* menuitem, int workspace_id)
meta_core_get_menu_accelerator (menuitem->op, workspace_id, &key, &mods);
accel_label = meta_accel_label_new_with_mnemonic (i18n_label);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (accel_label, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5);
-#endif
gtk_container_add (GTK_CONTAINER (mi), accel_label);
gtk_widget_show (accel_label);
diff --git a/src/ui/metaaccellabel.c b/src/ui/metaaccellabel.c
index 2e738c7c..319bceaa 100644
--- a/src/ui/metaaccellabel.c
+++ b/src/ui/metaaccellabel.c
@@ -37,20 +37,13 @@
#include <string.h>
#include "util.h"
-#if GTK_CHECK_VERSION(3, 0, 0)
- #define parent_class meta_accel_label_parent_class
- #define GtkObject GtkWidget
- #define GTK_OBJECT_CLASS GTK_WIDGET_CLASS
-#endif
-
static void meta_accel_label_class_init (MetaAccelLabelClass *klass);
static void meta_accel_label_init (MetaAccelLabel *accel_label);
-static void meta_accel_label_destroy (GtkObject *object);
+static void meta_accel_label_destroy (GtkWidget *object);
static void meta_accel_label_finalize (GObject *object);
static void meta_accel_label_update (MetaAccelLabel *accel_label);
static int meta_accel_label_get_accel_width (MetaAccelLabel *accel_label);
-#if GTK_CHECK_VERSION(3, 0, 0)
static void meta_accel_label_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural);
@@ -59,55 +52,13 @@ static void meta_accel_label_get_preferred_height (GtkWidget *widget,
gint *natural);
static gboolean meta_accel_label_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static void meta_accel_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gboolean meta_accel_label_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-
-static GtkLabelClass *parent_class = NULL;
-#endif
-
-#if GTK_CHECK_VERSION(3, 0, 0)
-
G_DEFINE_TYPE (MetaAccelLabel, meta_accel_label, GTK_TYPE_LABEL);
-#else
-
-GType
-meta_accel_label_get_type (void)
-{
- static GType accel_label_type = 0;
-
- if (!accel_label_type)
- {
- static const GtkTypeInfo accel_label_info =
- {
- "MetaAccelLabel",
- sizeof (MetaAccelLabel),
- sizeof (MetaAccelLabelClass),
- (GtkClassInitFunc) meta_accel_label_class_init,
- (GtkObjectInitFunc) meta_accel_label_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- accel_label_type = gtk_type_unique (GTK_TYPE_LABEL, &accel_label_info);
- }
-
- return accel_label_type;
-}
-
-#endif
-
static void
meta_accel_label_class_init (MetaAccelLabelClass *class)
{
-
- #if GTK_CHECK_VERSION(3, 0, 0)
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
@@ -118,20 +69,6 @@ meta_accel_label_class_init (MetaAccelLabelClass *class)
widget_class->get_preferred_width = meta_accel_label_get_preferred_width;
widget_class->get_preferred_height = meta_accel_label_get_preferred_height;
widget_class->draw = meta_accel_label_draw;
- #else
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
- parent_class = g_type_class_peek_parent (class);
-
- gobject_class->finalize = meta_accel_label_finalize;
-
- object_class->destroy = meta_accel_label_destroy;
-
- widget_class->size_request = meta_accel_label_size_request;
- widget_class->expose_event = meta_accel_label_expose_event;
- #endif
class->signal_quote1 = g_strdup ("<:");
class->signal_quote2 = g_strdup (":>");
@@ -225,7 +162,7 @@ meta_accel_label_new_with_mnemonic (const gchar *string)
}
static void
-meta_accel_label_destroy (GtkObject *object)
+meta_accel_label_destroy (GtkWidget *object)
{
MetaAccelLabel *accel_label = META_ACCEL_LABEL (object);
@@ -236,7 +173,7 @@ meta_accel_label_destroy (GtkObject *object)
accel_label->accel_mods = 0;
accel_label->accel_key = 0;
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ GTK_WIDGET_CLASS (meta_accel_label_parent_class)->destroy (object);
}
static void
@@ -246,7 +183,7 @@ meta_accel_label_finalize (GObject *object)
g_free (accel_label->accel_string);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_accel_label_parent_class)->finalize (object);
}
void
@@ -275,7 +212,6 @@ meta_accel_label_get_accel_width (MetaAccelLabel *accel_label)
(accel_label->accel_string_width ? accel_label->accel_padding : 0));
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static void
meta_accel_label_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -301,29 +237,6 @@ meta_accel_label_get_preferred_height (GtkWidget *widget,
{
GTK_WIDGET_CLASS (meta_accel_label_parent_class)->get_preferred_height (widget, minimum, natural);
}
-#else
-
-static void
-meta_accel_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- MetaAccelLabel *accel_label = META_ACCEL_LABEL (widget);
- PangoLayout *layout;
- gint width;
-
- if (GTK_WIDGET_CLASS (parent_class)->size_request)
- GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
-
- layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string);
- pango_layout_get_pixel_size (layout, &width, NULL);
- accel_label->accel_string_width = width;
-
- g_object_unref (G_OBJECT (layout));
-}
-
-#endif
-
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean
meta_accel_label_draw (GtkWidget *widget,
@@ -434,92 +347,6 @@ meta_accel_label_draw (GtkWidget *widget,
return FALSE;
}
-#else
-
-static gboolean
-meta_accel_label_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- MetaAccelLabel *accel_label = META_ACCEL_LABEL (widget);
- GtkMisc *misc = GTK_MISC (accel_label);
- PangoLayout *layout;
-
- if (gtk_widget_is_drawable (GTK_WIDGET (accel_label)))
- {
- int ac_width;
- GtkAllocation allocation;
- GtkRequisition requisition;
-
- gtk_widget_get_allocation (widget, &allocation);
- gtk_widget_get_requisition (widget, &requisition);
- ac_width = meta_accel_label_get_accel_width (accel_label);
-
- if (allocation.width >= requisition.width + ac_width)
- {
- GtkTextDirection direction = gtk_widget_get_direction (widget);
- gfloat xalign, yalign;
- gint x, y;
- gint xpad, ypad;
-
- gtk_misc_get_padding (misc, &xpad, &ypad);
- gtk_misc_get_alignment (misc, &xalign, &yalign);
-
- if (direction == GTK_TEXT_DIR_RTL)
- {
- allocation.x += ac_width;
- }
- allocation.width -= ac_width;
- gtk_widget_set_allocation (widget, &allocation);
-
- if (GTK_WIDGET_CLASS (parent_class)->expose_event)
- GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-
- if (direction == GTK_TEXT_DIR_RTL)
- {
- allocation.x -= ac_width;
- }
- allocation.width += ac_width;
- gtk_widget_set_allocation (widget, &allocation);
-
- if (direction == GTK_TEXT_DIR_RTL)
- {
- x = allocation.x + allocation.width - xpad - ac_width;
- }
- else
- {
- x = allocation.x + allocation.width - xpad - ac_width;
- }
-
- y = (allocation.y * (1.0 - yalign) +
- (allocation.y + allocation.height -
- (requisition.height - ypad * 2)) * yalign) + 1.5;
-
- layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string);
-
- gtk_paint_layout (gtk_widget_get_style (widget),
- gtk_widget_get_window (widget),
- gtk_widget_get_state (widget),
- FALSE,
- &event->area,
- widget,
- "accellabel",
- x, y,
- layout);
-
- g_object_unref (G_OBJECT (layout));
- }
- else
- {
- if (GTK_WIDGET_CLASS (parent_class)->expose_event)
- GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
- }
- }
-
- return FALSE;
-}
-
-#endif
-
static void
meta_accel_label_update (MetaAccelLabel *accel_label)
{
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 9138c6f5..6dc4691c 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -31,66 +31,20 @@
static void meta_preview_class_init (MetaPreviewClass *klass);
static void meta_preview_init (MetaPreview *preview);
-#if GTK_CHECK_VERSION(3, 0, 0)
-
static void meta_preview_get_preferred_width(GtkWidget *widget,
gint *minimal, gint *natural);
static void meta_preview_get_preferred_height(GtkWidget *widget,
gint *minimal, gint *natural);
-#else
-static void meta_preview_size_request (GtkWidget *widget,
- GtkRequisition *req);
-#endif
static void meta_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean meta_preview_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gboolean meta_preview_expose (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
static void meta_preview_finalize (GObject *object);
#define NO_CHILD_WIDTH 80
#define NO_CHILD_HEIGHT 20
-#if GTK_CHECK_VERSION(3, 0, 0)
-
G_DEFINE_TYPE (MetaPreview, meta_preview, GTK_TYPE_BIN);
-#define parent_class meta_preview_parent_class
-
-#else
-
-static GtkWidgetClass *parent_class;
-
-
-GType
-meta_preview_get_type (void)
-{
- static GType preview_type = 0;
-
- if (!preview_type)
- {
- static const GtkTypeInfo preview_info =
- {
- "MetaPreview",
- sizeof (MetaPreview),
- sizeof (MetaPreviewClass),
- (GtkClassInitFunc) meta_preview_class_init,
- (GtkObjectInitFunc) meta_preview_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- preview_type = gtk_type_unique (GTK_TYPE_BIN, &preview_info);
- }
-
- return preview_type;
-}
-
-#endif
static void
meta_preview_class_init (MetaPreviewClass *class)
@@ -99,20 +53,15 @@ meta_preview_class_init (MetaPreviewClass *class)
GtkWidgetClass *widget_class;
widget_class = (GtkWidgetClass*) class;
- parent_class = g_type_class_peek (GTK_TYPE_BIN);
+ meta_preview_parent_class = g_type_class_peek (GTK_TYPE_BIN);
gobject_class->finalize = meta_preview_finalize;
-#if GTK_CHECK_VERSION(3, 0, 0)
widget_class->draw = meta_preview_draw;
widget_class->get_preferred_width = meta_preview_get_preferred_width;
widget_class->get_preferred_height = meta_preview_get_preferred_height;
gtk_container_class_handle_border_width (GTK_CONTAINER_CLASS (class));
-#else
- widget_class->expose_event = meta_preview_expose;
- widget_class->size_request = meta_preview_size_request;
-#endif
widget_class->size_allocate = meta_preview_size_allocate;
}
@@ -175,7 +124,7 @@ meta_preview_finalize (GObject *object)
g_free (preview->title);
preview->title = NULL;
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_preview_parent_class)->finalize (object);
}
static void
@@ -245,7 +194,6 @@ ensure_info (MetaPreview *preview)
}
}
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean
meta_preview_draw (GtkWidget *widget,
@@ -379,106 +327,6 @@ meta_preview_get_preferred_height (GtkWidget *widget,
*natural += border_width * 2;
}
-#else
-
-static gboolean
-meta_preview_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- MetaPreview *preview;
- GtkAllocation allocation;
- int border_width;
- int client_width;
- int client_height;
- MetaButtonState button_states[META_BUTTON_TYPE_LAST] =
- {
- META_BUTTON_STATE_NORMAL,
- META_BUTTON_STATE_NORMAL,
- META_BUTTON_STATE_NORMAL,
- META_BUTTON_STATE_NORMAL
- };
-
- g_return_val_if_fail (META_IS_PREVIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- preview = META_PREVIEW (widget);
-
- ensure_info (preview);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- gtk_widget_get_allocation (widget, &allocation);
- client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2;
- client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
-
- if (client_width < 0)
- client_width = 1;
- if (client_height < 0)
- client_height = 1;
-
- if (preview->theme)
- {
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- meta_theme_draw_frame (preview->theme,
- widget,
- gtk_widget_get_window (widget),
- &event->area,
- allocation.x + border_width,
- allocation.y + border_width,
- preview->type,
- preview->flags,
- client_width, client_height,
- preview->layout,
- preview->text_height,
- &preview->button_layout,
- button_states,
- meta_preview_get_mini_icon (),
- meta_preview_get_icon ());
- }
-
- /* draw child */
- return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-}
-
-static void
-meta_preview_size_request (GtkWidget *widget,
- GtkRequisition *req)
-{
- MetaPreview *preview;
- GtkWidget *child;
- guint border_width;
-
- preview = META_PREVIEW (widget);
-
- ensure_info (preview);
-
- req->width = preview->left_width + preview->right_width;
- req->height = preview->top_height + preview->bottom_height;
-
- child = gtk_bin_get_child (GTK_BIN (preview));
- if (child &&
- gtk_widget_get_visible (child))
- {
- GtkRequisition child_requisition;
-
- gtk_widget_size_request (child, &child_requisition);
-
- req->width += child_requisition.width;
- req->height += child_requisition.height;
- }
- else
- {
- req->width += NO_CHILD_WIDTH;
- req->height += NO_CHILD_HEIGHT;
- }
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- req->width += border_width * 2;
- req->height += border_width * 2;
-}
-#endif
-
static void
meta_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
@@ -655,11 +503,11 @@ meta_preview_get_mini_icon (void)
return default_icon;
}
-GdkRegion *
+cairo_region_t *
meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint new_window_height)
{
GdkRectangle xrect;
- GdkRegion *corners_xregion, *window_xregion;
+ cairo_region_t *corners_xregion, *window_xregion;
gint flags;
MetaFrameLayout *fgeom;
MetaFrameStyle *frame_style;
@@ -668,14 +516,14 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
flags = (META_PREVIEW (preview)->flags);
- window_xregion = gdk_region_new ();
+ window_xregion = cairo_region_create ();
xrect.x = 0;
xrect.y = 0;
xrect.width = new_window_width;
xrect.height = new_window_height;
- gdk_region_union_with_rect (window_xregion, &xrect);
+ cairo_region_union_rectangle (window_xregion, &xrect);
if (preview->theme == NULL)
return window_xregion;
@@ -686,7 +534,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
fgeom = frame_style->layout;
- corners_xregion = gdk_region_new ();
+ corners_xregion = cairo_region_create ();
if (fgeom->top_left_corner_rounded_radius != 0)
{
@@ -703,7 +551,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
xrect.width = width;
xrect.height = 1;
- gdk_region_union_with_rect (corners_xregion, &xrect);
+ cairo_region_union_rectangle (corners_xregion, &xrect);
}
}
@@ -721,7 +569,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
xrect.width = width;
xrect.height = 1;
- gdk_region_union_with_rect (corners_xregion, &xrect);
+ cairo_region_union_rectangle (corners_xregion, &xrect);
}
}
@@ -739,7 +587,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
xrect.width = width;
xrect.height = 1;
- gdk_region_union_with_rect (corners_xregion, &xrect);
+ cairo_region_union_rectangle (corners_xregion, &xrect);
}
}
@@ -757,12 +605,12 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
xrect.width = width;
xrect.height = 1;
- gdk_region_union_with_rect (corners_xregion, &xrect);
+ cairo_region_union_rectangle (corners_xregion, &xrect);
}
}
- gdk_region_subtract (window_xregion, corners_xregion);
- gdk_region_destroy (corners_xregion);
+ cairo_region_subtract (window_xregion, corners_xregion);
+ cairo_region_destroy (corners_xregion);
return window_xregion;
}
diff --git a/src/ui/preview-widget.h b/src/ui/preview-widget.h
index bb5d2893..1bbd97e7 100644
--- a/src/ui/preview-widget.h
+++ b/src/ui/preview-widget.h
@@ -23,15 +23,7 @@
#include "theme.h"
#include <gtk/gtk.h>
-
-#if GTK_CHECK_VERSION(3, 0, 0)
- #include <cairo/cairo.h>
- #define GdkRegion cairo_region_t
- #define gdk_region_new cairo_region_create
- #define gdk_region_subtract cairo_region_subtract
- #define gdk_region_destroy cairo_region_destroy
- #define gdk_region_union_with_rect cairo_region_union_rectangle
-#endif
+#include <cairo/cairo.h>
#ifndef META_PREVIEW_WIDGET_H
#define META_PREVIEW_WIDGET_H
@@ -86,7 +78,7 @@ void meta_preview_set_frame_flags (MetaPreview *preview,
void meta_preview_set_button_layout (MetaPreview *preview,
const MetaButtonLayout *button_layout);
-GdkRegion * meta_preview_get_clip_region (MetaPreview *preview,
+cairo_region_t* meta_preview_get_clip_region (MetaPreview *preview,
gint new_window_width,
gint new_window_height);
diff --git a/src/ui/resizepopup.c b/src/ui/resizepopup.c
index 97f07c2c..a4d9e976 100644
--- a/src/ui/resizepopup.c
+++ b/src/ui/resizepopup.c
@@ -91,14 +91,10 @@ ensure_size_window (MetaResizePopup *popup)
gtk_container_add (GTK_CONTAINER (popup->size_window), frame);
popup->size_label = gtk_label_new ("");
-#if GTK_CHECK_VERSION (3, 14, 0)
gtk_widget_set_margin_start (popup->size_label, 3);
gtk_widget_set_margin_end (popup->size_label, 3);
gtk_widget_set_margin_top (popup->size_label, 3);
gtk_widget_set_margin_bottom (popup->size_label, 3);
-#else
- gtk_misc_set_padding (GTK_MISC (popup->size_label), 3, 3);
-#endif
gtk_container_add (GTK_CONTAINER (frame), popup->size_label);
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index eb555e90..3267a75c 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -36,15 +36,6 @@
#include <gtk/gtk.h>
#include <math.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
- #define GdkRegion cairo_region_t
- #define gdk_region_subtract cairo_region_subtract
- #define gdk_region_destroy cairo_region_destroy
- #define gdk_region_rectangle cairo_region_create_rectangle
- /* Silence Gtk{V,H}Box deprecations warnings */
- #define gtk_vbox_new(X, Y) gtk_box_new(GTK_ORIENTATION_VERTICAL, Y)
-#endif
-
#define OUTSIDE_SELECT_RECT 2
#define INSIDE_SELECT_RECT 2
@@ -81,23 +72,12 @@ static void select_workspace (GtkWidget *widget);
static void unselect_workspace (GtkWidget *widget);
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
outline_window_draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
-#else
-outline_window_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
-#endif
{
MetaTabPopup *popup;
TabEntry *te;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkStyle *style;
- GdkWindow *window;
- cairo_t *cr;
-#endif
popup = data;
@@ -105,18 +85,9 @@ outline_window_expose (GtkWidget *widget,
return FALSE;
te = popup->current_selected_entry;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- window = gtk_widget_get_window (widget);
- style = gtk_widget_get_style (widget);
- cr = gdk_cairo_create (window);
-#endif
cairo_set_line_width (cr, 1.0);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
-#else
- gdk_cairo_set_source_color (cr, &style->white);
-#endif
cairo_rectangle (cr,
0.5, 0.5,
@@ -130,10 +101,6 @@ outline_window_expose (GtkWidget *widget,
te->inner_rect.height + 1);
cairo_stroke (cr);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return FALSE;
}
@@ -252,15 +219,8 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
MetaTabPopup *popup;
int i, left, right, top, bottom;
int height;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *grid;
-#else
- GtkWidget *table;
-#endif
GtkWidget *vbox;
-#if !GTK_CHECK_VERSION (3, 14, 0)
- GtkWidget *align;
-#endif
GList *tmp;
GtkWidget *frame;
int max_label_width; /* the actual max width of the labels we create */
@@ -280,13 +240,8 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
gtk_widget_set_app_paintable (popup->outline_window, TRUE);
gtk_widget_realize (popup->outline_window);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT (popup->outline_window), "draw",
G_CALLBACK (outline_window_draw), popup);
-#else
- g_signal_connect (G_OBJECT (popup->outline_window), "expose_event",
- G_CALLBACK (outline_window_expose), popup);
-#endif
popup->window = gtk_window_new (GTK_WINDOW_POPUP);
@@ -317,43 +272,19 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
if (i % width)
height += 1;
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = gtk_grid_new ();
-#else
- table = gtk_table_new (height, width, FALSE);
-#endif
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_container_set_border_width (GTK_CONTAINER (grid), 1);
-#else
- gtk_container_set_border_width (GTK_CONTAINER (table), 1);
-#endif
gtk_container_add (GTK_CONTAINER (popup->window),
frame);
gtk_container_add (GTK_CONTAINER (frame),
vbox);
-#if GTK_CHECK_VERSION (3, 14, 0)
gtk_box_pack_start (GTK_BOX (vbox), grid, TRUE, TRUE, 0);
-#else
- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-
- gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-#if !GTK_CHECK_VERSION (3, 14, 0)
- gtk_container_add (GTK_CONTAINER (align),
- grid);
-#endif
-#else
- gtk_container_add (GTK_CONTAINER (align),
- table);
-#endif
popup->label = gtk_label_new ("");
@@ -364,14 +295,10 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
obj = gtk_widget_get_accessible (popup->label);
atk_object_set_role (obj, ATK_ROLE_STATUSBAR);
-#if GTK_CHECK_VERSION (3, 14, 0)
gtk_widget_set_margin_start (popup->label, 3);
gtk_widget_set_margin_end (popup->label, 3);
gtk_widget_set_margin_top (popup->label, 3);
gtk_widget_set_margin_bottom (popup->label, 3);
-#else
- gtk_misc_set_padding (GTK_MISC (popup->label), 3, 3);
-#endif
gtk_box_pack_end (GTK_BOX (vbox), popup->label, FALSE, FALSE, 0);
@@ -397,11 +324,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
if (te->blank)
{
/* just stick a widget here to avoid special cases */
-#if GTK_CHECK_VERSION (3, 14, 0)
image = gtk_label_new ("");
-#else
- image = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
-#endif
}
else if (outline)
{
@@ -417,12 +340,8 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
gtk_misc_set_padding (GTK_MISC (image),
INSIDE_SELECT_RECT + OUTSIDE_SELECT_RECT + 1,
INSIDE_SELECT_RECT + OUTSIDE_SELECT_RECT + 1);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
-#endif
}
else
{
@@ -431,24 +350,12 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
te->widget = image;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (GTK_GRID (grid), te->widget, left, top, 1, 1);
-#else
- gtk_table_attach (GTK_TABLE (table),
- te->widget,
- left, right, top, bottom,
- 0, 0,
- 0, 0);
-#endif
/* Efficiency rules! */
gtk_label_set_markup (GTK_LABEL (popup->label),
te->title);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (popup->label, &req, NULL);
-#else
- gtk_widget_size_request (popup->label, &req);
-#endif
max_label_width = MAX (max_label_width, req.width);
tmp = tmp->next;
@@ -537,8 +444,8 @@ display_entry (MetaTabPopup *popup,
TabEntry *te)
{
GdkRectangle rect;
- GdkRegion *region;
- GdkRegion *inner_region;
+ cairo_region_t *region;
+ cairo_region_t *inner_region;
GdkWindow *window;
@@ -573,24 +480,19 @@ display_entry (MetaTabPopup *popup,
te->rect.x, te->rect.y,
te->rect.width, te->rect.height);
- #if GTK_CHECK_VERSION(3, 0, 0)
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
gdk_window_set_background_rgba (window, &black);
- #else
- gdk_window_set_background (window,
- &gtk_widget_get_style (popup->outline_window)->black);
- #endif
- region = gdk_region_rectangle (&rect);
- inner_region = gdk_region_rectangle (&te->inner_rect);
- gdk_region_subtract (region, inner_region);
- gdk_region_destroy (inner_region);
+ region = cairo_region_create_rectangle (&rect);
+ inner_region = cairo_region_create_rectangle (&te->inner_rect);
+ cairo_region_subtract (region, inner_region);
+ cairo_region_destroy (inner_region);
gdk_window_shape_combine_region (window,
region,
0, 0);
- gdk_region_destroy (region);
+ cairo_region_destroy (region);
/* This should piss off gtk a bit, but we don't want to raise
* above the tab popup. So, instead of calling gtk_widget_show,
@@ -734,13 +636,8 @@ unselect_image (GtkWidget *widget)
}
static void meta_select_image_class_init (MetaSelectImageClass *klass);
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean meta_select_image_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gboolean meta_select_image_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
static GtkImageClass *parent_class;
@@ -779,15 +676,9 @@ meta_select_image_class_init (MetaSelectImageClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
- #if GTK_CHECK_VERSION(3, 0, 0)
widget_class->draw = meta_select_image_draw;
- #else
- widget_class->expose_event = meta_select_image_expose_event;
- #endif
}
-#if GTK_CHECK_VERSION(3, 0, 0)
-
static gboolean
meta_select_image_draw (GtkWidget *widget,
cairo_t *cr)
@@ -808,11 +699,7 @@ meta_select_image_draw (GtkWidget *widget,
misc = GTK_MISC (widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (widget, &requisition, NULL);
-#else
- gtk_widget_get_requisition (widget, &requisition);
-#endif
gtk_misc_get_alignment (misc, &xalign, &yalign);
gtk_misc_get_padding (misc, &xpad, &ypad);
@@ -844,77 +731,6 @@ meta_select_image_draw (GtkWidget *widget,
return GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
}
-#else
-
-static gboolean
-meta_select_image_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- if (META_SELECT_IMAGE (widget)->selected)
- {
- GtkAllocation allocation;
- GtkRequisition requisition;
- GtkMisc *misc;
- GtkStyle *style;
- GtkStateType state;
- GdkWindow *window;
- int x, y, w, h;
- int xpad, ypad;
- float xalign, yalign;
- cairo_t *cr;
-
- misc = GTK_MISC (widget);
-
- gtk_widget_get_allocation(widget, &allocation);
- gtk_widget_get_requisition (widget, &requisition);
- gtk_misc_get_padding (misc, &xpad, &ypad);
- gtk_misc_get_alignment (misc, &xalign, &yalign);
-
- x = (allocation.x * (1.0 - xalign) +
- (allocation.x + allocation.width
- - (requisition.width - xpad * 2)) * xalign) + 0.5;
- y = (allocation.y * (1.0 - yalign) +
- (allocation.y + allocation.height
- - (requisition.height - ypad * 2)) * yalign) + 0.5;
-
- x -= INSIDE_SELECT_RECT + 1;
- y -= INSIDE_SELECT_RECT + 1;
-
- w = requisition.width - OUTSIDE_SELECT_RECT * 2 - 1;
- h = requisition.height - OUTSIDE_SELECT_RECT * 2 - 1;
-
- window = gtk_widget_get_window (widget);
- style = gtk_widget_get_style (widget);
- state = gtk_widget_get_state (widget);
- cr = gdk_cairo_create (window);
-
- cairo_set_line_width (cr, 2.0);
- gdk_cairo_set_source_color (cr, &style->fg[state]);
-
- cairo_rectangle (cr, x, y, w + 1, h + 1);
- cairo_stroke (cr);
-
- cairo_set_line_width (cr, 1.0);
-#if 0
- gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_SELECTED]);
- cairo_rectangle (cr, x, y, w, h);
- cairo_fill (cr);
-#endif
-
-#if 0
- gtk_paint_focus (widget->style, widget->window,
- &event->area, widget, "meta-tab-image",
- x, y, w, h);
-#endif
-
- cairo_destroy (cr);
- }
-
- return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-}
-
-#endif
-
#define META_TYPE_SELECT_WORKSPACE (meta_select_workspace_get_type ())
#define META_SELECT_WORKSPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SELECT_WORKSPACE, MetaSelectWorkspace))
@@ -976,13 +792,8 @@ unselect_workspace (GtkWidget *widget)
static void meta_select_workspace_class_init (MetaSelectWorkspaceClass *klass);
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean meta_select_workspace_draw (GtkWidget *widget,
cairo_t *cr);
-#else
-static gboolean meta_select_workspace_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-#endif
GType
meta_select_workspace_get_type (void)
@@ -1020,11 +831,7 @@ meta_select_workspace_class_init (MetaSelectWorkspaceClass *klass)
widget_class = GTK_WIDGET_CLASS (klass);
- #if GTK_CHECK_VERSION(3, 0, 0)
widget_class->draw = meta_select_workspace_draw;
- #else
- widget_class->expose_event = meta_select_workspace_expose_event;
- #endif
}
/**
@@ -1060,8 +867,6 @@ meta_convert_meta_to_wnck (MetaWindow *window, MetaScreen *screen)
return wnck_window;
}
-#if GTK_CHECK_VERSION(3, 0, 0)
-
static gboolean
meta_select_workspace_draw (GtkWidget *widget,
cairo_t *cr)
@@ -1148,94 +953,3 @@ meta_select_workspace_draw (GtkWidget *widget,
return TRUE;
}
-
-#else
-
-static gboolean
-meta_select_workspace_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- MetaWorkspace *workspace;
- WnckWindowDisplayInfo *windows;
- GtkAllocation allocation;
- GtkStyle *style;
- GdkWindow *window;
- cairo_t *cr;
- int i, n_windows;
- GList *tmp, *list;
-
- workspace = META_SELECT_WORKSPACE (widget)->workspace;
-
- list = meta_stack_list_windows (workspace->screen->stack, workspace);
- n_windows = g_list_length (list);
- windows = g_new (WnckWindowDisplayInfo, n_windows);
-
- tmp = list;
- i = 0;
- while (tmp != NULL)
- {
- MetaWindow *window;
- gboolean ignoreable_sticky;
-
- window = tmp->data;
-
- ignoreable_sticky = window->on_all_workspaces &&
- workspace != workspace->screen->active_workspace;
-
- if (window->skip_pager ||
- !meta_window_showing_on_its_workspace (window) ||
- window->unmaps_pending ||
- ignoreable_sticky)
- {
- --n_windows;
- }
- else
- {
- windows[i] = meta_convert_meta_to_wnck (window, workspace->screen);
- i++;
- }
- tmp = tmp->next;
- }
-
- g_list_free (list);
-
- window = gtk_widget_get_window (widget);
- gtk_widget_get_allocation (widget, &allocation);
-
- wnck_draw_workspace (widget,
- window,
- SELECT_OUTLINE_WIDTH,
- SELECT_OUTLINE_WIDTH,
- allocation.width - SELECT_OUTLINE_WIDTH * 2,
- allocation.height - SELECT_OUTLINE_WIDTH * 2,
- workspace->screen->rect.width,
- workspace->screen->rect.height,
- NULL,
- (workspace->screen->active_workspace == workspace),
- windows,
- n_windows);
-
- g_free (windows);
-
- if (META_SELECT_WORKSPACE (widget)->selected)
- {
- style = gtk_widget_get_style (widget);
- cr = gdk_cairo_create (window);
-
- gdk_cairo_set_source_color (cr,
- &style->fg[gtk_widget_get_state (widget)]);
- cairo_set_line_width (cr, SELECT_OUTLINE_WIDTH);
-
- cairo_rectangle (cr,
- SELECT_OUTLINE_WIDTH / 2.0, SELECT_OUTLINE_WIDTH / 2.0,
- allocation.width - SELECT_OUTLINE_WIDTH,
- allocation.height - SELECT_OUTLINE_WIDTH);
- cairo_stroke (cr);
-
- cairo_destroy (cr);
- }
-
- return TRUE;
-}
-
-#endif
diff --git a/src/ui/testgradient.c b/src/ui/testgradient.c
index 8875452d..80a578a5 100644
--- a/src/ui/testgradient.c
+++ b/src/ui/testgradient.c
@@ -24,34 +24,21 @@
#include <gtk/gtk.h>
typedef void (* RenderGradientFunc) (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width,
int height);
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
draw_checkerboard (cairo_t *cr,
-#else
-draw_checkerboard (GdkDrawable *drawable,
-#endif
int width,
int height)
{
gint i, j, xcount, ycount;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color1, color2;
-#else
- GdkColor color1, color2;
- cairo_t *cr;
-#endif
#define CHECK_SIZE 10
#define SPACING 2
-#if GTK_CHECK_VERSION (3, 0, 0)
color1.red = 30000. / 65535.;
color1.green = 30000. / 65535.;
color1.blue = 30000. / 65535.;
@@ -61,17 +48,6 @@ draw_checkerboard (GdkDrawable *drawable,
color2.green = 50000. / 65535.;
color2.blue = 50000. / 65535.;
color2.alpha = 1.0;
-#else
- color1.red = 30000;
- color1.green = 30000;
- color1.blue = 30000;
-
- color2.red = 50000;
- color2.green = 50000;
- color2.blue = 50000;
-
- cr = gdk_cairo_create (drawable);
-#endif
xcount = 0;
i = SPACING;
@@ -82,17 +58,9 @@ draw_checkerboard (GdkDrawable *drawable,
while (j < height)
{
if (ycount % 2)
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color1);
-#else
- gdk_cairo_set_source_color (cr, &color1);
-#endif
else
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color2);
-#else
- gdk_cairo_set_source_color (cr, &color2);
-#endif
/* If we're outside event->area, this will do nothing.
* It might be mildly more efficient if we handled
@@ -108,34 +76,20 @@ draw_checkerboard (GdkDrawable *drawable,
i += CHECK_SIZE + SPACING;
++xcount;
}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
}
static void
render_simple (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height,
MetaGradientType type,
gboolean with_alpha)
{
GdkPixbuf *pixbuf;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA from, to;
gdk_rgba_parse (&from, "blue");
gdk_rgba_parse (&to, "green");
-#else
- GdkColor from, to;
-
- gdk_color_parse ("blue", &from);
- gdk_color_parse ("green", &to);
-#endif
pixbuf = meta_gradient_create_simple (width, height,
&from, &to,
@@ -158,11 +112,7 @@ render_simple (
alphas, G_N_ELEMENTS (alphas),
META_GRADIENT_HORIZONTAL);
-#if GTK_CHECK_VERSION (3, 0, 0)
draw_checkerboard (cr, width, height);
-#else
- draw_checkerboard (drawable, width, height);
-#endif
}
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
@@ -174,69 +124,38 @@ render_simple (
static void
render_vertical_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_simple (cr, width, height, META_GRADIENT_VERTICAL, FALSE);
-#else
- render_simple (drawable, cr, width, height, META_GRADIENT_VERTICAL, FALSE);
-#endif
}
static void
render_horizontal_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_simple (cr, width, height, META_GRADIENT_HORIZONTAL, FALSE);
-#else
- render_simple (drawable, cr, width, height, META_GRADIENT_HORIZONTAL, FALSE);
-#endif
}
static void
render_diagonal_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_simple (cr, width, height, META_GRADIENT_DIAGONAL, FALSE);
-#else
- render_simple (drawable, cr, width, height, META_GRADIENT_DIAGONAL, FALSE);
-#endif
}
static void
render_diagonal_alpha_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_simple (cr, width, height, META_GRADIENT_DIAGONAL, TRUE);
-#else
- render_simple (drawable, cr, width, height, META_GRADIENT_DIAGONAL, TRUE);
-#endif
}
static void
render_multi (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height,
MetaGradientType type)
@@ -244,7 +163,6 @@ render_multi (
GdkPixbuf *pixbuf;
#define N_COLORS 5
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA colors[N_COLORS];
gdk_rgba_parse (&colors[0], "red");
@@ -252,15 +170,6 @@ render_multi (
gdk_rgba_parse (&colors[2], "orange");
gdk_rgba_parse (&colors[3], "pink");
gdk_rgba_parse (&colors[4], "green");
-#else
- GdkColor colors[N_COLORS];
-
- gdk_color_parse ("red", &colors[0]);
- gdk_color_parse ("blue", &colors[1]);
- gdk_color_parse ("orange", &colors[2]);
- gdk_color_parse ("pink", &colors[3]);
- gdk_color_parse ("green", &colors[4]);
-#endif
pixbuf = meta_gradient_create_multi (width, height,
colors, N_COLORS,
@@ -276,75 +185,42 @@ render_multi (
static void
render_vertical_multi_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_multi (cr, width, height, META_GRADIENT_VERTICAL);
-#else
- render_multi (drawable, cr, width, height, META_GRADIENT_VERTICAL);
-#endif
}
static void
render_horizontal_multi_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_multi (cr, width, height, META_GRADIENT_HORIZONTAL);
-#else
- render_multi (drawable, cr, width, height, META_GRADIENT_HORIZONTAL);
-#endif
}
static void
render_diagonal_multi_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
render_multi (cr, width, height, META_GRADIENT_DIAGONAL);
-#else
- render_multi (drawable, cr, width, height, META_GRADIENT_DIAGONAL);
-#endif
}
static void
render_interwoven_func (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkDrawable *drawable,
-#endif
cairo_t *cr,
int width, int height)
{
GdkPixbuf *pixbuf;
#define N_COLORS 4
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA colors[N_COLORS];
gdk_rgba_parse (&colors[0], "red");
gdk_rgba_parse (&colors[1], "blue");
gdk_rgba_parse (&colors[2], "pink");
gdk_rgba_parse (&colors[3], "green");
-#else
- GdkColor colors[N_COLORS];
-
- gdk_color_parse ("red", &colors[0]);
- gdk_color_parse ("blue", &colors[1]);
- gdk_color_parse ("pink", &colors[2]);
- gdk_color_parse ("green", &colors[3]);
-#endif
pixbuf = meta_gradient_create_interwoven (width, height,
colors, height / 10,
@@ -358,19 +234,12 @@ render_interwoven_func (
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
draw_callback (GtkWidget *widget,
cairo_t *cr,
gpointer data)
-#else
-expose_callback (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
-#endif
{
RenderGradientFunc func = data;
GtkAllocation allocation;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style;
GdkRGBA color;
@@ -380,41 +249,17 @@ expose_callback (GtkWidget *widget,
gtk_style_context_set_state (style, gtk_widget_get_state_flags (widget));
gtk_style_context_lookup_color (style, "foreground-color", &color);
gtk_style_context_restore (style);
-#else
- GdkWindow *window;
- GtkStyle *style;
- cairo_t *cr;
-
- style = gtk_widget_get_style (widget);
-#endif
gtk_widget_get_allocation (widget, &allocation);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
-#else
- window = gtk_widget_get_window (widget);
- cr = gdk_cairo_create (window);
- gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
-#endif
(* func) (
-#if !GTK_CHECK_VERSION (3, 0, 0)
- window,
-#endif
cr,
allocation.width,
allocation.height);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
return FALSE;
-#else
- return TRUE;
-#endif
}
static GtkWidget*
@@ -435,13 +280,8 @@ create_gradient_window (const char *title,
gtk_window_set_default_size (GTK_WINDOW (window), 175, 175);
g_signal_connect (G_OBJECT (drawing_area),
-#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (draw_callback),
-#else
- "expose_event",
- G_CALLBACK (expose_callback),
-#endif
func);
gtk_container_add (GTK_CONTAINER (window), drawing_area);
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index 62640a5c..49166f55 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -35,12 +35,6 @@
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x
-/* Silence Gtk{V,H}Box deprecations warnings */
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X, Y) gtk_box_new(GTK_ORIENTATION_VERTICAL, Y)
-#define gtk_hbox_new(X, Y) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, Y)
-#endif
-
/* We need to compute all different button arrangements
* in terms of button location. We don't care about
* different arrangements in terms of button function.
@@ -239,13 +233,9 @@ dialog_contents (void)
GtkWidget *image;
GtkWidget *button;
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
action_area = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- action_area = gtk_hbutton_box_new ();
-#endif
gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area),
GTK_BUTTONBOX_END);
@@ -263,17 +253,13 @@ dialog_contents (void)
label = gtk_label_new (_("This is a sample message in a sample dialog"));
image = gtk_image_new_from_icon_name ("dialog-information",
GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
-#endif
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), image,
FALSE, FALSE, 0);
@@ -343,19 +329,15 @@ menu_contents (void)
gtk_frame_set_shadow_type (GTK_FRAME (frame),
GTK_SHADOW_OUT);
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
i = 0;
while (i < 10)
{
char *str = g_strdup_printf (_("Fake menu item %d\n"), i + 1);
mi = gtk_label_new (str);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (mi, GTK_ALIGN_START);
gtk_widget_set_valign (mi, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment (GTK_MISC (mi), 0.0, 0.5);
-#endif
g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), mi, FALSE, FALSE, 0);
@@ -384,7 +366,7 @@ border_only_contents (void)
color.blue = 40000;
gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, &color);
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
w = gtk_label_new (_("Border-only window"));
@@ -499,7 +481,7 @@ preview_collection (int font_size,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- box = gtk_vbox_new (FALSE, 0);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_spacing (GTK_BOX (box), 20);
gtk_container_set_border_width (GTK_CONTAINER (box), 20);
@@ -722,7 +704,7 @@ previews_of_button_layouts (void)
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
- box = gtk_vbox_new (FALSE, 0);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_spacing (GTK_BOX (box), 20);
gtk_container_set_border_width (GTK_CONTAINER (box), 20);
diff --git a/src/ui/theme.c b/src/ui/theme.c
index a0f745b4..e45f98e2 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -63,7 +63,6 @@
#define __USE_XOPEN
#include <math.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#define GDK_COLOR_RGBA(color) \
((guint32) (0xff | \
((int)((color).red * 255) << 24) | \
@@ -74,18 +73,6 @@
((guint32) (((int)((color).red * 255) << 16) | \
((int)((color).green * 255) << 8) | \
((int)((color).blue * 255))))
-#else
-#define GDK_COLOR_RGBA(color) \
- ((guint32) (0xff | \
- (((color).red / 256) << 24) | \
- (((color).green / 256) << 16) | \
- (((color).blue / 256) << 8)))
-
-#define GDK_COLOR_RGB(color) \
- ((guint32) ((((color).red / 256) << 16) | \
- (((color).green / 256) << 8) | \
- (((color).blue / 256))))
-#endif
#define ALPHA_TO_UCHAR(d) ((unsigned char) ((d) * 255))
@@ -93,15 +80,9 @@
#define CLAMP_UCHAR(v) ((guchar) (CLAMP (((int)v), (int)0, (int)255)))
#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
-#if GTK_CHECK_VERSION (3, 0, 0)
static void gtk_style_shade (GdkRGBA *a,
GdkRGBA *b,
gdouble k);
-#else
-static void gtk_style_shade (GdkColor *a,
- GdkColor *b,
- gdouble k);
-#endif
static void rgb_to_hls (gdouble *r,
gdouble *g,
gdouble *b);
@@ -114,15 +95,9 @@ static void hls_to_rgb (gdouble *h,
*/
static MetaTheme *meta_current_theme = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
static GdkPixbuf *
colorize_pixbuf (GdkPixbuf *orig,
GdkRGBA *new_color)
-#else
-static GdkPixbuf *
-colorize_pixbuf (GdkPixbuf *orig,
- GdkColor *new_color)
-#endif
{
GdkPixbuf *pixbuf;
double intensity;
@@ -165,28 +140,16 @@ colorize_pixbuf (GdkPixbuf *orig,
if (intensity <= 0.5)
{
/* Go from black at intensity = 0.0 to new_color at intensity = 0.5 */
-#if GTK_CHECK_VERSION (3, 0, 0)
dr = new_color->red * intensity * 2.0;
dg = new_color->green * intensity * 2.0;
db = new_color->blue * intensity * 2.0;
-#else
- dr = (new_color->red * intensity * 2.0) / 65535.0;
- dg = (new_color->green * intensity * 2.0) / 65535.0;
- db = (new_color->blue * intensity * 2.0) / 65535.0;
-#endif
}
else
{
/* Go from new_color at intensity = 0.5 to white at intensity = 1.0 */
-#if GTK_CHECK_VERSION (3, 0, 0)
dr = new_color->red + (1.0 - new_color->red) * (intensity - 0.5) * 2.0;
dg = new_color->green + (1.0 - new_color->green) * (intensity - 0.5) * 2.0;
db = new_color->blue + (1.0 - new_color->blue) * (intensity - 0.5) * 2.0;
-#else
- dr = (new_color->red + (65535 - new_color->red) * (intensity - 0.5) * 2.0) / 65535.0;
- dg = (new_color->green + (65535 - new_color->green) * (intensity - 0.5) * 2.0) / 65535.0;
- db = (new_color->blue + (65535 - new_color->blue) * (intensity - 0.5) * 2.0) / 65535.0;
-#endif
}
dest[0] = CLAMP_UCHAR (255 * dr);
@@ -210,7 +173,6 @@ colorize_pixbuf (GdkPixbuf *orig,
return pixbuf;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
color_composite (const GdkRGBA *bg,
const GdkRGBA *fg,
@@ -222,22 +184,6 @@ color_composite (const GdkRGBA *bg,
color->green = color->green + (fg->green - color->green) * alpha;
color->blue = color->blue + (fg->blue - color->blue) * alpha;
}
-#else
-static void
-color_composite (const GdkColor *bg,
- const GdkColor *fg,
- double alpha_d,
- GdkColor *color)
-{
- guint16 alpha;
-
- *color = *bg;
- alpha = alpha_d * 0xffff;
- color->red = color->red + (((fg->red - color->red) * alpha + 0x8000) >> 16);
- color->green = color->green + (((fg->green - color->green) * alpha + 0x8000) >> 16);
- color->blue = color->blue + (((fg->blue - color->blue) * alpha + 0x8000) >> 16);
-}
-#endif
/**
* Sets all the fields of a border to dummy values.
@@ -461,14 +407,7 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
{
int buttons_height, title_height;
-#if GTK_CHECK_VERSION(3, 0, 0)
g_return_if_fail (layout != NULL);
-#else
- g_return_if_fail (top_height != NULL);
- g_return_if_fail (bottom_height != NULL);
- g_return_if_fail (left_width != NULL);
- g_return_if_fail (right_width != NULL);
-#endif
if (!layout->has_title)
text_height = 0;
@@ -1065,26 +1004,14 @@ meta_gradient_spec_free (MetaGradientSpec *spec)
g_free (spec);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf*
meta_gradient_spec_render (const MetaGradientSpec *spec,
GtkStyleContext *style,
int width,
int height)
-#else
-GdkPixbuf*
-meta_gradient_spec_render (const MetaGradientSpec *spec,
- GtkStyle *style,
- int width,
- int height)
-#endif
{
int n_colors;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *colors;
-#else
- GdkColor *colors;
-#endif
GSList *tmp;
int i;
GdkPixbuf *pixbuf;
@@ -1094,11 +1021,7 @@ meta_gradient_spec_render (const MetaGradientSpec *spec,
if (n_colors == 0)
return NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
colors = g_new (GdkRGBA, n_colors);
-#else
- colors = g_new (GdkColor, n_colors);
-#endif
i = 0;
tmp = spec->color_specs;
@@ -1244,11 +1167,7 @@ meta_color_spec_new_from_string (const char *str,
const char *bracket;
const char *end_bracket;
char *tmp;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags state;
-#else
- GtkStateType state;
-#endif
MetaGtkColorComponent component;
bracket = str;
@@ -1440,11 +1359,7 @@ meta_color_spec_new_from_string (const char *str,
{
spec = meta_color_spec_new (META_COLOR_SPEC_BASIC);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (!gdk_rgba_parse (&spec->data.basic.color, str))
-#else
- if (!gdk_color_parse (str, &spec->data.basic.color))
-#endif
{
g_set_error (err, META_THEME_ERROR,
META_THEME_ERROR_FAILED,
@@ -1460,15 +1375,9 @@ meta_color_spec_new_from_string (const char *str,
return spec;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
MetaColorSpec*
meta_color_spec_new_gtk (MetaGtkColorComponent component,
GtkStateFlags state)
-#else
-MetaColorSpec*
-meta_color_spec_new_gtk (MetaGtkColorComponent component,
- GtkStateType state)
-#endif
{
MetaColorSpec *spec;
@@ -1480,7 +1389,6 @@ meta_color_spec_new_gtk (MetaGtkColorComponent component,
return spec;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
get_background_color_real (GtkStyleContext *context,
GtkStateFlags state,
@@ -1596,65 +1504,15 @@ meta_set_color_from_style (GdkRGBA *color,
break;
}
}
-#else
-static void
-meta_set_color_from_style (GdkColor *color,
- GtkStyle *widget_style,
- GtkStateType state,
- MetaGtkColorComponent component)
-{
- switch (component)
- {
- case META_GTK_COLOR_BG:
- *color = widget_style->bg[state];
- break;
- case META_GTK_COLOR_FG:
- *color = widget_style->fg[state];
- break;
- case META_GTK_COLOR_BASE:
- *color = widget_style->base[state];
- break;
- case META_GTK_COLOR_TEXT:
- *color = widget_style->text[state];
- break;
- case META_GTK_COLOR_LIGHT:
- *color = widget_style->light[state];
- break;
- case META_GTK_COLOR_DARK:
- *color = widget_style->dark[state];
- break;
- case META_GTK_COLOR_MID:
- *color = widget_style->mid[state];
- break;
- case META_GTK_COLOR_TEXT_AA:
- *color = widget_style->text_aa[state];
- break;
- case META_GTK_COLOR_LAST:
- g_assert_not_reached ();
- break;
- }
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
void
meta_color_spec_render (MetaColorSpec *spec,
GtkStyleContext *style,
GdkRGBA *color)
-#else
-void
-meta_color_spec_render (MetaColorSpec *spec,
- GtkStyle *style,
- GdkColor *color)
-#endif
{
g_return_if_fail (spec != NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_return_if_fail (GTK_IS_STYLE_CONTEXT (style));
-#else
- g_return_if_fail (style != NULL);
-#endif
switch (spec->type)
{
@@ -1671,11 +1529,7 @@ meta_color_spec_render (MetaColorSpec *spec,
case META_COLOR_SPEC_BLEND:
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA bg, fg;
-#else
- GdkColor bg, fg;
-#endif
meta_color_spec_render (spec->data.blend.background, style, &bg);
meta_color_spec_render (spec->data.blend.foreground, style, &fg);
@@ -3435,11 +3289,7 @@ scale_and_alpha_pixbuf (GdkPixbuf *src,
static GdkPixbuf*
draw_op_as_pixbuf (const MetaDrawOp *op,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style,
-#else
- GtkStyle *style,
-#endif
const MetaDrawInfo *info,
int width,
int height)
@@ -3460,11 +3310,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op,
case META_DRAW_RECTANGLE:
if (op->data.rectangle.filled)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
meta_color_spec_render (op->data.rectangle.color_spec,
style,
@@ -3486,11 +3332,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op,
case META_DRAW_TINT:
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
guint32 rgba;
gboolean has_alpha;
@@ -3551,11 +3393,7 @@ draw_op_as_pixbuf (const MetaDrawOp *op,
{
if (op->data.image.colorize_spec)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
meta_color_spec_render (op->data.image.colorize_spec,
style, &color);
@@ -3679,41 +3517,19 @@ fill_env (MetaPositionExprEnv *env,
*/
static void
meta_draw_op_draw_with_env (const MetaDrawOp *op,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle rect,
MetaPositionExprEnv *env)
{
- #if GTK_CHECK_VERSION(3, 0, 0)
GdkRGBA color;
cairo_save (cr);
gtk_style_context_save (style_gtk);
- #else
- GdkColor color;
- GtkStyle *style_gtk = gtk_widget_get_style (widget);
-
- cairo_t *cr;
- cr = gdk_cairo_create (drawable);
- #endif
cairo_set_line_width (cr, 1.0);
- #if !GTK_CHECK_VERSION(3, 0, 0)
- if (clip)
- {
- gdk_cairo_rectangle (cr, clip);
- cairo_clip (cr);
- }
- #endif
-
switch (op->type)
{
case META_DRAW_LINE:
@@ -3721,11 +3537,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
int x1, x2, y1, y2;
meta_color_spec_render (op->data.line.color_spec, style_gtk, &color);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
if (op->data.line.width > 0)
cairo_set_line_width (cr, op->data.line.width);
@@ -3800,11 +3612,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
int rx, ry, rwidth, rheight;
meta_color_spec_render (op->data.rectangle.color_spec, style_gtk, &color);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
rx = parse_x_position_unchecked (op->data.rectangle.x, env);
ry = parse_y_position_unchecked (op->data.rectangle.y, env);
@@ -3834,11 +3642,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
double center_x, center_y;
meta_color_spec_render (op->data.arc.color_spec, style_gtk, &color);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
rx = parse_x_position_unchecked (op->data.arc.x, env);
ry = parse_y_position_unchecked (op->data.arc.y, env);
@@ -3893,11 +3697,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
if (!needs_alpha)
{
meta_color_spec_render (op->data.tint.color_spec, style_gtk, &color);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
cairo_rectangle (cr, rx, ry, rwidth, rheight);
cairo_fill (cr);
@@ -3982,8 +3782,6 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
rwidth = parse_size_unchecked (op->data.gtk_arrow.width, env);
rheight = parse_size_unchecked (op->data.gtk_arrow.height, env);
- #if GTK_CHECK_VERSION(3, 0, 0)
-
double size = MAX(rwidth, rheight), angle = 0;
switch (op->data.gtk_arrow.arrow)
@@ -4006,20 +3804,6 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
gtk_style_context_set_state (style_gtk, op->data.gtk_arrow.state);
gtk_render_arrow (style_gtk, cr, angle, rx, ry, size);
-
- #else
-
- gtk_paint_arrow (style_gtk,
- drawable,
- op->data.gtk_arrow.state,
- op->data.gtk_arrow.shadow,
- (GdkRectangle*) clip,
- widget,
- "marco",
- op->data.gtk_arrow.arrow,
- op->data.gtk_arrow.filled,
- rx, ry, rwidth, rheight);
- #endif
}
break;
@@ -4032,20 +3816,9 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
rwidth = parse_size_unchecked (op->data.gtk_box.width, env);
rheight = parse_size_unchecked (op->data.gtk_box.height, env);
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_style_context_set_state (style_gtk, op->data.gtk_box.state);
gtk_render_background (style_gtk, cr, rx, ry, rwidth, rheight);
gtk_render_frame (style_gtk, cr, rx, ry, rwidth, rheight);
- #else
- gtk_paint_box (style_gtk,
- drawable,
- op->data.gtk_box.state,
- op->data.gtk_box.shadow,
- (GdkRectangle*) clip,
- widget,
- "marco",
- rx, ry, rwidth, rheight);
- #endif
}
break;
@@ -4057,18 +3830,8 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env);
ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env);
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_style_context_set_state (style_gtk, op->data.gtk_vline.state);
gtk_render_line (style_gtk, cr, rx, ry1, rx, ry2);
- #else
- gtk_paint_vline (style_gtk,
- drawable,
- op->data.gtk_vline.state,
- (GdkRectangle*) clip,
- widget,
- "marco",
- ry1, ry2, rx);
- #endif
}
break;
@@ -4102,11 +3865,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
int rx, ry;
meta_color_spec_render (op->data.title.color_spec, style_gtk, &color);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
rx = parse_x_position_unchecked (op->data.title.x, env);
ry = parse_y_position_unchecked (op->data.title.y, env);
@@ -4122,7 +3881,6 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
cairo_pattern_t *linpat;
linpat = cairo_pattern_create_linear (rx, ry, text_space,
env->title_height);
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_pattern_add_color_stop_rgba (linpat, 0, color.red,
color.green,
color.blue,
@@ -4135,26 +3893,10 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
cairo_pattern_add_color_stop_rgba (linpat, 1, color.red,
color.green,
color.blue, 0);
-#else
- cairo_pattern_add_color_stop_rgb (linpat, 0, color.red/65535.0,
- color.green/65535.0,
- color.blue/65535.0);
- cairo_pattern_add_color_stop_rgb (linpat, startalpha,
- color.red/65535.0,
- color.green/65535.0,
- color.blue/65535.0);
- cairo_pattern_add_color_stop_rgba (linpat, 1, color.red/65535.0,
- color.green/65535.0,
- color.blue/65535.0, 0);
-#endif
cairo_set_source(cr, linpat);
cairo_pattern_destroy(linpat);
} else {
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &color);
-#else
- gdk_cairo_set_source_color (cr, &color);
-#endif
}
cairo_move_to (cr, rx, ry);
@@ -4172,13 +3914,8 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
d_rect.height = parse_size_unchecked (op->data.op_list.height, env);
meta_draw_op_list_draw_with_style (op->data.op_list.op_list,
- #if GTK_CHECK_VERSION(3, 0, 0)
style_gtk,
cr,
- #else
- widget,
- drawable, clip,
- #endif
info, d_rect);
}
break;
@@ -4187,9 +3924,6 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
{
int rx, ry, rwidth, rheight;
int tile_xoffset, tile_yoffset;
- #if !GTK_CHECK_VERSION(3, 0, 0)
- GdkRectangle new_clip;
- #endif
MetaRectangle tile;
rx = parse_x_position_unchecked (op->data.tile.x, env);
@@ -4197,7 +3931,6 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
rwidth = parse_size_unchecked (op->data.tile.width, env);
rheight = parse_size_unchecked (op->data.tile.height, env);
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_save (cr);
cairo_rectangle (cr, rx, ry, rwidth, rheight);
@@ -4229,70 +3962,18 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
tile.x += tile.width;
}
cairo_restore (cr);
-
- #else
-
- new_clip.x = rx;
- new_clip.y = ry;
- new_clip.width = rwidth;
- new_clip.height = rheight;
-
- if (clip == NULL || gdk_rectangle_intersect ((GdkRectangle*)clip, &new_clip,
- &new_clip))
- {
- tile_xoffset = parse_x_position_unchecked (op->data.tile.tile_xoffset, env);
- tile_yoffset = parse_y_position_unchecked (op->data.tile.tile_yoffset, env);
- /* tile offset should not include x/y */
- tile_xoffset -= rect.x;
- tile_yoffset -= rect.y;
-
- tile.width = parse_size_unchecked (op->data.tile.tile_width, env);
- tile.height = parse_size_unchecked (op->data.tile.tile_height, env);
-
- tile.x = rx - tile_xoffset;
-
- while (tile.x < (rx + rwidth))
- {
- tile.y = ry - tile_yoffset;
- while (tile.y < (ry + rheight))
- {
- meta_draw_op_list_draw_with_style (op->data.tile.op_list,
-#if GTK_CHECK_VERSION (3, 0, 0)
- style_gtk, drawable, &new_clip, info,
-#else
- widget, drawable, &new_clip, info,
-#endif
- tile);
-
- tile.y += tile.height;
- }
-
- tile.x += tile.width;
- }
- }
- #endif
}
break;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_restore (cr);
gtk_style_context_restore (style_gtk);
-#else
- cairo_destroy (cr);
-#endif
}
void
meta_draw_op_draw_with_style (const MetaDrawOp *op,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle logical_region)
{
@@ -4301,13 +3982,8 @@ meta_draw_op_draw_with_style (const MetaDrawOp *op,
fill_env (&env, info, logical_region);
meta_draw_op_draw_with_env (op,
- #if GTK_CHECK_VERSION(3, 0, 0)
style_gtk,
cr,
- #else
- widget,
- drawable, clip,
- #endif
info, logical_region,
&env);
@@ -4316,23 +3992,13 @@ meta_draw_op_draw_with_style (const MetaDrawOp *op,
void
meta_draw_op_draw (const MetaDrawOp *op,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle logical_region)
{
meta_draw_op_draw_with_style (op,
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_style_context (widget),
cr,
- #else
- widget,
- drawable, clip,
- #endif
info, logical_region);
}
@@ -4385,24 +4051,14 @@ meta_draw_op_list_unref (MetaDrawOpList *op_list)
void
meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle rect)
{
/* BOOKMARK */
int i;
- #if !GTK_CHECK_VERSION(3, 0, 0)
- GdkRectangle active_clip;
- GdkRectangle orig_clip;
- #endif
MetaPositionExprEnv env;
if (op_list->n_ops == 0)
@@ -4422,29 +4078,12 @@ meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
* adjacent items when possible.
*/
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_save (cr);
- #else
- if (clip)
- {
- orig_clip = *clip;
- }
- else
- {
- orig_clip.x = rect.x;
- orig_clip.y = rect.y;
- orig_clip.width = rect.width;
- orig_clip.height = rect.height;
- }
-
- active_clip = orig_clip;
- #endif
for (i = 0; i < op_list->n_ops; i++)
{
MetaDrawOp *op = op_list->ops[i];
- #if GTK_CHECK_VERSION(3, 0, 0)
if (op->type == META_DRAW_CLIP)
{
cairo_restore (cr);
@@ -4462,55 +4101,22 @@ meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
{
meta_draw_op_draw_with_env (op, style_gtk, cr, info, rect, &env);
}
-
- #else
-
- if (op->type == META_DRAW_CLIP)
- {
- active_clip.x = parse_x_position_unchecked (op->data.clip.x, &env);
- active_clip.y = parse_y_position_unchecked (op->data.clip.y, &env);
- active_clip.width = parse_size_unchecked (op->data.clip.width, &env);
- active_clip.height = parse_size_unchecked (op->data.clip.height, &env);
-
- gdk_rectangle_intersect (&orig_clip, &active_clip, &active_clip);
- }
- else if (active_clip.width > 0 &&
- active_clip.height > 0)
- {
- meta_draw_op_draw_with_env (op,
- widget, drawable, &active_clip, info,
- rect,
- &env);
- }
- #endif
}
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_restore (cr);
- #endif
}
void
meta_draw_op_list_draw (const MetaDrawOpList *op_list,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle rect)
{
meta_draw_op_list_draw_with_style (op_list,
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_style_context (widget),
cr,
- #else
- widget,
- drawable, clip,
- #endif
info, rect);
}
@@ -4875,16 +4481,8 @@ get_button_rect (MetaButtonType type,
void
meta_frame_style_draw_with_style (MetaFrameStyle *style,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- int x_offset,
- int y_offset,
- const GdkRectangle *clip,
- #endif
const MetaFrameGeometry *fgeom,
int client_width,
int client_height,
@@ -4961,9 +4559,6 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
while (i < META_FRAME_PIECE_LAST)
{
GdkRectangle rect;
- #if !GTK_CHECK_VERSION(3, 0, 0)
- GdkRectangle combined_clip;
- #endif
switch ((MetaFramePiece) i)
{
@@ -5030,8 +4625,6 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
break;
}
- #if GTK_CHECK_VERSION(3, 0, 0)
-
cairo_save (cr);
gdk_cairo_rectangle (cr, &rect);
@@ -5064,50 +4657,7 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
cairo_restore (cr);
- #else
-
- rect.x += x_offset;
- rect.y += y_offset;
-
- if (clip == NULL)
- combined_clip = rect;
- else
- gdk_rectangle_intersect ((GdkRectangle*) clip, /* const cast */
- &rect,
- &combined_clip);
-
- if (combined_clip.width > 0 && combined_clip.height > 0)
- {
- MetaDrawOpList *op_list;
- MetaFrameStyle *parent;
-
- parent = style;
- op_list = NULL;
- while (parent && op_list == NULL)
- {
- op_list = parent->pieces[i];
- parent = parent->parent;
- }
-
- if (op_list)
- {
- MetaRectangle m_rect;
- m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
- meta_draw_op_list_draw_with_style (op_list,
- widget,
- drawable,
- &combined_clip,
- &draw_info,
- m_rect);
- }
- }
-
- #endif
-
-
/* Draw buttons just before overlay */
- #if GTK_CHECK_VERSION(3, 0, 0)
-
if ((i + 1) == META_FRAME_PIECE_OVERLAY)
{
MetaDrawOpList *op_list;
@@ -5162,69 +4712,6 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
}
}
- #else
-
- if ((i + 1) == META_FRAME_PIECE_OVERLAY)
- {
- int middle_bg_offset;
-
- middle_bg_offset = 0;
- j = 0;
- while (j < META_BUTTON_TYPE_LAST)
- {
- MetaButtonState button_state;
-
- get_button_rect (j, fgeom, middle_bg_offset, &rect);
-
- rect.x += x_offset;
- rect.y += y_offset;
-
- if (clip == NULL)
- combined_clip = rect;
- else
- gdk_rectangle_intersect ((GdkRectangle*) clip, /* const cast */
- &rect,
- &combined_clip);
-
- if (combined_clip.width > 0 && combined_clip.height > 0)
- {
- MetaDrawOpList *op_list;
-
- button_state = map_button_state (j, fgeom, middle_bg_offset, button_states);
-
- op_list = get_button (style, j, button_state);
-
- if (op_list)
- {
- MetaRectangle m_rect;
- m_rect = meta_rect (rect.x, rect.y,
- rect.width, rect.height);
- meta_draw_op_list_draw_with_style (op_list,
- widget,
- drawable,
- &combined_clip,
- &draw_info,
- m_rect);
- }
- }
-
- /* MIDDLE_BACKGROUND type may get drawn more than once */
- if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
- j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
- (middle_bg_offset < (MAX_MIDDLE_BACKGROUNDS - 1)))
- {
- ++middle_bg_offset;
- }
- else
- {
- middle_bg_offset = 0;
- ++j;
- }
- }
- }
-
- #endif
-
++i;
}
}
@@ -5232,14 +4719,7 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
void
meta_frame_style_draw (MetaFrameStyle *style,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- int x_offset,
- int y_offset,
- const GdkRectangle *clip,
- #endif
const MetaFrameGeometry *fgeom,
int client_width,
int client_height,
@@ -5250,13 +4730,8 @@ meta_frame_style_draw (MetaFrameStyle *style,
GdkPixbuf *icon)
{
meta_frame_style_draw_with_style (style,
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_style_context (widget),
cr,
- #else
- widget,
- drawable, x_offset, y_offset, clip,
- #endif
fgeom, client_width, client_height,
title_layout, text_height,
button_states, mini_icon, icon);
@@ -5851,16 +5326,8 @@ meta_theme_get_title_scale (MetaTheme *theme,
void
meta_theme_draw_frame_with_style (MetaTheme *theme,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- int x_offset,
- int y_offset,
- #endif
MetaFrameType type,
MetaFrameFlags flags,
int client_width,
@@ -5892,13 +5359,8 @@ meta_theme_draw_frame_with_style (MetaTheme *theme,
theme);
meta_frame_style_draw_with_style (style,
- #if GTK_CHECK_VERSION(3, 0, 0)
style_gtk,
cr,
- #else
- widget,
- drawable, x_offset, y_offset, clip,
- #endif
&fgeom,
client_width, client_height,
title_layout,
@@ -5910,14 +5372,7 @@ meta_theme_draw_frame_with_style (MetaTheme *theme,
void
meta_theme_draw_frame (MetaTheme *theme,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- int x_offset,
- int y_offset,
- #endif
MetaFrameType type,
MetaFrameFlags flags,
int client_width,
@@ -5930,13 +5385,8 @@ meta_theme_draw_frame (MetaTheme *theme,
GdkPixbuf *icon)
{
meta_theme_draw_frame_with_style (theme,
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_style_context (widget),
cr,
- #else
- widget,
- drawable, clip, x_offset, y_offset,
- #endif
type, flags, client_width, client_height,
title_layout, text_height,
button_layout, button_states,
@@ -5946,14 +5396,7 @@ meta_theme_draw_frame (MetaTheme *theme,
void
meta_theme_draw_frame_by_name (MetaTheme *theme,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- int x_offset,
- int y_offset,
- #endif
const gchar *style_name,
MetaFrameFlags flags,
int client_width,
@@ -5984,11 +5427,7 @@ meta_theme_draw_frame_by_name (MetaTheme *theme,
meta_frame_style_draw (style,
widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cr,
- #else
- drawable, x_offset, y_offset, clip,
- #endif
&fgeom,
client_width, client_height,
title_layout,
@@ -6335,18 +5774,10 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
{
PangoFontDescription *font_desc;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style = gtk_widget_get_style_context (widget);
GtkStateFlags state = gtk_widget_get_state_flags (widget);
gtk_style_context_get(style, state, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);
font_desc = pango_font_description_copy (font_desc);
-#else
- font_desc = pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
-#endif
if (override)
pango_font_description_merge (font_desc, override, TRUE);
@@ -6814,7 +6245,6 @@ meta_gradient_type_to_string (MetaGradientType type)
return "<unknown>";
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags
meta_gtk_state_from_string (const char *str)
{
@@ -6837,44 +6267,6 @@ meta_gtk_state_from_string (const char *str)
else
return -1; /* hack */
}
-#else
-GtkStateType
-meta_gtk_state_from_string (const char *str)
-{
- if (strcmp ("normal", str) == 0 || strcmp ("NORMAL", str) == 0)
- return GTK_STATE_NORMAL;
- else if (strcmp ("prelight", str) == 0 || strcmp ("PRELIGHT", str) == 0)
- return GTK_STATE_PRELIGHT;
- else if (strcmp ("active", str) == 0 || strcmp ("ACTIVE", str) == 0)
- return GTK_STATE_ACTIVE;
- else if (strcmp ("selected", str) == 0 || strcmp ("SELECTED", str) == 0)
- return GTK_STATE_SELECTED;
- else if (strcmp ("insensitive", str) == 0 || strcmp ("INSENSITIVE", str) == 0)
- return GTK_STATE_INSENSITIVE;
- else
- return -1; /* hack */
-}
-
-const char*
-meta_gtk_state_to_string (GtkStateType state)
-{
- switch (state)
- {
- case GTK_STATE_NORMAL:
- return "NORMAL";
- case GTK_STATE_PRELIGHT:
- return "PRELIGHT";
- case GTK_STATE_ACTIVE:
- return "ACTIVE";
- case GTK_STATE_SELECTED:
- return "SELECTED";
- case GTK_STATE_INSENSITIVE:
- return "INSENSITIVE";
- }
-
- return "<unknown>";
-}
-#endif
GtkShadowType
meta_gtk_shadow_from_string (const char *str)
@@ -6998,31 +6390,18 @@ meta_image_fill_type_to_string (MetaImageFillType fill_type)
* \param b [out] the resulting colour
* \param k amount to scale lightness and saturation by
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
gtk_style_shade (GdkRGBA *a,
GdkRGBA *b,
gdouble k)
-#else
-static void
-gtk_style_shade (GdkColor *a,
- GdkColor *b,
- gdouble k)
-#endif
{
gdouble red;
gdouble green;
gdouble blue;
-#if GTK_CHECK_VERSION (3, 0, 0)
red = a->red;
green = a->green;
blue = a->blue;
-#else
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-#endif
rgb_to_hls (&red, &green, &blue);
@@ -7040,15 +6419,9 @@ gtk_style_shade (GdkColor *a,
hls_to_rgb (&red, &green, &blue);
-#if GTK_CHECK_VERSION (3, 0, 0)
b->red = red;
b->green = green;
b->blue = blue;
-#else
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-#endif
}
/**
diff --git a/src/ui/theme.h b/src/ui/theme.h
index ea3ec196..d023d8d3 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -255,40 +255,22 @@ struct _MetaColorSpec
union
{
struct {
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
} basic;
struct {
MetaGtkColorComponent component;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags state;
-#else
- GtkStateType state;
-#endif
} gtk;
struct {
MetaColorSpec *foreground;
MetaColorSpec *background;
double alpha;
-
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
} blend;
struct {
MetaColorSpec *base;
double factor;
-
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
} shade;
} data;
};
@@ -517,11 +499,7 @@ struct _MetaDrawOp
} image;
struct {
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags state;
-#else
- GtkStateType state;
-#endif
GtkShadowType shadow;
GtkArrowType arrow;
gboolean filled;
@@ -533,11 +511,7 @@ struct _MetaDrawOp
} gtk_arrow;
struct {
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags state;
-#else
- GtkStateType state;
-#endif
GtkShadowType shadow;
MetaDrawSpec *x;
MetaDrawSpec *y;
@@ -546,11 +520,7 @@ struct _MetaDrawOp
} gtk_box;
struct {
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags state;
-#else
- GtkStateType state;
-#endif
MetaDrawSpec *x;
MetaDrawSpec *y1;
MetaDrawSpec *y2;
@@ -924,48 +894,25 @@ void meta_draw_spec_free (MetaDrawSpec *spec);
MetaColorSpec* meta_color_spec_new (MetaColorSpecType type);
MetaColorSpec* meta_color_spec_new_from_string (const char *str,
GError **err);
-#if GTK_CHECK_VERSION (3, 0, 0)
MetaColorSpec* meta_color_spec_new_gtk (MetaGtkColorComponent component,
GtkStateFlags state);
-#else
-MetaColorSpec* meta_color_spec_new_gtk (MetaGtkColorComponent component,
- GtkStateType state);
-#endif
void meta_color_spec_free (MetaColorSpec *spec);
-#if GTK_CHECK_VERSION (3, 0, 0)
void meta_color_spec_render (MetaColorSpec *spec,
GtkStyleContext *style_gtk,
GdkRGBA *color);
-#else
-void meta_color_spec_render (MetaColorSpec *spec,
- GtkStyle *style_gtk,
- GdkColor *color);
-#endif
-
MetaDrawOp* meta_draw_op_new (MetaDrawType type);
void meta_draw_op_free (MetaDrawOp *op);
void meta_draw_op_draw (const MetaDrawOp *op,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
/* logical region being drawn */
MetaRectangle logical_region);
void meta_draw_op_draw_with_style (const MetaDrawOp *op,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
/* logical region being drawn */
MetaRectangle logical_region);
@@ -975,23 +922,12 @@ void meta_draw_op_list_ref (MetaDrawOpList *op_list);
void meta_draw_op_list_unref (MetaDrawOpList *op_list);
void meta_draw_op_list_draw (const MetaDrawOpList *op_list,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle rect);
void meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- #endif
const MetaDrawInfo *info,
MetaRectangle rect);
void meta_draw_op_list_append (MetaDrawOpList *op_list,
@@ -1003,17 +939,10 @@ gboolean meta_draw_op_list_contains (MetaDrawOpList *op_list,
MetaGradientSpec* meta_gradient_spec_new (MetaGradientType type);
void meta_gradient_spec_free (MetaGradientSpec *desc);
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf* meta_gradient_spec_render (const MetaGradientSpec *desc,
GtkStyleContext *style_gtk,
int width,
int height);
-#else
-GdkPixbuf* meta_gradient_spec_render (const MetaGradientSpec *desc,
- GtkStyle *style_gtk,
- int width,
- int height);
-#endif
gboolean meta_gradient_spec_validate (MetaGradientSpec *spec,
GError **error);
@@ -1028,14 +957,7 @@ void meta_frame_style_unref (MetaFrameStyle *style);
void meta_frame_style_draw (MetaFrameStyle *style,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- int x_offset,
- int y_offset,
- const GdkRectangle *clip,
- #endif
const MetaFrameGeometry *fgeom,
int client_width,
int client_height,
@@ -1047,16 +969,8 @@ void meta_frame_style_draw (MetaFrameStyle *style,
void meta_frame_style_draw_with_style (MetaFrameStyle *style,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- int x_offset,
- int y_offset,
- const GdkRectangle *clip,
- #endif
const MetaFrameGeometry *fgeom,
int client_width,
int client_height,
@@ -1101,14 +1015,7 @@ double meta_theme_get_title_scale (MetaTheme *theme,
void meta_theme_draw_frame (MetaTheme *theme,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- int x_offset,
- int y_offset,
- #endif
MetaFrameType type,
MetaFrameFlags flags,
int client_width,
@@ -1122,14 +1029,7 @@ void meta_theme_draw_frame (MetaTheme *theme,
void meta_theme_draw_frame_by_name (MetaTheme *theme,
GtkWidget *widget,
- #if GTK_CHECK_VERSION(3, 0, 0)
cairo_t *cr,
- #else
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- int x_offset,
- int y_offset,
- #endif
const gchar *style_name,
MetaFrameFlags flags,
int client_width,
@@ -1142,16 +1042,8 @@ void meta_theme_draw_frame_by_name (MetaTheme *theme,
GdkPixbuf *icon);
void meta_theme_draw_frame_with_style (MetaTheme *theme,
- #if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *style_gtk,
cairo_t *cr,
- #else
- GtkWidget *widget,
- GdkDrawable *drawable,
- const GdkRectangle *clip,
- int x_offset,
- int y_offset,
- #endif
MetaFrameType type,
MetaFrameFlags flags,
int client_width,
@@ -1257,26 +1149,19 @@ MetaFrameType meta_frame_type_from_string (const char *s
const char* meta_frame_type_to_string (MetaFrameType type);
MetaGradientType meta_gradient_type_from_string (const char *str);
const char* meta_gradient_type_to_string (MetaGradientType type);
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStateFlags meta_gtk_state_from_string (const char *str);
-#else
-GtkStateType meta_gtk_state_from_string (const char *str);
-const char* meta_gtk_state_to_string (GtkStateType state);
-#endif
GtkShadowType meta_gtk_shadow_from_string (const char *str);
const char* meta_gtk_shadow_to_string (GtkShadowType shadow);
GtkArrowType meta_gtk_arrow_from_string (const char *str);
const char* meta_gtk_arrow_to_string (GtkArrowType arrow);
MetaImageFillType meta_image_fill_type_from_string (const char *str);
const char* meta_image_fill_type_to_string (MetaImageFillType fill_type);
-#if GTK_CHECK_VERSION (3, 0, 0)
void meta_gtk_style_get_light_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color);
void meta_gtk_style_get_dark_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color);
-#endif
guint meta_theme_earliest_version_with_button (MetaButtonType type);
diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c
index e6f2ade5..7a96e468 100644
--- a/src/ui/tile-preview.c
+++ b/src/ui/tile-preview.c
@@ -37,12 +37,7 @@
struct _MetaTilePreview {
GtkWidget *preview_window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA *preview_color;
-#else
- GdkColor *preview_color;
- guchar preview_alpha;
-#endif
MetaRectangle tile_rect;
@@ -50,57 +45,30 @@ struct _MetaTilePreview {
};
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
meta_tile_preview_draw (GtkWidget *widget,
cairo_t *cr,
gpointer user_data)
-#else
-meta_tile_preview_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer user_data)
-#endif
{
MetaTilePreview *preview = user_data;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr = gdk_cairo_create (event->window);
-#endif
cairo_set_line_width (cr, 1.0);
if (preview->has_alpha)
{
/* Fill the preview area with a transparent color */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, preview->preview_color);
-#else
- cairo_set_source_rgba (cr,
- (double)preview->preview_color->red / 0xFFFF,
- (double)preview->preview_color->green / 0xFFFF,
- (double)preview->preview_color->blue / 0xFFFF,
- (double)preview->preview_alpha / 0xFF);
-#endif
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* Use the opaque color for the border */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, preview->preview_color);
-#else
- gdk_cairo_set_source_color (cr, preview->preview_color);
-#endif
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA white = {1.0, 1.0, 1.0, 1.0};
gdk_cairo_set_source_rgba (cr, &white);
-#else
- GtkStyle *style = gtk_widget_get_style (preview->preview_window);
-
- gdk_cairo_set_source_color (cr, &style->white);
-#endif
cairo_rectangle (cr,
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
@@ -114,17 +82,12 @@ meta_tile_preview_expose (GtkWidget *widget,
preview->tile_rect.width - 1,
preview->tile_rect.height - 1);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (preview->has_alpha) {
cairo_fill_preserve (cr);
cairo_set_source_rgba (cr, preview->preview_color->red, preview->preview_color->green, preview->preview_color->blue, 1.0);
}
-#endif
- cairo_stroke (cr);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
+ cairo_stroke (cr);
return FALSE;
}
@@ -135,7 +98,6 @@ on_preview_window_style_set (GtkWidget *widget,
gpointer user_data)
{
MetaTilePreview *preview = user_data;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context = gtk_style_context_new ();
GtkWidgetPath *path = gtk_widget_path_new ();
guchar alpha = 0xFF;
@@ -155,46 +117,15 @@ on_preview_window_style_set (GtkWidget *widget,
gtk_widget_path_free (path);
g_object_unref (context);
-#else
- GtkStyle *style;
-
- style = gtk_rc_get_style_by_paths (gtk_widget_get_settings (widget),
- "GtkWindow.GtkIconView",
- "GtkWindow.GtkIconView",
- GTK_TYPE_ICON_VIEW);
-
- if (style != NULL)
- g_object_ref (style);
- else
- style = gtk_style_new ();
-
- gtk_style_get (style, GTK_TYPE_ICON_VIEW,
- "selection-box-color", &preview->preview_color,
- "selection-box-alpha", &preview->preview_alpha,
- NULL);
- if (!preview->preview_color)
- {
- GdkColor selection = style->base[GTK_STATE_SELECTED];
- preview->preview_color = gdk_color_copy (&selection);
- }
-
- g_object_unref (style);
-#endif
}
MetaTilePreview *
meta_tile_preview_new (int screen_number)
{
MetaTilePreview *preview;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkColormap *rgba_colormap;
-#endif
GdkScreen *screen;
screen = gdk_display_get_screen (gdk_display_get_default (), screen_number);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- rgba_colormap = gdk_screen_get_rgba_colormap (screen);
-#endif
preview = g_new (MetaTilePreview, 1);
@@ -204,36 +135,20 @@ meta_tile_preview_new (int screen_number)
gtk_widget_set_app_paintable (preview->preview_window, TRUE);
preview->preview_color = NULL;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- preview->preview_alpha = 0xFF;
-#endif
preview->tile_rect.x = preview->tile_rect.y = 0;
preview->tile_rect.width = preview->tile_rect.height = 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_visual (preview->preview_window,
gdk_screen_get_rgba_visual (screen));
-#else
- gtk_widget_set_colormap (preview->preview_window, rgba_colormap);
-#endif
g_signal_connect (preview->preview_window, "style-set",
G_CALLBACK (on_preview_window_style_set), preview);
gtk_widget_realize (preview->preview_window);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gdk_window_set_back_pixmap (gtk_widget_get_window (preview->preview_window),
- NULL, FALSE);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (preview->preview_window, "draw",
G_CALLBACK (meta_tile_preview_draw), preview);
-#else
- g_signal_connect (preview->preview_window, "expose-event",
- G_CALLBACK (meta_tile_preview_expose), preview);
-#endif
return preview;
}
@@ -244,11 +159,7 @@ meta_tile_preview_free (MetaTilePreview *preview)
gtk_widget_destroy (preview->preview_window);
if (preview->preview_color)
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_free (preview->preview_color);
-#else
- gdk_color_free (preview->preview_color);
-#endif
g_free (preview);
}
@@ -294,20 +205,11 @@ meta_tile_preview_show (MetaTilePreview *preview,
if (!preview->has_alpha)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle_int_t outer_rect, inner_rect;
cairo_region_t *outer_region, *inner_region;
GdkRGBA black = {.0, .0, .0, 1.0};
gdk_window_set_background_rgba (window, &black);
-#else
- GdkRectangle outer_rect, inner_rect;
- GdkRegion *outer_region, *inner_region;
- GdkColor black;
-
- black = gtk_widget_get_style (preview->preview_window)->black;
- gdk_window_set_background (window, &black);
-#endif
outer_rect.x = outer_rect.y = 0;
outer_rect.width = preview->tile_rect.width;
@@ -318,7 +220,6 @@ meta_tile_preview_show (MetaTilePreview *preview,
inner_rect.width = outer_rect.width - 2 * OUTLINE_WIDTH;
inner_rect.height = outer_rect.height - 2 * OUTLINE_WIDTH;
-#if GTK_CHECK_VERSION (3, 0, 0)
outer_region = cairo_region_create_rectangle (&outer_rect);
inner_region = cairo_region_create_rectangle (&inner_rect);
@@ -327,16 +228,6 @@ meta_tile_preview_show (MetaTilePreview *preview,
gtk_widget_shape_combine_region (preview->preview_window, outer_region);
cairo_region_destroy (outer_region);
-#else
- outer_region = gdk_region_rectangle (&outer_rect);
- inner_region = gdk_region_rectangle (&inner_rect);
-
- gdk_region_subtract (outer_region, inner_region);
- gdk_region_destroy (inner_region);
-
- gdk_window_shape_combine_region (window, outer_region, 0, 0);
- gdk_region_destroy (outer_region);
-#endif
} else {
gdk_window_shape_combine_region (window, NULL, 0, 0);
}
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 130a671f..28a9bbd5 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -31,9 +31,7 @@
#include <string.h>
#include <stdlib.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <cairo-xlib.h>
-#endif
static void meta_ui_accelerator_parse(const char* accel, guint* keysym, guint* keycode, GdkModifierType* keymask);
@@ -58,9 +56,7 @@ void meta_ui_init(int* argc, char*** argv)
* GDK will no longer generate the core XEvents we process.
* So at least for now, enforce the previous behavior.
*/
-#if GTK_CHECK_VERSION(3, 0, 0)
gdk_disable_multidevice ();
-#endif
if (!gtk_init_check (argc, argv))
{
@@ -93,13 +89,9 @@ maybe_redirect_mouse_event (XEvent *xevent)
{
GdkDisplay *gdisplay;
MetaUI *ui;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *gmanager;
GdkDevice *gdevice;
GdkEvent *gevent;
-#else
- GdkEvent gevent;
-#endif
GdkWindow *gdk_window;
Window window;
@@ -129,26 +121,16 @@ maybe_redirect_mouse_event (XEvent *xevent)
if (gdk_window == NULL)
return FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
gmanager = gdk_display_get_device_manager (gdisplay);
gdevice = gdk_device_manager_get_client_pointer (gmanager);
-#endif
/* If GDK already thinks it has a grab, we better let it see events; this
* is the menu-navigation case and events need to get sent to the appropriate
* (client-side) subwindow for individual menu items.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
if (gdk_display_device_is_grabbed (gdisplay, gdevice))
-#else
- if (gdk_display_pointer_is_grabbed (gdisplay))
-#endif
return FALSE;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- memset (&gevent, 0, sizeof (gevent));
-#endif
-
switch (xevent->type)
{
case ButtonPress:
@@ -170,21 +152,12 @@ maybe_redirect_mouse_event (XEvent *xevent)
ABS (xevent->xbutton.x - ui->button_click_x) <= double_click_distance &&
ABS (xevent->xbutton.y - ui->button_click_y) <= double_click_distance)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gevent = gdk_event_new (GDK_2BUTTON_PRESS);
-#else
- gevent.button.type = GDK_2BUTTON_PRESS;
-#endif
-
ui->button_click_number = 0;
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gevent = gdk_event_new (GDK_BUTTON_PRESS);
-#else
- gevent.button.type = GDK_BUTTON_PRESS;
-#endif
ui->button_click_number = xevent->xbutton.button;
ui->button_click_window = xevent->xbutton.window;
ui->button_click_time = xevent->xbutton.time;
@@ -194,14 +167,9 @@ maybe_redirect_mouse_event (XEvent *xevent)
}
else
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gevent = gdk_event_new (GDK_BUTTON_RELEASE);
-#else
- gevent.button.type = GDK_BUTTON_RELEASE;
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gevent->button.window = g_object_ref (gdk_window);
gevent->button.button = xevent->xbutton.button;
gevent->button.time = xevent->xbutton.time;
@@ -209,40 +177,18 @@ maybe_redirect_mouse_event (XEvent *xevent)
gevent->button.y = xevent->xbutton.y;
gevent->button.x_root = xevent->xbutton.x_root;
gevent->button.y_root = xevent->xbutton.y_root;
-#else
- gevent.button.window = gdk_window;
- gevent.button.button = xevent->xbutton.button;
- gevent.button.time = xevent->xbutton.time;
- gevent.button.x = xevent->xbutton.x;
- gevent.button.y = xevent->xbutton.y;
- gevent.button.x_root = xevent->xbutton.x_root;
- gevent.button.y_root = xevent->xbutton.y_root;
-#endif
-
break;
case MotionNotify:
-#if GTK_CHECK_VERSION (3, 0, 0)
gevent = gdk_event_new (GDK_MOTION_NOTIFY);
gevent->motion.type = GDK_MOTION_NOTIFY;
gevent->motion.window = g_object_ref (gdk_window);
-#else
- gevent.motion.type = GDK_MOTION_NOTIFY;
- gevent.motion.window = gdk_window;
-#endif
break;
case EnterNotify:
case LeaveNotify:
-#if GTK_CHECK_VERSION (3, 0, 0)
gevent = gdk_event_new (xevent->type == EnterNotify ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY);
gevent->crossing.window = g_object_ref (gdk_window);
gevent->crossing.x = xevent->xcrossing.x;
gevent->crossing.y = xevent->xcrossing.y;
-#else
- gevent.crossing.type = xevent->type == EnterNotify ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY;
- gevent.crossing.window = gdk_window;
- gevent.crossing.x = xevent->xcrossing.x;
- gevent.crossing.y = xevent->xcrossing.y;
-#endif
break;
default:
g_assert_not_reached ();
@@ -250,13 +196,9 @@ maybe_redirect_mouse_event (XEvent *xevent)
}
/* If we've gotten here, we've filled in the gdk_event and should send it on */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_event_set_device (gevent, gdevice);
gtk_main_do_event (gevent);
gdk_event_free (gevent);
-#else
- gtk_main_do_event (&gevent);
-#endif
return TRUE;
}
@@ -329,14 +271,10 @@ meta_ui_new (Display *xdisplay,
g_assert (xdisplay == GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
ui->frames = meta_frames_new (XScreenNumberOfScreen (screen));
-#if GTK_CHECK_VERSION (3, 0, 0)
/* This does not actually show any widget. MetaFrames has been hacked so
* that showing it doesn't actually do anything. But we need the flags
* set for GTK to deliver events properly. */
gtk_widget_show (GTK_WIDGET (ui->frames));
-#else
- gtk_widget_realize (GTK_WIDGET (ui->frames));
-#endif
g_object_set_data (G_OBJECT (gdisplay), "meta-ui", ui);
@@ -383,9 +321,6 @@ meta_ui_create_frame_window (MetaUI *ui,
gint attributes_mask;
GdkWindow *window;
GdkVisual *visual;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkColormap *cmap = gdk_screen_get_default_colormap (screen);
-#endif
/* Default depth/visual handles clients with weird visuals; they can
* always be children of the root depth/visual obviously, but
@@ -398,9 +333,6 @@ meta_ui_create_frame_window (MetaUI *ui,
{
visual = gdk_x11_screen_lookup_visual (screen,
XVisualIDFromVisual (xvisual));
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cmap = gdk_colormap_new (visual, FALSE);
-#endif
}
attrs.title = NULL;
@@ -416,9 +348,6 @@ meta_ui_create_frame_window (MetaUI *ui,
attrs.y = y;
attrs.wclass = GDK_INPUT_OUTPUT;
attrs.visual = visual;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- attrs.colormap = cmap;
-#endif
attrs.window_type = GDK_WINDOW_CHILD;
attrs.cursor = NULL;
attrs.wmclass_name = NULL;
@@ -428,11 +357,7 @@ meta_ui_create_frame_window (MetaUI *ui,
attrs.width = width;
attrs.height = height;
-#if GTK_CHECK_VERSION (3, 0, 0)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-#else
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-#endif
window =
gdk_window_new (gdk_screen_get_root_window(screen),
@@ -579,46 +504,6 @@ meta_ui_window_menu_free (MetaWindowMenu *menu)
meta_window_menu_free (menu);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static GdkColormap*
-get_cmap (GdkPixmap *pixmap)
-{
- GdkColormap *cmap;
-
- cmap = gdk_drawable_get_colormap (pixmap);
- if (cmap)
- g_object_ref (G_OBJECT (cmap));
-
- if (cmap == NULL)
- {
- if (gdk_drawable_get_depth (pixmap) == 1)
- {
- meta_verbose ("Using NULL colormap for snapshotting bitmap\n");
- cmap = NULL;
- }
- else
- {
- meta_verbose ("Using system cmap to snapshot pixmap\n");
- cmap = gdk_screen_get_system_colormap (gdk_drawable_get_screen (pixmap));
-
- g_object_ref (G_OBJECT (cmap));
- }
- }
-
- /* Be sure we aren't going to blow up due to visual mismatch */
- if (cmap &&
- (gdk_visual_get_depth (gdk_colormap_get_visual (cmap)) !=
- gdk_drawable_get_depth (pixmap)))
- {
- cmap = NULL;
- meta_verbose ("Switching back to NULL cmap because of depth mismatch\n");
- }
-
- return cmap;
-}
-#endif
-
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf*
meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
Pixmap xpixmap,
@@ -671,50 +556,6 @@ meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
return retval;
}
-#else
-GdkPixbuf*
-meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
- Pixmap xpixmap,
- int src_x,
- int src_y,
- int dest_x,
- int dest_y,
- int width,
- int height)
-{
- GdkDrawable *drawable;
- GdkPixbuf *retval;
- GdkColormap *cmap;
-
- retval = NULL;
- cmap = NULL;
-
- drawable = gdk_x11_window_lookup_for_display (gdk_display_get_default (), xpixmap);
-
- if (drawable)
- g_object_ref (G_OBJECT (drawable));
- else
- drawable = gdk_pixmap_foreign_new (xpixmap);
-
- if (drawable)
- {
- cmap = get_cmap (drawable);
-
- retval = gdk_pixbuf_get_from_drawable (dest,
- drawable,
- cmap,
- src_x, src_y,
- dest_x, dest_y,
- width, height);
- }
- if (cmap)
- g_object_unref (G_OBJECT (cmap));
- if (drawable)
- g_object_unref (G_OBJECT (drawable));
-
- return retval;
-}
-#endif
void
meta_ui_push_delay_exposes (MetaUI *ui)
@@ -823,10 +664,8 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
int *right_width)
{
int text_height;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *style = NULL;
PangoFontDescription *free_font_desc = NULL;
-#endif
PangoContext *context;
const PangoFontDescription *font_desc;
@@ -837,7 +676,6 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
if (!font_desc)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display = gdk_x11_lookup_xdisplay (ui->xdisplay);
GdkScreen *screen = gdk_display_get_screen (display, XScreenNumberOfScreen (ui->xscreen));
GtkWidgetPath *widget_path;
@@ -858,12 +696,6 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
NULL);
gtk_style_context_restore (style);
font_desc = (const PangoFontDescription *) free_font_desc;
-#else
- GtkStyle *default_style;
-
- default_style = gtk_widget_get_default_style ();
- font_desc = default_style->font_desc;
-#endif
}
text_height = meta_pango_font_desc_get_text_height (font_desc, context);
@@ -873,20 +705,16 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
top_height, bottom_height,
left_width, right_width);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (free_font_desc)
pango_font_description_free (free_font_desc);
-#endif
}
else
{
*top_height = *bottom_height = *left_width = *right_width = 0;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
if (style != NULL)
g_object_unref (style);
-#endif
}
void
@@ -1104,7 +932,6 @@ MetaUIDirection meta_ui_get_direction(void)
return META_UI_DIRECTION_LTR;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkPixbuf *meta_ui_get_pixbuf_from_surface (cairo_surface_t *surface)
{
gint width;
@@ -1115,37 +942,4 @@ GdkPixbuf *meta_ui_get_pixbuf_from_surface (cairo_surface_t *surface)
return gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
}
-#else
-GdkPixbuf* meta_ui_get_pixbuf_from_pixmap(Pixmap pmap)
-{
- GdkPixmap* gpmap;
- GdkScreen* screen;
- GdkPixbuf* pixbuf;
- GdkColormap* cmap;
- int width;
- int height;
- int depth;
-
- gpmap = gdk_pixmap_foreign_new(pmap);
- screen = gdk_drawable_get_screen(gpmap);
-
- gdk_drawable_get_size(GDK_DRAWABLE(gpmap), &width, &height);
- depth = gdk_drawable_get_depth(GDK_DRAWABLE(gpmap));
-
- if (depth <= 24)
- {
- cmap = gdk_screen_get_system_colormap(screen);
- }
- else
- {
- cmap = gdk_screen_get_rgba_colormap(screen);
- }
-
- pixbuf = gdk_pixbuf_get_from_drawable(NULL, gpmap, cmap, 0, 0, 0, 0, width, height);
-
- g_object_unref(gpmap);
-
- return pixbuf;
-}
-#endif
diff --git a/src/wm-tester/main.c b/src/wm-tester/main.c
index ae6db421..5a700955 100644
--- a/src/wm-tester/main.c
+++ b/src/wm-tester/main.c
@@ -201,9 +201,7 @@ set_up_icon_windows (void)
GtkWidget *c;
GList *icons;
GdkPixbuf *pix;
-#if GTK_CHECK_VERSION (3, 0, 0)
int size = 0;
-#endif
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
c = gtk_button_new_with_label ("Icon window");
@@ -211,43 +209,21 @@ set_up_icon_windows (void)
icons = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, NULL, &size);
pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL);
-#else
- pix = gtk_widget_render_icon (w,
- GTK_STOCK_SAVE,
- GTK_ICON_SIZE_LARGE_TOOLBAR,
- NULL);
-#endif
-
icons = g_list_append (icons, pix);
if (i % 2)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, NULL, &size);
pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL);
-#else
- pix = gtk_widget_render_icon (w,
- GTK_STOCK_SAVE,
- GTK_ICON_SIZE_DIALOG,
- NULL);
-#endif
icons = g_list_append (icons, pix);
}
if (i % 3)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &size);
pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL);
-#else
- pix = gtk_widget_render_icon (w,
- GTK_STOCK_SAVE,
- GTK_ICON_SIZE_MENU,
- NULL);
-#endif
icons = g_list_append (icons, pix);
}