mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
put a random cap on number of characters in the title of each window, bug
2003-09-29 Havoc Pennington <hp@redhat.com> * src/tabpopup.c (meta_ui_tab_popup_new): put a random cap on number of characters in the title of each window, bug #109301
This commit is contained in:
parent
f7c04aff1e
commit
0895abd894
@ -1,3 +1,8 @@
|
|||||||
|
2003-09-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* src/tabpopup.c (meta_ui_tab_popup_new): put a random cap on
|
||||||
|
number of characters in the title of each window, bug #109301
|
||||||
|
|
||||||
2003-09-29 Havoc Pennington <hp@redhat.com>
|
2003-09-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* configure.in: put -lXext in Xrandr check, bug #115996
|
* configure.in: put -lXext in Xrandr check, bug #115996
|
||||||
|
@ -101,6 +101,20 @@ outline_window_expose (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char*
|
||||||
|
utf8_strndup (const char *src,
|
||||||
|
int n)
|
||||||
|
{
|
||||||
|
const gchar *s = src;
|
||||||
|
while (n && *s)
|
||||||
|
{
|
||||||
|
s = g_utf8_next_char (s);
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_strndup (src, s - src);
|
||||||
|
}
|
||||||
|
|
||||||
MetaTabPopup*
|
MetaTabPopup*
|
||||||
meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
||||||
int screen_number,
|
int screen_number,
|
||||||
@ -117,8 +131,10 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
|||||||
GtkWidget *align;
|
GtkWidget *align;
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
int max_label_width;
|
int max_label_width; /* the actual max width of the labels we create */
|
||||||
AtkObject *obj;
|
AtkObject *obj;
|
||||||
|
int max_chars_per_title; /* max chars we allow in a label */
|
||||||
|
GdkScreen *screen;
|
||||||
|
|
||||||
popup = g_new (MetaTabPopup, 1);
|
popup = g_new (MetaTabPopup, 1);
|
||||||
|
|
||||||
@ -136,9 +152,11 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
|||||||
|
|
||||||
popup->window = gtk_window_new (GTK_WINDOW_POPUP);
|
popup->window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||||
|
|
||||||
|
screen = gdk_display_get_screen (gdk_display_get_default (),
|
||||||
|
screen_number);
|
||||||
|
|
||||||
gtk_window_set_screen (GTK_WINDOW (popup->window),
|
gtk_window_set_screen (GTK_WINDOW (popup->window),
|
||||||
gdk_display_get_screen (gdk_display_get_default (),
|
screen);
|
||||||
screen_number));
|
|
||||||
|
|
||||||
gtk_window_set_position (GTK_WINDOW (popup->window),
|
gtk_window_set_position (GTK_WINDOW (popup->window),
|
||||||
GTK_WIN_POS_CENTER_ALWAYS);
|
GTK_WIN_POS_CENTER_ALWAYS);
|
||||||
@ -150,6 +168,11 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
|
|||||||
popup->current_selected_entry = NULL;
|
popup->current_selected_entry = NULL;
|
||||||
popup->outline = outline;
|
popup->outline = outline;
|
||||||
|
|
||||||
|
/* make max title size some random relationship to the screen,
|
||||||
|
* avg char width of our font would be a better number.
|
||||||
|
*/
|
||||||
|
max_chars_per_title = gdk_screen_get_width (screen) / 15;
|
||||||
|
|
||||||
tab_entries = NULL;
|
tab_entries = NULL;
|
||||||
for (i = 0; i < entry_count; ++i)
|
for (i = 0; i < entry_count; ++i)
|
||||||
{
|
{
|
||||||
@ -157,7 +180,7 @@ 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 = g_strdup (entries[i].title);
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user