mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
In the tab task switcher popup, dim the window icon and put its name
2005-01-18 Vincent Noel <vnoel@cox.net> * src/screen.c: (meta_screen_ensure_tab_popup), (meta_screen_ensure_workspace_popup): * src/tabpopup.c: (dimm_icon), (meta_ui_tab_popup_new), (free_entry): * src/tabpopup.h: In the tab task switcher popup, dim the window icon and put its name between brackets when the window is minimized. Fixes #136666.
This commit is contained in:
parent
48a6dd603a
commit
47221dcce2
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2005-01-18 Vincent Noel <vnoel@cox.net>
|
||||||
|
|
||||||
|
* src/screen.c: (meta_screen_ensure_tab_popup),
|
||||||
|
(meta_screen_ensure_workspace_popup):
|
||||||
|
* src/tabpopup.c: (dimm_icon), (meta_ui_tab_popup_new),
|
||||||
|
(free_entry):
|
||||||
|
* src/tabpopup.h: In the tab task switcher popup, dim the window
|
||||||
|
icon and put its name between brackets when the window is
|
||||||
|
minimized. Fixes #136666.
|
||||||
|
|
||||||
2005-01-11 Elijah Newren <newren@gmail.com>
|
2005-01-11 Elijah Newren <newren@gmail.com>
|
||||||
|
|
||||||
Correct highlighting of windows in workspace switcher popup.
|
Correct highlighting of windows in workspace switcher popup.
|
||||||
|
@ -1163,6 +1163,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
|
|||||||
entries[i].title = window->title;
|
entries[i].title = window->title;
|
||||||
entries[i].icon = window->icon;
|
entries[i].icon = window->icon;
|
||||||
entries[i].blank = FALSE;
|
entries[i].blank = FALSE;
|
||||||
|
entries[i].minimized = window->minimized;
|
||||||
|
|
||||||
if (!window->minimized || !meta_window_get_icon_geometry (window, &r))
|
if (!window->minimized || !meta_window_get_icon_geometry (window, &r))
|
||||||
meta_window_get_outer_rect (window, &r);
|
meta_window_get_outer_rect (window, &r);
|
||||||
@ -1255,6 +1256,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
|
|||||||
entries[i].title = meta_workspace_get_name (workspace);
|
entries[i].title = meta_workspace_get_name (workspace);
|
||||||
entries[i].icon = NULL;
|
entries[i].icon = NULL;
|
||||||
entries[i].blank = FALSE;
|
entries[i].blank = FALSE;
|
||||||
|
entries[i].minimized = FALSE;
|
||||||
|
|
||||||
g_assert (entries[i].title != NULL);
|
g_assert (entries[i].title != NULL);
|
||||||
}
|
}
|
||||||
@ -1264,6 +1266,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
|
|||||||
entries[i].title = NULL;
|
entries[i].title = NULL;
|
||||||
entries[i].icon = NULL;
|
entries[i].icon = NULL;
|
||||||
entries[i].blank = TRUE;
|
entries[i].blank = TRUE;
|
||||||
|
entries[i].minimized = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
@ -40,7 +40,7 @@ struct _TabEntry
|
|||||||
{
|
{
|
||||||
MetaTabEntryKey key;
|
MetaTabEntryKey key;
|
||||||
char *title;
|
char *title;
|
||||||
GdkPixbuf *icon;
|
GdkPixbuf *icon, *dimmed_icon;
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
GdkRectangle inner_rect;
|
GdkRectangle inner_rect;
|
||||||
@ -115,6 +115,44 @@ utf8_strndup (const char *src,
|
|||||||
return g_strndup (src, s - src);
|
return g_strndup (src, s - src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GdkPixbuf*
|
||||||
|
dimm_icon (GdkPixbuf *pixbuf)
|
||||||
|
{
|
||||||
|
int x, y, pixel_stride, row_stride;
|
||||||
|
guchar *row, *pixels;
|
||||||
|
int w, h;
|
||||||
|
GdkPixbuf *dimmed_pixbuf;
|
||||||
|
|
||||||
|
if (gdk_pixbuf_get_has_alpha (dimmed_pixbuf))
|
||||||
|
{
|
||||||
|
dimmed_pixbuf = gdk_pixbuf_copy (pixbuf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dimmed_pixbuf = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
w = gdk_pixbuf_get_width (dimmed_pixbuf);
|
||||||
|
h = gdk_pixbuf_get_height (dimmed_pixbuf);
|
||||||
|
|
||||||
|
pixel_stride = 4;
|
||||||
|
|
||||||
|
row = gdk_pixbuf_get_pixels (dimmed_pixbuf);
|
||||||
|
row_stride = gdk_pixbuf_get_rowstride (dimmed_pixbuf);
|
||||||
|
|
||||||
|
for (y = 0; y < h; y++)
|
||||||
|
{
|
||||||
|
pixels = row;
|
||||||
|
for (x = 0; x < w; x++)
|
||||||
|
{
|
||||||
|
pixels[3] /= 2;
|
||||||
|
pixels += pixel_stride;
|
||||||
|
}
|
||||||
|
row += row_stride;
|
||||||
|
}
|
||||||
|
return dimmed_pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
MetaTabPopup*
|
MetaTabPopup*
|
||||||
meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
||||||
int screen_number,
|
int screen_number,
|
||||||
@ -180,15 +218,31 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
|||||||
|
|
||||||
te = g_new (TabEntry, 1);
|
te = g_new (TabEntry, 1);
|
||||||
te->key = entries[i].key;
|
te->key = entries[i].key;
|
||||||
te->title =
|
te->title = NULL;
|
||||||
entries[i].title
|
if (entries[i].title)
|
||||||
? utf8_strndup (entries[i].title, max_chars_per_title)
|
{
|
||||||
: NULL;
|
if (entries[i].minimized)
|
||||||
|
{
|
||||||
|
gchar *tmp;
|
||||||
|
tmp = g_strdup_printf ("[%s]", entries[i].title);
|
||||||
|
te->title = utf8_strndup (tmp, max_chars_per_title);
|
||||||
|
g_free (tmp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
te->title = utf8_strndup (entries[i].title, max_chars_per_title);
|
||||||
|
}
|
||||||
|
}
|
||||||
te->widget = NULL;
|
te->widget = NULL;
|
||||||
te->icon = entries[i].icon;
|
te->icon = entries[i].icon;
|
||||||
te->blank = entries[i].blank;
|
te->blank = entries[i].blank;
|
||||||
|
te->dimmed_icon = NULL;
|
||||||
if (te->icon)
|
if (te->icon)
|
||||||
|
{
|
||||||
g_object_ref (G_OBJECT (te->icon));
|
g_object_ref (G_OBJECT (te->icon));
|
||||||
|
if (entries[i].minimized)
|
||||||
|
te->dimmed_icon = dimm_icon (entries[i].icon);
|
||||||
|
}
|
||||||
|
|
||||||
if (outline)
|
if (outline)
|
||||||
{
|
{
|
||||||
@ -264,8 +318,15 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
|||||||
image = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
|
image = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
else if (outline)
|
else if (outline)
|
||||||
|
{
|
||||||
|
if (te->dimmed_icon)
|
||||||
|
{
|
||||||
|
image = selectable_image_new (te->dimmed_icon);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
image = selectable_image_new (te->icon);
|
image = selectable_image_new (te->icon);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_misc_set_padding (GTK_MISC (image),
|
gtk_misc_set_padding (GTK_MISC (image),
|
||||||
INSIDE_SELECT_RECT + OUTSIDE_SELECT_RECT + 1,
|
INSIDE_SELECT_RECT + OUTSIDE_SELECT_RECT + 1,
|
||||||
@ -323,6 +384,8 @@ free_entry (gpointer data, gpointer user_data)
|
|||||||
g_free (te->title);
|
g_free (te->title);
|
||||||
if (te->icon)
|
if (te->icon)
|
||||||
g_object_unref (G_OBJECT (te->icon));
|
g_object_unref (G_OBJECT (te->icon));
|
||||||
|
if (te->dimmed_icon)
|
||||||
|
g_object_unref (G_OBJECT (te->dimmed_icon));
|
||||||
|
|
||||||
g_free (te);
|
g_free (te);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ struct _MetaTabEntry
|
|||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
int inner_x, inner_y, inner_width, inner_height;
|
int inner_x, inner_y, inner_width, inner_height;
|
||||||
guint blank : 1;
|
guint blank : 1;
|
||||||
|
guint minimized : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
MetaTabPopup* meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
||||||
|
Loading…
Reference in New Issue
Block a user