summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-08-29 04:53:48 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-08-29 04:53:48 +0000
commit4abbd4b1e51b0bccb183d83a06b42584fbac05c7 (patch)
tree6fc51047a34db112aaadbdc131702dc19d91b2f2
parent27c81cad339f3c0d7265a55d40d36f90c262cd0c (diff)
downloadmetacity-4abbd4b1e51b0bccb183d83a06b42584fbac05c7.tar.gz
add crackrock window-outlining feature
2001-08-29 Havoc Pennington <hp@pobox.com> * src/tabpopup.c: add crackrock window-outlining feature * src/session.c (window_type_to_string): handle fullscreen
-rw-r--r--ChangeLog6
-rw-r--r--src/core.c18
-rw-r--r--src/core.h4
-rw-r--r--src/screen.c8
-rw-r--r--src/session.c5
-rw-r--r--src/tabpopup.c58
-rw-r--r--src/ui.h7
7 files changed, 101 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index bfa38b3f..51717bb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2001-08-29 Havoc Pennington <hp@pobox.com>
+ * src/tabpopup.c: add crackrock window-outlining feature
+
+ * src/session.c (window_type_to_string): handle fullscreen
+
+2001-08-29 Havoc Pennington <hp@pobox.com>
+
* src/display.c (meta_display_open): wrong atom name -
_NET_SUPPORTED not _NET_WM_SUPPORTED
diff --git a/src/core.c b/src/core.c
index d4d03459..622397cf 100644
--- a/src/core.c
+++ b/src/core.c
@@ -24,6 +24,24 @@
#include "workspace.h"
void
+meta_core_get_outer_rect (Display *xdisplay,
+ Window frame_xwindow,
+ GdkRectangle *rect)
+{
+ MetaDisplay *display;
+ MetaWindow *window;
+ MetaRectangle r;
+
+ display = meta_display_for_x_display (xdisplay);
+ window = meta_display_lookup_x_window (display, frame_xwindow);
+
+ if (window == NULL || window->frame == NULL)
+ meta_bug ("No such frame window 0x%lx!\n", frame_xwindow);
+
+
+}
+
+void
meta_core_get_frame_size (Display *xdisplay,
Window frame_xwindow,
int *width,
diff --git a/src/core.h b/src/core.h
index 3b291cea..766bbb04 100644
--- a/src/core.h
+++ b/src/core.h
@@ -28,6 +28,10 @@
#include "frames.h"
#include "common.h"
+void meta_core_get_outer_rect (Display *xdisplay,
+ Window frame_xwindow,
+ GdkRectangle *rect);
+
void meta_core_get_frame_size (Display *xdisplay,
Window frame_xwindow,
int *width,
diff --git a/src/screen.c b/src/screen.c
index e736c593..22ab84e4 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -479,12 +479,18 @@ meta_screen_ensure_tab_popup (MetaScreen *screen)
while (i < len)
{
MetaWindow *window;
-
+ MetaRectangle r;
+
window = tmp->data;
entries[i].xwindow = window->xwindow;
entries[i].title = window->title;
entries[i].icon = window->icon;
+ meta_window_get_outer_rect (window, &r);
+ entries[i].x = r.x;
+ entries[i].y = r.y;
+ entries[i].width = r.width;
+ entries[i].height = r.height;
++i;
tmp = tmp->next;
diff --git a/src/session.c b/src/session.c
index e5148f5b..00290e69 100644
--- a/src/session.c
+++ b/src/session.c
@@ -563,6 +563,9 @@ window_type_to_string (MetaWindowType type)
case META_WINDOW_MENU:
return "menu";
break;
+ case META_WINDOW_FULLSCREEN:
+ return "fullscreen";
+ break;
}
return "";
@@ -585,6 +588,8 @@ window_type_from_string (const char *str)
return META_WINDOW_TOOLBAR;
else if (strcmp (str, "menu") == 0)
return META_WINDOW_MENU;
+ else if (strcmp (str, "fullscreen") == 0)
+ return META_WINDOW_FULLSCREEN;
else
return META_WINDOW_NORMAL;
}
diff --git a/src/tabpopup.c b/src/tabpopup.c
index 8ac522a5..bf46dd13 100644
--- a/src/tabpopup.c
+++ b/src/tabpopup.c
@@ -35,6 +35,7 @@ struct _TabEntry
char *title;
GdkPixbuf *icon;
GtkWidget *widget;
+ GdkRectangle rect;
};
struct _MetaTabPopup
@@ -44,6 +45,7 @@ struct _MetaTabPopup
GList *current;
GList *entries;
GtkWidget *current_selected_widget;
+ GtkWidget *outline_window;
};
static GtkWidget* selectable_image_new (GdkPixbuf *pixbuf);
@@ -64,6 +66,11 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
int max_label_width;
popup = g_new (MetaTabPopup, 1);
+
+ popup->outline_window = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_widget_set_app_paintable (popup->outline_window, TRUE);
+ gtk_widget_realize (popup->outline_window);
+
popup->window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_position (GTK_WINDOW (popup->window),
GTK_WIN_POS_CENTER_ALWAYS);
@@ -87,6 +94,11 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries)
g_object_ref (G_OBJECT (te->icon));
te->widget = NULL;
+ te->rect.x = entries[i].x;
+ te->rect.y = entries[i].y;
+ te->rect.width = entries[i].width;
+ te->rect.height = entries[i].height;
+
tab_entries = g_list_prepend (tab_entries, te);
++i;
@@ -194,7 +206,7 @@ free_entry (gpointer data, gpointer user_data)
void
meta_ui_tab_popup_free (MetaTabPopup *popup)
{
-
+ gtk_widget_destroy (popup->outline_window);
gtk_widget_destroy (popup->window);
g_list_foreach (popup->entries, free_entry, NULL);
@@ -218,12 +230,56 @@ static void
display_entry (MetaTabPopup *popup,
TabEntry *te)
{
+ GdkRectangle inner;
+ GdkRectangle rect;
+
if (popup->current_selected_widget)
unselect_image (popup->current_selected_widget);
gtk_label_set_text (GTK_LABEL (popup->label), te->title);
select_image (te->widget);
+ /* Do stuff behind gtk's back */
+ gdk_window_hide (popup->outline_window->window);
+
+#define OUTLINE_WIDTH 3
+
+ rect = te->rect;
+ rect.x = 0;
+ rect.y = 0;
+
+ inner = rect;
+ inner.x += OUTLINE_WIDTH;
+ inner.y += OUTLINE_WIDTH;
+ inner.width -= OUTLINE_WIDTH * 2;
+ inner.height -= OUTLINE_WIDTH * 2;
+ if (inner.width >= 0 || inner.height >= 0)
+ {
+ GdkRegion *region;
+ GdkRegion *inner_region;
+
+ gdk_window_move_resize (popup->outline_window->window,
+ te->rect.x, te->rect.y,
+ te->rect.width, te->rect.height);
+
+ gdk_window_set_background (popup->outline_window->window,
+ &popup->outline_window->style->black);
+
+ region = gdk_region_rectangle (&rect);
+ inner_region = gdk_region_rectangle (&inner);
+ gdk_region_subtract (region, inner_region);
+ gdk_region_destroy (inner_region);
+
+ gdk_window_shape_combine_region (popup->outline_window->window,
+ region,
+ 0, 0);
+
+ /* This should piss off gtk a bit, but we don't want to raise
+ * above the tab popup
+ */
+ gdk_window_show_unraised (popup->outline_window->window);
+ }
+
popup->current_selected_widget = te->widget;
}
diff --git a/src/ui.h b/src/ui.h
index 9fc354c9..6f6adbfa 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -133,9 +133,10 @@ typedef struct _MetaTabPopup MetaTabPopup;
struct _MetaTabEntry
{
- Window xwindow;
- const char *title;
- GdkPixbuf *icon;
+ Window xwindow;
+ const char *title;
+ GdkPixbuf *icon;
+ int x, y, width, height;
};
MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries);