diff --git a/ChangeLog b/ChangeLog index bfa38b3fb..51717bb38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-08-29 Havoc Pennington + + * src/tabpopup.c: add crackrock window-outlining feature + + * src/session.c (window_type_to_string): handle fullscreen + 2001-08-29 Havoc Pennington * src/display.c (meta_display_open): wrong atom name - diff --git a/src/core.c b/src/core.c index d4d034594..622397cf1 100644 --- a/src/core.c +++ b/src/core.c @@ -23,6 +23,24 @@ #include "frame.h" #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, diff --git a/src/core.h b/src/core.h index 3b291cea3..766bbb047 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 e736c593f..22ab84e44 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 e5148f5b3..00290e691 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 8ac522a5d..bf46dd137 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 9fc354c9c..6f6adbfa5 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);