aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rw-r--r--configure.ac1
-rw-r--r--libtopmenu-client/topmenu-client.c11
-rw-r--r--libtopmenu-client/topmenu-monitor.c6
-rw-r--r--libtopmenu-server/topmenu-widget.c21
-rw-r--r--libtopmenu-server/topmenu-widget.h4
6 files changed, 20 insertions, 26 deletions
diff --git a/config.h.in b/config.h.in
index a566d64..7467fba 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define to GTK major version used */
+#undef GTK_VERSION
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
diff --git a/configure.ac b/configure.ac
index 56af2b4..c9623ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ AC_ARG_ENABLE([mate-applet],
[enable_mate_applet=check])
AC_SUBST([GTK_VERSION], [$with_gtk])
+AC_DEFINE_UNQUOTED([GTK_VERSION], [$with_gtk], [Define to GTK major version used])
AC_SUBST([GTK_MODULE_DIR], [$with_gtk_module_dir])
# Checks for programs.
diff --git a/libtopmenu-client/topmenu-client.c b/libtopmenu-client/topmenu-client.c
index 771920e..f7d3e58 100644
--- a/libtopmenu-client/topmenu-client.c
+++ b/libtopmenu-client/topmenu-client.c
@@ -3,6 +3,10 @@
#include "../global.h"
+#if GTK_VERSION == 3
+#include <gtk/gtkx.h>
+#endif
+
#include "topmenu-client.h"
#define OBJECT_DATA_KEY_PLUG "topmenu-plug"
@@ -23,10 +27,11 @@ static gboolean handle_widget_button_event(GtkWidget *widget, GdkEvent *event, G
GdkWindow *socket = gtk_plug_get_socket_window(plug);
if (socket) {
+ GdkDisplay * display = gdk_window_get_display(socket);
GdkScreen *screen = gdk_window_get_screen(socket);
GdkWindow *root = gdk_screen_get_root_window(screen);
- Display *dpy = GDK_WINDOW_XDISPLAY(socket);
- Window xwin = GDK_WINDOW_XWINDOW(socket);
+ Display *dpy = gdk_x11_display_get_xdisplay(display);
+ Window xwin = gdk_x11_window_get_xid(socket);
if (event->type == GDK_BUTTON_PRESS) {
gdk_display_pointer_ungrab(gtk_widget_get_display(widget),
@@ -115,5 +120,5 @@ void topmenu_client_disconnect_window(GdkWindow *window)
XDeleteProperty(display, xwin, atom);
g_warn_if_fail(G_OBJECT(plug)->ref_count == 1);
- gtk_widget_destroy(plug);
+ gtk_widget_destroy(GTK_WIDGET(plug));
}
diff --git a/libtopmenu-client/topmenu-monitor.c b/libtopmenu-client/topmenu-monitor.c
index abd7522..2f63e9b 100644
--- a/libtopmenu-client/topmenu-monitor.c
+++ b/libtopmenu-client/topmenu-monitor.c
@@ -39,7 +39,7 @@ static GdkFilterReturn handle_cur_server_event(GdkXEvent *xevent, GdkEvent *even
g_debug("Current server has been destroyed");
TopMenuMonitor *self = TOPMENU_MONITOR(data);
if (self->priv->cur_server &&
- GDK_WINDOW_XWINDOW(self->priv->cur_server) == e->xdestroywindow.window) {
+ gdk_x11_window_get_xid(self->priv->cur_server) == e->xdestroywindow.window) {
topmenu_monitor_update(self);
}
}
@@ -52,10 +52,10 @@ static void topmenu_monitor_set_cur_server(TopMenuMonitor *self, GdkWindow *wind
// Nothing to do
return;
}
- g_debug("Setting current server to 0x%lx", GDK_WINDOW_XWINDOW(window));
+ g_debug("Setting current server to 0x%lx", gdk_x11_window_get_xid(window));
if (self->priv->cur_server) {
gdk_window_remove_filter(window, handle_cur_server_event, self);
- gdk_window_unref(self->priv->cur_server);
+ g_object_unref(self->priv->cur_server);
self->priv->cur_server = 0;
}
if (window) {
diff --git a/libtopmenu-server/topmenu-widget.c b/libtopmenu-server/topmenu-widget.c
index 0d21be6..8121fc5 100644
--- a/libtopmenu-server/topmenu-widget.c
+++ b/libtopmenu-server/topmenu-widget.c
@@ -123,7 +123,7 @@ static void topmenu_widget_embed_topmenu_window(TopMenuWidget *self, Window wind
GdkWindow *cur = gtk_socket_get_plug_window(self->socket);
if (cur) {
- if (GDK_WINDOW_XWINDOW(cur) == window) {
+ if (gdk_x11_window_get_xid(cur) == window) {
// Trying to embed the same client again
return; // Nothing to do
}
@@ -315,23 +315,6 @@ static void topmenu_widget_unmap(GtkWidget *widget)
GTK_WIDGET_CLASS(topmenu_widget_parent_class)->unmap(widget);
}
-static void topmenu_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- TopMenuWidget *self = TOPMENU_WIDGET(widget);
- if (self->socket) {
- gtk_widget_size_allocate(GTK_WIDGET(self->socket), allocation);
- }
- GTK_WIDGET_CLASS(topmenu_widget_parent_class)->size_allocate(widget, allocation);
-}
-
-static void topmenu_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
- TopMenuWidget *self = TOPMENU_WIDGET(widget);
- if (self->socket) {
- gtk_widget_size_request(GTK_WIDGET(self->socket), requisition);
- }
-}
-
static void topmenu_widget_dispose(GObject *obj)
{
TopMenuWidget *self = TOPMENU_WIDGET(obj);
@@ -355,8 +338,6 @@ static void topmenu_widget_class_init(TopMenuWidgetClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
widget_class->map = topmenu_widget_map;
widget_class->unmap = topmenu_widget_unmap;
- widget_class->size_allocate = topmenu_widget_size_allocate;
- widget_class->size_request = topmenu_widget_size_request;
GObjectClass *obj_class = G_OBJECT_CLASS(klass);
obj_class->dispose = topmenu_widget_dispose;
diff --git a/libtopmenu-server/topmenu-widget.h b/libtopmenu-server/topmenu-widget.h
index b3ea8f8..19d9784 100644
--- a/libtopmenu-server/topmenu-widget.h
+++ b/libtopmenu-server/topmenu-widget.h
@@ -3,6 +3,10 @@
#include <gtk/gtk.h>
+#if GTK_VERSION == 3
+#include <gtk/gtkx.h>
+#endif
+
G_BEGIN_DECLS
#define TOPMENU_TYPE_WIDGET topmenu_widget_get_type()