diff options
Diffstat (limited to 'maximus')
-rw-r--r-- | maximus/maximus-app.c | 130 | ||||
-rw-r--r-- | maximus/maximus-app.h | 3 | ||||
-rw-r--r-- | maximus/maximus-bind.c | 71 | ||||
-rw-r--r-- | maximus/xutils.c | 13 | ||||
-rw-r--r-- | maximus/xutils.h | 12 |
5 files changed, 116 insertions, 113 deletions
diff --git a/maximus/maximus-app.c b/maximus/maximus-app.c index a51147d..ea303d9 100644 --- a/maximus/maximus-app.c +++ b/maximus/maximus-app.c @@ -71,7 +71,7 @@ static gchar *default_exclude_classes[] = struct _MaximusAppPrivate { MaximusBind *bind; - MatewnckScreen *screen; + WnckScreen *screen; GSettings *settings; gchar **exclude_class_list; @@ -95,7 +95,7 @@ typedef struct { #define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS" static gboolean -matewnck_window_is_decorated (MatewnckWindow *window) +wnck_window_is_decorated (WnckWindow *window) { GdkDisplay *display = gdk_display_get_default(); Atom hints_atom = None; @@ -107,13 +107,13 @@ matewnck_window_is_decorated (MatewnckWindow *window) gulong bytes_after; gboolean retval; - g_return_val_if_fail (MATEWNCK_IS_WINDOW (window), FALSE); + g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE); hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS); XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), - matewnck_window_get_xid (window), + wnck_window_get_xid (window), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); @@ -131,7 +131,7 @@ matewnck_window_is_decorated (MatewnckWindow *window) } static void -gdk_window_set_mwm_hints (MatewnckWindow *window, +gdk_window_set_mwm_hints (WnckWindow *window, MotifWmHints *new_hints) { GdkDisplay *display = gdk_display_get_default(); @@ -143,14 +143,14 @@ gdk_window_set_mwm_hints (MatewnckWindow *window, gulong nitems; gulong bytes_after; - g_return_if_fail (MATEWNCK_IS_WINDOW (window)); + g_return_if_fail (WNCK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_DISPLAY (display)); hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS); XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), - matewnck_window_get_xid (window), + wnck_window_get_xid (window), hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, &data); @@ -173,25 +173,25 @@ gdk_window_set_mwm_hints (MatewnckWindow *window, } } - _matewnck_error_trap_push (); + _wnck_error_trap_push (); XChangeProperty (GDK_DISPLAY_XDISPLAY (display), - matewnck_window_get_xid (window), + wnck_window_get_xid (window), hints_atom, hints_atom, 32, PropModeReplace, (guchar *)hints, sizeof (MotifWmHints)/sizeof (long)); gdk_flush (); - _matewnck_error_trap_pop (); + _wnck_error_trap_pop (); if (data) XFree (data); } static void -_window_set_decorations (MatewnckWindow *window, +_window_set_decorations (WnckWindow *window, GdkWMDecoration decorations) { MotifWmHints *hints; - g_return_if_fail (MATEWNCK_IS_WINDOW (window)); + g_return_if_fail (WNCK_IS_WINDOW (window)); /* initialize to zero to avoid writing uninitialized data to socket */ hints = g_slice_new0 (MotifWmHints); @@ -206,17 +206,17 @@ _window_set_decorations (MatewnckWindow *window, /* </TAKEN FROM GDK> */ gboolean -window_is_too_large_for_screen (MatewnckWindow *window) +window_is_too_large_for_screen (WnckWindow *window) { static GdkScreen *screen = NULL; gint x=0, y=0, w=0, h=0; - g_return_val_if_fail (MATEWNCK_IS_WINDOW (window), FALSE); + g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE); if (screen == NULL) screen = gdk_screen_get_default (); - matewnck_window_get_geometry (window, &x, &y, &w, &h); + wnck_window_get_geometry (window, &x, &y, &w, &h); /* some wiggle room */ return (screen && @@ -225,14 +225,14 @@ window_is_too_large_for_screen (MatewnckWindow *window) } static gboolean -on_window_maximised_changed (MatewnckWindow *window) +on_window_maximised_changed (WnckWindow *window) { - g_return_val_if_fail (MATEWNCK_IS_WINDOW (window), FALSE); + g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE); if (window_is_too_large_for_screen (window)) { _window_set_decorations (window, 1); - matewnck_window_unmaximize (window); + wnck_window_unmaximize (window); } else { @@ -242,29 +242,29 @@ on_window_maximised_changed (MatewnckWindow *window) } static gboolean -enable_window_decorations (MatewnckWindow *window) +enable_window_decorations (WnckWindow *window) { - g_return_val_if_fail (MATEWNCK_IS_WINDOW (window), FALSE); + g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE); _window_set_decorations (window, 1); return FALSE; } static void -on_window_state_changed (MatewnckWindow *window, - MatewnckWindowState change_mask, - MatewnckWindowState new_state, +on_window_state_changed (WnckWindow *window, + WnckWindowState change_mask, + WnckWindowState new_state, MaximusApp *app) { - g_return_if_fail (MATEWNCK_IS_WINDOW (window)); + g_return_if_fail (WNCK_IS_WINDOW (window)); if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "exclude"))==1) return; - if (change_mask & MATEWNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY - || change_mask & MATEWNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY) + if (change_mask & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY + || change_mask & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY) { - if (matewnck_window_is_maximized (window) && app->priv->undecorate) + if (wnck_window_is_maximized (window) && app->priv->undecorate) { g_idle_add ((GSourceFunc)on_window_maximised_changed, window); } @@ -276,44 +276,44 @@ on_window_state_changed (MatewnckWindow *window, } static gboolean -is_excluded (MaximusApp *app, MatewnckWindow *window) +is_excluded (MaximusApp *app, WnckWindow *window) { MaximusAppPrivate *priv; - MatewnckWindowType type; - MatewnckWindowActions actions; + WnckWindowType type; + WnckWindowActions actions; gchar *res_name; gchar *class_name; gint i; g_return_val_if_fail (MAXIMUS_IS_APP (app), TRUE); - g_return_val_if_fail (MATEWNCK_IS_WINDOW (window), TRUE); + g_return_val_if_fail (WNCK_IS_WINDOW (window), TRUE); priv = app->priv; - type = matewnck_window_get_window_type (window); - if (type != MATEWNCK_WINDOW_NORMAL) + type = wnck_window_get_window_type (window); + if (type != WNCK_WINDOW_NORMAL) return TRUE; if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "exclude"))==1) return TRUE; /* Ignore if the window is already fullscreen */ - if (matewnck_window_is_fullscreen (window)) + if (wnck_window_is_fullscreen (window)) { - g_debug ("Excluding (is fullscreen): %s\n",matewnck_window_get_name (window)); + g_debug ("Excluding (is fullscreen): %s\n",wnck_window_get_name (window)); return TRUE; } /* Make sure the window supports maximising */ - actions = matewnck_window_get_actions (window); - if (actions & MATEWNCK_WINDOW_ACTION_RESIZE - && actions & MATEWNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY - && actions & MATEWNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY - && actions & MATEWNCK_WINDOW_ACTION_MAXIMIZE) + actions = wnck_window_get_actions (window); + if (actions & WNCK_WINDOW_ACTION_RESIZE + && actions & WNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY + && actions & WNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY + && actions & WNCK_WINDOW_ACTION_MAXIMIZE) ; /* Is good to maximise */ else return TRUE; - _matewnck_get_wmclass (matewnck_window_get_xid (window), &res_name, &class_name); + _wnck_get_wmclass (wnck_window_get_xid (window), &res_name, &class_name); g_debug ("Window opened: res_name=%s -- class_name=%s", res_name, class_name); @@ -325,7 +325,7 @@ is_excluded (MaximusApp *app, MatewnckWindow *window) || (res_name && default_exclude_classes[i] && strstr (res_name, default_exclude_classes[i]))) { - g_debug ("Excluding: %s\n", matewnck_window_get_name (window)); + g_debug ("Excluding: %s\n", wnck_window_get_name (window)); return TRUE; } } @@ -336,7 +336,7 @@ is_excluded (MaximusApp *app, MatewnckWindow *window) if ((class_name && strstr (class_name, priv->exclude_class_list[i])) || (res_name && strstr (res_name, priv->exclude_class_list[i]) )) { - g_debug ("Excluding: %s\n", matewnck_window_get_name (window)); + g_debug ("Excluding: %s\n", wnck_window_get_name (window)); return TRUE; } } @@ -349,25 +349,25 @@ is_excluded (MaximusApp *app, MatewnckWindow *window) extern gboolean no_maximize; static void -on_window_opened (MatewnckScreen *screen, - MatewnckWindow *window, +on_window_opened (WnckScreen *screen, + WnckWindow *window, MaximusApp *app) { MaximusAppPrivate *priv; - MatewnckWindowType type; + WnckWindowType type; gint exclude = 0; g_return_if_fail (MAXIMUS_IS_APP (app)); - g_return_if_fail (MATEWNCK_IS_WINDOW (window)); + g_return_if_fail (WNCK_IS_WINDOW (window)); priv = app->priv; - type = matewnck_window_get_window_type (window); - if (type != MATEWNCK_WINDOW_NORMAL) + type = wnck_window_get_window_type (window); + if (type != WNCK_WINDOW_NORMAL) return; /* Ignore undecorated windows */ - exclude = matewnck_window_is_decorated (window) ? 0 : 1; - if (matewnck_window_is_maximized (window)) + exclude = wnck_window_is_decorated (window) ? 0 : 1; + if (wnck_window_is_maximized (window)) exclude = 0; g_object_set_data (G_OBJECT (window), "exclude", GINT_TO_POINTER (exclude)); @@ -380,7 +380,7 @@ on_window_opened (MatewnckScreen *screen, if (no_maximize || priv->no_maximize) { - if (matewnck_window_is_maximized(window)) + if (wnck_window_is_maximized(window)) { _window_set_decorations (window, 0); gdk_flush (); @@ -400,7 +400,7 @@ on_window_opened (MatewnckScreen *screen, } } - matewnck_window_maximize (window); + wnck_window_maximize (window); g_signal_connect (window, "state-changed", G_CALLBACK (on_window_state_changed), app); @@ -437,11 +437,11 @@ on_exclude_class_changed (GSettings *settings, } static gboolean -show_desktop (MatewnckScreen *screen) +show_desktop (WnckScreen *screen) { - g_return_val_if_fail (MATEWNCK_IS_SCREEN (screen), FALSE); + g_return_val_if_fail (WNCK_IS_SCREEN (screen), FALSE); - matewnck_screen_toggle_showing_desktop (screen, TRUE); + wnck_screen_toggle_showing_desktop (screen, TRUE); return FALSE; } @@ -455,22 +455,22 @@ on_app_undecorate_changed (GSettings *settings, g_return_if_fail (MAXIMUS_IS_APP (app)); priv = app->priv; - g_return_if_fail (MATEWNCK_IS_SCREEN (priv->screen)); + g_return_if_fail (WNCK_IS_SCREEN (priv->screen)); priv->undecorate = g_settings_get_boolean (settings, APP_UNDECORATE); g_debug ("%s\n", priv->undecorate ? "Undecorating" : "Decorating"); - windows = matewnck_screen_get_windows (priv->screen); + windows = wnck_screen_get_windows (priv->screen); for (w = windows; w; w = w->next) { - MatewnckWindow *window = w->data; + WnckWindow *window = w->data; - if (!MATEWNCK_IS_WINDOW (window)) + if (!WNCK_IS_WINDOW (window)) continue; if (no_maximize || priv->no_maximize) { - if (!matewnck_window_is_maximized(window)) + if (!wnck_window_is_maximized(window)) continue; } @@ -478,8 +478,8 @@ on_app_undecorate_changed (GSettings *settings, { gdk_error_trap_push (); _window_set_decorations (window, priv->undecorate ? 0 : 1); - matewnck_window_unmaximize (window); - matewnck_window_maximize (window); + wnck_window_unmaximize (window); + wnck_window_maximize (window); gdk_flush (); gdk_error_trap_pop (); @@ -504,7 +504,7 @@ static void maximus_app_init (MaximusApp *app) { MaximusAppPrivate *priv; - MatewnckScreen *screen; + WnckScreen *screen; priv = app->priv = MAXIMUS_APP_GET_PRIVATE (app); @@ -523,7 +523,7 @@ maximus_app_init (MaximusApp *app) G_CALLBACK (on_app_undecorate_changed), app); - priv->screen = screen = matewnck_screen_get_default (); + priv->screen = screen = wnck_screen_get_default (); g_signal_connect (screen, "window-opened", G_CALLBACK (on_window_opened), app); diff --git a/maximus/maximus-app.h b/maximus/maximus-app.h index 8eb64f7..715ab0a 100644 --- a/maximus/maximus-app.h +++ b/maximus/maximus-app.h @@ -22,7 +22,8 @@ #include <glib-object.h> #include <gtk/gtk.h> -#include <libmatewnck/libmatewnck.h> +#define WNCK_I_KNOW_THIS_IS_UNSTABLE +#include <libwnck/libwnck.h> #define MAXIMUS_TYPE_APP (maximus_app_get_type ()) diff --git a/maximus/maximus-bind.c b/maximus/maximus-bind.c index 543834a..7fbcefc 100644 --- a/maximus/maximus-bind.c +++ b/maximus/maximus-bind.c @@ -27,7 +27,8 @@ #include <gio/gio.h> -#include <libmatewnck/libmatewnck.h> +#define WNCK_I_KNOW_THIS_IS_UNSTABLE +#include <libwnck/libwnck.h> #include <X11/Xlib.h> #include <X11/Xresource.h> @@ -67,7 +68,7 @@ G_DEFINE_TYPE (MaximusBind, maximus_bind, G_TYPE_OBJECT); struct _MaximusBindPrivate { FakeKey *fk; - MatewnckScreen *screen; + WnckScreen *screen; GSettings *settings; gchar *binding; @@ -83,16 +84,16 @@ typedef struct } MaximusRule; static const gchar * -get_fullscreen_keystroke (GList *rules, MatewnckWindow *window) +get_fullscreen_keystroke (GList *rules, WnckWindow *window) { - MatewnckClassGroup *group; + WnckClassGroup *group; const gchar *class_name; GList *r; - group = matewnck_window_get_class_group (window); - class_name = matewnck_class_group_get_name (group); + group = wnck_window_get_class_group (window); + class_name = wnck_class_group_get_name (group); - g_debug ("Searching rules for %s:\n", matewnck_window_get_name (window)); + g_debug ("Searching rules for %s:\n", wnck_window_get_name (window)); for (r = rules; r; r = r->next) { @@ -112,14 +113,14 @@ get_fullscreen_keystroke (GList *rules, MatewnckWindow *window) } static const gchar * -get_unfullscreen_keystroke (GList *rules, MatewnckWindow *window) +get_unfullscreen_keystroke (GList *rules, WnckWindow *window) { - MatewnckClassGroup *group; + WnckClassGroup *group; const gchar *class_name; GList *r; - group = matewnck_window_get_class_group (window); - class_name = matewnck_class_group_get_name (group); + group = wnck_window_get_class_group (window); + class_name = wnck_class_group_get_name (group); for (r = rules; r; r = r->next) { @@ -138,16 +139,16 @@ real_fullscreen (MaximusBind *bind) { MaximusBindPrivate *priv; GdkDisplay UNUSED_VARIABLE *display; - MatewnckWindow *active; + WnckWindow *active; const gchar *keystroke; priv = bind->priv; display = gdk_display_get_default (); - active = matewnck_screen_get_active_window (priv->screen); + active = wnck_screen_get_active_window (priv->screen); - if (!MATEWNCK_IS_WINDOW (active) - || matewnck_window_get_window_type (active) != MATEWNCK_WINDOW_NORMAL) + if (!WNCK_IS_WINDOW (active) + || wnck_window_get_window_type (active) != WNCK_WINDOW_NORMAL) return FALSE; keystroke = get_fullscreen_keystroke (priv->rules, active); @@ -179,7 +180,7 @@ real_fullscreen (MaximusBind *bind) } } - if (!matewnck_window_is_fullscreen (active)) + if (!wnck_window_is_fullscreen (active)) { g_debug ("Sending fullscreen F11 event"); fakekey_press_keysym (priv->fk, XK_F11, 0); @@ -188,17 +189,17 @@ real_fullscreen (MaximusBind *bind) sleep (STATE_CHANGED_SLEEP); - if (!matewnck_window_is_fullscreen (active)) + if (!wnck_window_is_fullscreen (active)) { - g_debug ("Forcing fullscreen matewnck event"); - matewnck_window_set_fullscreen (active, TRUE); + g_debug ("Forcing fullscreen wnck event"); + wnck_window_set_fullscreen (active, TRUE); } return FALSE; } static void -fullscreen (MaximusBind *bind, MatewnckWindow *window) +fullscreen (MaximusBind *bind, WnckWindow *window) { MaximusBindPrivate UNUSED_VARIABLE *priv; @@ -212,16 +213,16 @@ real_unfullscreen (MaximusBind *bind) { MaximusBindPrivate *priv; GdkDisplay UNUSED_VARIABLE *display; - MatewnckWindow *active; + WnckWindow *active; const gchar *keystroke; priv = bind->priv; display = gdk_display_get_default (); - active = matewnck_screen_get_active_window (priv->screen); + active = wnck_screen_get_active_window (priv->screen); - if (!MATEWNCK_IS_WINDOW (active) - || matewnck_window_get_window_type (active) != MATEWNCK_WINDOW_NORMAL) + if (!WNCK_IS_WINDOW (active) + || wnck_window_get_window_type (active) != WNCK_WINDOW_NORMAL) return FALSE; keystroke = get_unfullscreen_keystroke (priv->rules, active); @@ -252,7 +253,7 @@ real_unfullscreen (MaximusBind *bind) return FALSE; } } - if (matewnck_window_is_fullscreen (active)) + if (wnck_window_is_fullscreen (active)) { g_debug ("Sending un-fullscreen F11 event"); fakekey_press_keysym (priv->fk, XK_F11, 0); @@ -261,17 +262,17 @@ real_unfullscreen (MaximusBind *bind) sleep (STATE_CHANGED_SLEEP); - if (matewnck_window_is_fullscreen (active)) + if (wnck_window_is_fullscreen (active)) { - g_debug ("Forcing un-fullscreen matewnck event"); - matewnck_window_set_fullscreen (active, FALSE); + g_debug ("Forcing un-fullscreen wnck event"); + wnck_window_set_fullscreen (active, FALSE); } return FALSE; } static void -unfullscreen (MaximusBind *bind, MatewnckWindow *window) +unfullscreen (MaximusBind *bind, WnckWindow *window) { MaximusBindPrivate UNUSED_VARIABLE *priv; @@ -285,17 +286,17 @@ static void on_binding_activated (gchar *keystring, MaximusBind *bind) { MaximusBindPrivate *priv; - MatewnckWindow *active; + WnckWindow *active; g_return_if_fail (MAXIMUS_IS_BIND (bind)); priv = bind->priv; - active = matewnck_screen_get_active_window (priv->screen); + active = wnck_screen_get_active_window (priv->screen); - if (matewnck_window_get_window_type (active) != MATEWNCK_WINDOW_NORMAL) + if (wnck_window_get_window_type (active) != WNCK_WINDOW_NORMAL) return; - if (matewnck_window_is_fullscreen (active)) + if (wnck_window_is_fullscreen (active)) { unfullscreen (bind, active); } @@ -462,12 +463,12 @@ maximus_bind_init (MaximusBind *bind) { MaximusBindPrivate *priv; GdkDisplay *display = gdk_display_get_default (); - MatewnckScreen *screen; + WnckScreen *screen; priv = bind->priv = MAXIMUS_BIND_GET_PRIVATE (bind); priv->fk = fakekey_init (GDK_DISPLAY_XDISPLAY (display)); - priv->screen = screen = matewnck_screen_get_default (); + priv->screen = screen = wnck_screen_get_default (); priv->rules = NULL; priv->settings = g_settings_new (BIND_SCHEMA); diff --git a/maximus/xutils.c b/maximus/xutils.c index 4e79569..3ff03bb 100644 --- a/maximus/xutils.c +++ b/maximus/xutils.c @@ -25,7 +25,8 @@ #include "xutils.h" #include <string.h> #include <stdio.h> -#include <libmatewnck/libmatewnck.h> +#define WNCK_I_KNOW_THIS_IS_UNSTABLE +#include <libwnck/libwnck.h> #ifdef __GNUC__ #define UNUSED_VARIABLE __attribute__ ((unused)) @@ -34,13 +35,13 @@ #endif void -_matewnck_error_trap_push (void) +_wnck_error_trap_push (void) { gdk_error_trap_push (); } int -_matewnck_error_trap_pop (void) +_wnck_error_trap_pop (void) { XSync (gdk_display, False); return gdk_error_trap_pop (); @@ -65,14 +66,14 @@ latin1_to_utf8 (const char *latin1) } void -_matewnck_get_wmclass (Window xwindow, +_wnck_get_wmclass (Window xwindow, char **res_class, char **res_name) { XClassHint ch; char UNUSED_VARIABLE *retval; - _matewnck_error_trap_push (); + _wnck_error_trap_push (); ch.res_name = NULL; ch.res_class = NULL; @@ -80,7 +81,7 @@ _matewnck_get_wmclass (Window xwindow, XGetClassHint (gdk_display, xwindow, &ch); - _matewnck_error_trap_pop (); + _wnck_error_trap_pop (); retval = NULL; diff --git a/maximus/xutils.h b/maximus/xutils.h index 58e1d6e..82e36c8 100644 --- a/maximus/xutils.h +++ b/maximus/xutils.h @@ -21,8 +21,8 @@ * Boston, MA 02111-1307, USA. */ -#ifndef MATEWNCK_XUTILS_H -#define MATEWNCK_XUTILS_H +#ifndef WNCK_XUTILS_H +#define WNCK_XUTILS_H #include <glib.h> #include <X11/Xlib.h> @@ -33,17 +33,17 @@ G_BEGIN_DECLS void -_matewnck_error_trap_push (void); +_wnck_error_trap_push (void); int -_matewnck_error_trap_pop (void); +_wnck_error_trap_pop (void); void -_matewnck_get_wmclass (Window xwindow, +_wnck_get_wmclass (Window xwindow, char **res_class, char **res_name); G_END_DECLS -#endif /* MATEWNCK_XUTILS_H */ +#endif /* WNCK_XUTILS_H */ |