summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-10-25 12:35:42 +0200
committerinfirit <[email protected]>2014-10-25 12:35:42 +0200
commit20615934a9d4faf8cd45de56c51357d985461267 (patch)
treeadbb76e5fb32a72f51b0e4a6163c52b6a3d140b7 /src
parent4134fe7aaf52512403e5a1319ed61fab0ce288d8 (diff)
downloadmarco-20615934a9d4faf8cd45de56c51357d985461267.tar.bz2
marco-20615934a9d4faf8cd45de56c51357d985461267.tar.xz
Cleanup GTK_CHECK_VERSION and unify where possible
gdk_x11_window_lookup_for_display since 2.24 GDK_WINDOW_XID since always gtk_widget_get_visible since 2.18 gtk_widget_set_mapped since 2.20 gdk_event_new since 2.2 gdk_x11_window_lookup_for_display since 2.24 gdk_text_property_to_utf8_list_for_display since 2.2 gtk_widget_get_realized since 2.20 gdk_visual_get_depth since 2.22 gtk_widget_get_window since 2.14 gtk_widget_set_allocation since 2.18
Diffstat (limited to 'src')
-rw-r--r--src/core/display.c5
-rw-r--r--src/tools/marco-window-demo.c8
-rw-r--r--src/ui/frames.c7
-rw-r--r--src/ui/menu.c7
-rw-r--r--src/ui/preview-widget.c16
-rw-r--r--src/ui/resizepopup.c18
-rw-r--r--src/ui/tabpopup.c9
-rw-r--r--src/ui/tile-preview.c6
-rw-r--r--src/ui/ui.c30
9 files changed, 9 insertions, 97 deletions
diff --git a/src/core/display.c b/src/core/display.c
index f569c461..e12dd60a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -82,6 +82,7 @@
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xfixes.h>
#include <gtk/gtk.h>
+ #include <gdk/gdkx.h>
#endif
#include <string.h>
@@ -1454,11 +1455,7 @@ static gboolean maybe_send_event_to_gtk(MetaDisplay* display, XEvent* xevent)
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window = gdk_x11_window_lookup_for_display(gdk_display, window);
-#else
- gdk_window = gdk_window_lookup_for_display(gdk_display, window);
-#endif
if (gdk_window == NULL)
{
diff --git a/src/tools/marco-window-demo.c b/src/tools/marco-window-demo.c
index 7bd1a617..d78d0130 100644
--- a/src/tools/marco-window-demo.c
+++ b/src/tools/marco-window-demo.c
@@ -24,10 +24,6 @@
#include <X11/Xatom.h>
#include <unistd.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
- #define GDK_WINDOW_XWINDOW(w) GDK_WINDOW_XID(w)
-#endif
-
static GtkWidget* do_appwindow (void);
static gboolean aspect_on;
@@ -55,7 +51,7 @@ set_gdk_window_struts (GdkWindow *window,
vals[11] = 800;
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XWINDOW (window),
+ GDK_WINDOW_XID (window),
XInternAtom (GDK_WINDOW_XDISPLAY (window),
"_NET_WM_STRUT_PARTIAL", False),
XA_CARDINAL, 32, PropModeReplace,
@@ -122,7 +118,7 @@ set_gdk_window_type (GdkWindow *window,
type, False);
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XWINDOW (window),
+ GDK_WINDOW_XID (window),
XInternAtom (GDK_WINDOW_XDISPLAY (window), "_NET_WM_WINDOW_TYPE", False),
XA_ATOM, 32, PropModeReplace,
(guchar *)atoms,
diff --git a/src/ui/frames.c b/src/ui/frames.c
index a131a921..54ad369c 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -48,7 +48,6 @@
#define gdk_region_intersect cairo_region_intersect
G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_INVISIBLE);
#define parent_class meta_frames_parent_class
- #define GTK_WIDGET_REALIZED gtk_widget_get_realized
#endif
#define DEFAULT_INNER_BUTTON_BORDER 3
@@ -523,7 +522,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
MetaFrameType type;
MetaFrameStyle *style;
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET(frames)));
+ g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET(frames)));
widget = GTK_WIDGET (frames);
@@ -2898,11 +2897,7 @@ meta_frames_set_window_background (MetaFrames *frames,
/* Set A in ARGB to window_background_alpha, if we have ARGB */
visual = gtk_widget_get_visual (GTK_WIDGET (frames));
- #if GTK_CHECK_VERSION(3, 0, 0)
if (gdk_visual_get_depth(visual) == 32) /* we have ARGB */
- #else
- if (visual->depth == 32) /* we have ARGB */
- #endif
{
color.pixel = (color.pixel & 0xffffff) &
style->window_background_alpha << 24;
diff --git a/src/ui/menu.c b/src/ui/menu.c
index baf192d7..41abc441 100644
--- a/src/ui/menu.c
+++ b/src/ui/menu.c
@@ -389,19 +389,12 @@ meta_window_menu_new (MetaFrames *frames,
meta_verbose ("Creating %d-workspace menu current space %lu\n",
n_workspaces, active_workspace);
- #if GTK_CHECK_VERSION(3, 0, 0)
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(frames));
display = GDK_WINDOW_XDISPLAY (window);
screen = gdk_window_get_screen (window);
xroot = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
- #else
- display = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (frames)->window);
-
- screen = gdk_drawable_get_screen (GTK_WIDGET (frames)->window);
- xroot = GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen));
- #endif
submenu = gtk_menu_new ();
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 5b008fa2..0bc6b42a 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -494,22 +494,14 @@ meta_preview_size_allocate (GtkWidget *widget,
{
MetaPreview *preview;
int border_width;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation widget_allocation, child_allocation;
-#else
- GtkAllocation child_allocation;
-#endif
GtkWidget *child;
preview = META_PREVIEW (widget);
ensure_info (preview);
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_set_allocation (widget, allocation);
-#else
- widget->allocation = *allocation;
-#endif
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@@ -517,20 +509,12 @@ meta_preview_size_allocate (GtkWidget *widget,
if (child &&
gtk_widget_get_visible (child))
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_allocation (widget, &widget_allocation);
child_allocation.x = widget_allocation.x + border_width + preview->left_width;
child_allocation.y = widget_allocation.y + border_width + preview->top_height;
child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->left_width - preview->right_width);
child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
-#else
- child_allocation.x = allocation->x + border_width + preview->left_width;
- child_allocation.y = allocation->y + border_width + preview->top_height;
-
- child_allocation.width = MAX (1, allocation->width - border_width * 2 - preview->left_width - preview->right_width);
- child_allocation.height = MAX (1, allocation->height - border_width * 2 - preview->top_height - preview->bottom_height);
-#endif
gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), &child_allocation);
}
}
diff --git a/src/ui/resizepopup.c b/src/ui/resizepopup.c
index 9f9137b8..7dc6ec5a 100644
--- a/src/ui/resizepopup.c
+++ b/src/ui/resizepopup.c
@@ -27,10 +27,6 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
- #define GTK_WIDGET_REALIZED gtk_widget_get_realized
-#endif
-
struct _MetaResizePopup
{
GtkWidget *size_window;
@@ -127,18 +123,12 @@ update_size_window (MetaResizePopup *popup)
x = popup->rect.x + (popup->rect.width - width) / 2;
y = popup->rect.y + (popup->rect.height - height) / 2;
- if (GTK_WIDGET_REALIZED (popup->size_window))
+ if (gtk_widget_get_realized (popup->size_window))
{
/* using move_resize to avoid jumpiness */
- #if GTK_CHECK_VERSION(3, 0, 0)
gdk_window_move_resize (gtk_widget_get_window(GTK_WIDGET(popup->size_window)),
x, y,
width, height);
- #else
- gdk_window_move_resize (popup->size_window->window,
- x, y,
- width, height);
- #endif
}
else
{
@@ -155,12 +145,8 @@ sync_showing (MetaResizePopup *popup)
if (popup->size_window)
gtk_widget_show (popup->size_window);
- if (popup->size_window && GTK_WIDGET_REALIZED (popup->size_window))
- #if GTK_CHECK_VERSION(3, 0, 0)
+ if (popup->size_window && gtk_widget_get_realized (popup->size_window))
gdk_window_raise (gtk_widget_get_window(GTK_WIDGET(popup->size_window)));
- #else
- gdk_window_raise (popup->size_window->window);
- #endif
}
else
{
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index fe3f6b9f..934874e8 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -37,7 +37,6 @@
#include <math.h>
#if GTK_CHECK_VERSION(3, 0, 0)
- #define GTK_WIDGET_VISIBLE gtk_widget_get_visible
#define GdkRegion cairo_region_t
#define gdk_region_subtract cairo_region_subtract
#define gdk_region_destroy cairo_region_destroy
@@ -450,7 +449,7 @@ meta_ui_tab_popup_set_showing (MetaTabPopup *popup,
}
else
{
- if (GTK_WIDGET_VISIBLE (popup->window))
+ if (gtk_widget_get_visible (popup->window))
{
meta_verbose ("Hiding tab popup window\n");
gtk_widget_hide (popup->window);
@@ -524,11 +523,7 @@ display_entry (MetaTabPopup *popup,
* we manually set the window as mapped and then manually map it
* with gdk functions.
*/
- #if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_set_mapped (popup->outline_window, TRUE);
- #else
- GTK_WIDGET_SET_FLAGS (popup->outline_window, GTK_MAPPED);
- #endif
gdk_window_show_unraised (window);
}
@@ -1157,4 +1152,4 @@ meta_select_workspace_expose_event (GtkWidget *widget,
return TRUE;
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c
index 6b3544ce..d5a68846 100644
--- a/src/ui/tile-preview.c
+++ b/src/ui/tile-preview.c
@@ -29,10 +29,6 @@
#include "tile-preview.h"
#include "core.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define GDK_WINDOW_XWINDOW GDK_WINDOW_XID
-#endif
-
#define OUTLINE_WIDTH 5 /* frame width in non-composite case */
@@ -237,7 +233,7 @@ meta_tile_preview_show (MetaTilePreview *preview,
#else
meta_core_lower_beneath_focus_window (gdk_display,
#endif
- GDK_WINDOW_XWINDOW (window),
+ GDK_WINDOW_XID (window),
gtk_get_current_event_time ());
old_rect.x = old_rect.y = 0;
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 02c88c1c..3c015f0c 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -463,13 +463,9 @@ meta_ui_map_frame (MetaUI *ui,
{
GdkWindow *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
-#else
- window = gdk_xid_table_lookup (xwindow);
-#endif
if (window)
gdk_window_show_unraised (window);
@@ -481,13 +477,9 @@ meta_ui_unmap_frame (MetaUI *ui,
{
GdkWindow *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
-#else
- window = gdk_xid_table_lookup (xwindow);
-#endif
if (window)
gdk_window_hide (window);
@@ -796,11 +788,7 @@ meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
cmap = NULL;
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
drawable = gdk_x11_window_lookup_for_display (gdk_display_get_default (), xpixmap);
-#else
- drawable = gdk_xid_table_lookup (xpixmap);
-#endif
if (drawable)
g_object_ref (G_OBJECT (drawable));
@@ -917,14 +905,10 @@ meta_ui_window_should_not_cause_focus (Display *xdisplay,
{
GdkWindow *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
-#else
- window = gdk_xid_table_lookup (xwindow);
-#endif
/* we shouldn't cause focus if we're an override redirect
* toplevel which is not foreign
@@ -939,16 +923,13 @@ char*
meta_text_property_to_utf8 (Display *xdisplay,
const XTextProperty *prop)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
-#endif
char **list;
int count;
char *retval;
list = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
display = gdk_x11_lookup_xdisplay (xdisplay);
count = gdk_text_property_to_utf8_list_for_display (display,
gdk_x11_xatom_to_atom_for_display (display, prop->encoding),
@@ -956,13 +937,6 @@ meta_text_property_to_utf8 (Display *xdisplay,
prop->value,
prop->nitems,
&list);
-#else
- count = gdk_text_property_to_utf8_list (gdk_x11_xatom_to_atom (prop->encoding),
- prop->format,
- prop->value,
- prop->nitems,
- &list);
-#endif
if (count == 0)
retval = NULL;
@@ -1219,13 +1193,9 @@ meta_ui_window_is_widget (MetaUI *ui,
{
GdkWindow *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
-#else
- window = gdk_xid_table_lookup (xwindow);
-#endif
if (window)
{