summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-08-19 06:23:59 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-08-19 06:23:59 +0000
commitf70993be97dcd7f7a656723185243c323451c1fa (patch)
treee90e0d03c4f6f4fbd4e543f6aa584c180f3cb3e1
parent92a965b979c2f2f48b7553d326d10fb56b69d8ce (diff)
downloadmetacity-f70993be97dcd7f7a656723185243c323451c1fa.tar.gz
metacity-f70993be97dcd7f7a656723185243c323451c1fa.tar.bz2
add prototype thingy to display windows we're cycling through with tab.
2001-08-19 Havoc Pennington <hp@pobox.com> * src/tabpopup.c: add prototype thingy to display windows we're cycling through with tab. Not wired up to keybindings yet.
-rw-r--r--ChangeLog10
-rw-r--r--src/Makefile.am1
-rw-r--r--src/effects.c3
-rwxr-xr-xsrc/run-metacity.sh5
-rw-r--r--src/tabpopup.c254
-rw-r--r--src/ui.h21
-rw-r--r--src/window.c10
7 files changed, 303 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c10177..2d6f609 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-08-19 Havoc Pennington <hp@pobox.com>
+
+ * src/tabpopup.c: add prototype thingy to display windows we're
+ cycling through with tab. Not wired up to keybindings yet.
+
+2001-08-18 Havoc Pennington <hp@pobox.com>
+
+ * src/effects.c (meta_effects_draw_box_animation): put an XFlush()
+ right after starting things moving
+
2001-08-18 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_configure_request):
diff --git a/src/Makefile.am b/src/Makefile.am
index bec595f..ea7ffe8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,7 @@ metacity_SOURCES= \
session.h \
stack.c \
stack.h \
+ tabpopup.c \
ui.c \
ui.h \
util.c \
diff --git a/src/effects.c b/src/effects.c
index f9eb254..87930d8 100644
--- a/src/effects.c
+++ b/src/effects.c
@@ -250,6 +250,9 @@ meta_effects_draw_box_animation (MetaScreen *screen,
g_timeout_add (15,
(GSourceFunc)effects_draw_box_animation_timeout,
context);
+
+ /* kick changes onto the server */
+ XFlush (context->screen->display->xdisplay);
}
diff --git a/src/run-metacity.sh b/src/run-metacity.sh
index db1be58..01dd443 100755
--- a/src/run-metacity.sh
+++ b/src/run-metacity.sh
@@ -24,7 +24,8 @@ fi
if test -z "$ONLY_WM"; then
Xnest -ac :1 -scrns $SCREENS -geometry 640x480 -bw 15 &
- usleep 500000
+ ## usleep 800000
+ sleep 1
if test -n "$TEST_CLIENT"; then
DISPLAY=:1 $TEST_CLIENT &
@@ -32,12 +33,14 @@ if test -z "$ONLY_WM"; then
if test $CLIENTS != 0; then
for I in `seq 1 $CLIENTS`; do
+ echo "Launching xterm $I"
DISPLAY=:1 xterm -geometry 25x15 &
done
fi
if test $SM_CLIENTS != 0; then
for I in `seq 1 $SM_CLIENTS`; do
+ echo "Launching gnome-terminal $I"
DISPLAY=:1 gnome-terminal --geometry 25x15 &
done
fi
diff --git a/src/tabpopup.c b/src/tabpopup.c
new file mode 100644
index 0000000..5db601c
--- /dev/null
+++ b/src/tabpopup.c
@@ -0,0 +1,254 @@
+/* Metacity popup window thing showing windows you can tab to */
+
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "ui.h"
+#include "util.h"
+#include <math.h>
+#include <gtk/gtk.h>
+
+typedef struct _TabEntry TabEntry;
+
+struct _TabEntry
+{
+ Window xwindow;
+ char *title;
+ GdkPixbuf *icon;
+ GtkWidget *widget;
+};
+
+struct _MetaTabPopup
+{
+ GtkWidget *window;
+ GtkWidget *label;
+ GList *current;
+ GList *entries;
+};
+
+MetaTabPopup*
+meta_ui_tab_popup_new (const MetaTabEntry *entries)
+{
+ MetaTabPopup *popup;
+ int i, left, right, top, bottom;
+ GList *tab_entries;
+ int width;
+ int height;
+ GtkWidget *table;
+ GList *tmp;
+
+ popup = g_new (MetaTabPopup, 1);
+ popup->window = gtk_window_new (GTK_WINDOW_POPUP);
+ popup->current = NULL;
+ popup->entries = NULL;
+
+ tab_entries = NULL;
+ i = 0;
+ while (entries[i].xwindow != None)
+ {
+ TabEntry *te;
+
+ te = g_new (TabEntry, 1);
+ te->xwindow = entries[i].xwindow;
+ te->title = g_strdup (entries[i].title);
+ te->icon = entries[i].icon;
+ g_object_ref (G_OBJECT (te->icon));
+ te->widget = NULL;
+
+ tab_entries = g_list_prepend (tab_entries, te);
+
+ ++i;
+ }
+
+ popup->entries = g_list_reverse (tab_entries);
+
+ width = 5; /* FIXME */
+ height = i / width;
+ if (i % width)
+ height += 1;
+
+ table = gtk_table_new (height + 1, width, FALSE);
+
+ popup->label = gtk_label_new ("");
+
+ gtk_table_attach (GTK_TABLE (table),
+ popup->label,
+ 0, width, height - 1, height,
+ 0, 0,
+ 0, 0);
+
+ left = 0;
+ right = 1;
+ top = 0;
+ bottom = 1;
+ tmp = popup->entries;
+
+ while (tmp && top < height)
+ {
+ while (tmp && left < width)
+ {
+ GtkWidget *image;
+ TabEntry *te;
+
+ te = tmp->data;
+
+ image = gtk_image_new_from_pixbuf (te->icon);
+
+ te->widget = image;
+
+ gtk_table_attach (GTK_TABLE (table),
+ te->widget,
+ left, right, top, bottom,
+ 0, 0,
+ 0, 0);
+
+ tmp = tmp->next;
+
+ ++left;
+ }
+
+ ++top;
+ }
+
+ return popup;
+}
+
+static void
+free_entry (gpointer data, gpointer user_data)
+{
+ TabEntry *te;
+
+ te = data;
+
+ g_free (te->title);
+ g_object_unref (G_OBJECT (te->icon));
+
+ g_free (te);
+}
+
+void
+meta_ui_tab_popup_free (MetaTabPopup *popup)
+{
+
+ gtk_widget_destroy (popup->window);
+
+ g_list_foreach (popup->entries, free_entry, NULL);
+
+ g_list_free (popup->entries);
+
+ g_free (popup);
+}
+
+void
+meta_ui_tab_popup_set_showing (MetaTabPopup *popup,
+ gboolean showing)
+{
+ if (showing)
+ gtk_widget_show_all (popup->window);
+ else
+ gtk_widget_hide (popup->window);
+}
+
+static void
+display_entry (MetaTabPopup *popup,
+ TabEntry *te)
+{
+ gtk_label_set_text (GTK_LABEL (popup->label), te->title);
+}
+
+void
+meta_ui_tab_popup_forward (MetaTabPopup *popup)
+{
+ if (popup->current != NULL)
+ popup->current = popup->current->next;
+
+ if (popup->current == NULL)
+ popup->current = popup->entries;
+
+ if (popup->current != NULL)
+ {
+ TabEntry *te;
+
+ te = popup->current->data;
+
+ display_entry (popup, te);
+ }
+}
+
+void
+meta_ui_tab_popup_backward (MetaTabPopup *popup)
+{
+ if (popup->current != NULL)
+ popup->current = popup->current->prev;
+
+ if (popup->current == NULL)
+ popup->current = g_list_last (popup->entries);
+
+ if (popup->current != NULL)
+ {
+ TabEntry *te;
+
+ te = popup->current->data;
+
+ display_entry (popup, te);
+ }
+}
+
+Window
+meta_ui_tab_popup_get_selected (MetaTabPopup *popup)
+{
+ if (popup->current)
+ {
+ TabEntry *te;
+
+ te = popup->current->data;
+
+ return te->xwindow;
+ }
+ else
+ return None;
+}
+
+void
+meta_ui_tab_popup_select (MetaTabPopup *popup,
+ Window xwindow)
+{
+ GList *tmp;
+
+ tmp = popup->entries;
+ while (tmp != NULL)
+ {
+ TabEntry *te;
+
+ te = tmp->data;
+
+ if (te->xwindow == xwindow)
+ {
+ popup->current = tmp;
+
+ display_entry (popup, te);
+
+ return;
+ }
+
+ tmp = tmp->next;
+ }
+
+ meta_bug ("Selected nonexistent entry 0x%lx in tab popup\n", xwindow);
+}
diff --git a/src/ui.h b/src/ui.h
index de9e549..b7df976 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -117,5 +117,26 @@ GdkPixbuf* meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
void meta_ui_push_delay_exposes (MetaUI *ui);
void meta_ui_pop_delay_exposes (MetaUI *ui);
+typedef struct _MetaTabEntry MetaTabEntry;
+typedef struct _MetaTabPopup MetaTabPopup;
+
+struct _MetaTabEntry
+{
+ Window xwindow;
+ const char *title;
+ GdkPixbuf *icon;
+};
+
+MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries);
+void meta_ui_tab_popup_free (MetaTabPopup *popup);
+void meta_ui_tab_popup_set_showing (MetaTabPopup *popup,
+ gboolean showing);
+void meta_ui_tab_popup_forward (MetaTabPopup *popup);
+void meta_ui_tab_popup_backward (MetaTabPopup *popup);
+Window meta_ui_tab_popup_get_selected (MetaTabPopup *popup);
+void meta_ui_tab_popup_select (MetaTabPopup *popup,
+ Window xwindow);
+
+
#endif
diff --git a/src/window.c b/src/window.c
index a4fe121..65f31fb 100644
--- a/src/window.c
+++ b/src/window.c
@@ -139,6 +139,16 @@ meta_window_new (MetaDisplay *display, Window xwindow,
return NULL;
}
+ meta_verbose ("attrs.map_state = %d (%s)\n",
+ attrs.map_state,
+ (attrs.map_state == IsUnmapped) ?
+ "IsUnmapped" :
+ (attrs.map_state == IsViewable) ?
+ "IsViewable" :
+ (attrs.map_state == IsUnviewable) ?
+ "IsUnviewable" :
+ "(unknown)");
+
existing_wm_state = WithdrawnState;
if (must_be_viewable && attrs.map_state != IsViewable)
{