Tracking changes in screen size
This commit is contained in:
parent
6b003bb0d6
commit
db4187673e
34
po/fr.po
34
po/fr.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Panel 0.0.5\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-10-27 16:31+0200\n"
|
||||
"POT-Creation-Date: 2011-10-28 00:15+0200\n"
|
||||
"PO-Revision-Date: 2010-04-22 12:45+0200\n"
|
||||
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
|
||||
"Language-Team: French\n"
|
||||
@ -21,7 +21,7 @@ msgstr ""
|
||||
msgid "Unknown"
|
||||
msgstr "Inconnu"
|
||||
|
||||
#: ../src/applets/battery.c:185 ../src/panel.c:431 ../src/panel.c:436
|
||||
#: ../src/applets/battery.c:185 ../src/panel.c:457 ../src/panel.c:462
|
||||
#: ../src/run.c:214 ../src/run.c:220
|
||||
msgid "Error"
|
||||
msgstr "Erreur"
|
||||
@ -88,8 +88,8 @@ msgstr "Verrouiller l'écran"
|
||||
msgid "Logging out is disabled"
|
||||
msgstr "Se déconnecter est désactivé"
|
||||
|
||||
#: ../src/applets/logout.c:69 ../src/panel.c:1282 ../src/panel.c:1289
|
||||
#: ../src/panel.c:1298
|
||||
#: ../src/applets/logout.c:69 ../src/panel.c:1321 ../src/panel.c:1328
|
||||
#: ../src/panel.c:1337
|
||||
msgid "Logout"
|
||||
msgstr "Déconnexion"
|
||||
|
||||
@ -195,35 +195,35 @@ msgstr "Petite"
|
||||
msgid "Smaller"
|
||||
msgstr "Très petite"
|
||||
|
||||
#: ../src/panel.c:548
|
||||
#: ../src/panel.c:574
|
||||
msgid "Panel preferences"
|
||||
msgstr "Préférences du Panel"
|
||||
|
||||
#: ../src/panel.c:562
|
||||
#: ../src/panel.c:588
|
||||
msgid "General"
|
||||
msgstr "Général"
|
||||
|
||||
#: ../src/panel.c:591
|
||||
#: ../src/panel.c:617
|
||||
msgid "Applets:"
|
||||
msgstr "Greffons :"
|
||||
|
||||
#: ../src/panel.c:666
|
||||
#: ../src/panel.c:692
|
||||
msgid "Top panel:"
|
||||
msgstr "Panneau supérieur :"
|
||||
|
||||
#: ../src/panel.c:672 ../src/panel.c:676 ../src/panel.c:707 ../src/panel.c:711
|
||||
#: ../src/panel.c:698 ../src/panel.c:702 ../src/panel.c:733 ../src/panel.c:737
|
||||
msgid "Default"
|
||||
msgstr "Par défaut"
|
||||
|
||||
#: ../src/panel.c:701
|
||||
#: ../src/panel.c:727
|
||||
msgid "Bottom panel:"
|
||||
msgstr "Panneau inférieur :"
|
||||
|
||||
#: ../src/panel.c:1221
|
||||
#: ../src/panel.c:1260
|
||||
msgid "translator-credits"
|
||||
msgstr "Pierre Pronchery <khorben@defora.org>"
|
||||
|
||||
#: ../src/panel.c:1268
|
||||
#: ../src/panel.c:1307
|
||||
msgid ""
|
||||
"This will log you out of the current session, therefore closing any "
|
||||
"application currently opened and losing any unsaved data.\n"
|
||||
@ -234,7 +234,7 @@ msgstr ""
|
||||
"sauvegardées.\n"
|
||||
"Voulez-vous continuer?"
|
||||
|
||||
#: ../src/panel.c:1384
|
||||
#: ../src/panel.c:1423
|
||||
msgid ""
|
||||
"This will shutdown your device, therefore closing any application currently "
|
||||
"opened and losing any unsaved data.\n"
|
||||
@ -245,7 +245,7 @@ msgstr ""
|
||||
"sauvegardées.\n"
|
||||
"Voulez-vous continuer?"
|
||||
|
||||
#: ../src/panel.c:1389
|
||||
#: ../src/panel.c:1428
|
||||
msgid ""
|
||||
"This will shutdown your computer, therefore closing any application "
|
||||
"currently opened and losing any unsaved data.\n"
|
||||
@ -256,11 +256,11 @@ msgstr ""
|
||||
"sauvegardées.\n"
|
||||
"Voulez-vous continuer?"
|
||||
|
||||
#: ../src/panel.c:1403 ../src/panel.c:1410 ../src/panel.c:1419
|
||||
#: ../src/panel.c:1442 ../src/panel.c:1449 ../src/panel.c:1458
|
||||
msgid "Shutdown"
|
||||
msgstr "Arrêter"
|
||||
|
||||
#: ../src/panel.c:1409
|
||||
#: ../src/panel.c:1448
|
||||
msgid "Restart"
|
||||
msgstr "Redémarrer"
|
||||
|
||||
@ -300,6 +300,6 @@ msgstr "Permissions insuffisantes"
|
||||
msgid "Usage: run\n"
|
||||
msgstr "Usage: run\n"
|
||||
|
||||
#: ../src/window.c:58
|
||||
#: ../src/window.c:56
|
||||
msgid "Invalid panel size"
|
||||
msgstr "Taille invalide pour le panel"
|
||||
|
65
src/panel.c
65
src/panel.c
@ -117,8 +117,12 @@ static const struct
|
||||
|
||||
|
||||
/* prototypes */
|
||||
/* accessors */
|
||||
static gboolean _panel_can_suspend(void);
|
||||
|
||||
/* useful */
|
||||
static void _panel_reset(Panel * panel, GdkRectangle * rect);
|
||||
|
||||
/* helpers */
|
||||
static char const * _panel_helper_config_get(Panel * panel,
|
||||
char const * section, char const * variable);
|
||||
@ -154,6 +158,10 @@ static void _idle_load(Panel * panel, PanelPosition position,
|
||||
char const * plugins);
|
||||
static GdkFilterReturn _on_root_event(GdkXEvent * xevent, GdkEvent * event,
|
||||
gpointer data);
|
||||
static GdkFilterReturn _event_client_message(XClientMessageEvent * xevent,
|
||||
Panel * panel);
|
||||
static GdkFilterReturn _event_configure_notify(XConfigureEvent * xevent,
|
||||
Panel * panel);
|
||||
|
||||
Panel * panel_new(PanelPrefs const * prefs)
|
||||
{
|
||||
@ -218,12 +226,7 @@ Panel * panel_new(PanelPrefs const * prefs)
|
||||
}
|
||||
/* root window */
|
||||
panel->root = gdk_screen_get_root_window(panel->screen);
|
||||
gdk_screen_get_monitor_geometry(panel->screen, (prefs->monitor > 0
|
||||
&& prefs->monitor < gdk_screen_get_n_monitors(
|
||||
panel->screen))
|
||||
? prefs->monitor : 0, &rect);
|
||||
panel->root_height = rect.height;
|
||||
panel->root_width = rect.width;
|
||||
_panel_reset(panel, &rect);
|
||||
panel->top = (config_get(panel->config, NULL, "top") != NULL)
|
||||
? panel_window_new(PANEL_POSITION_TOP, &panel->top_helper,
|
||||
&rect) : NULL;
|
||||
@ -234,6 +237,9 @@ Panel * panel_new(PanelPrefs const * prefs)
|
||||
/* manage root window events */
|
||||
gdk_add_client_message_filter(gdk_atom_intern(PANEL_CLIENT_MESSAGE,
|
||||
FALSE), _on_root_event, panel);
|
||||
gdk_window_set_events(panel->root, gdk_window_get_events(
|
||||
panel->root) | GDK_PROPERTY_CHANGE_MASK);
|
||||
gdk_window_add_filter(panel->root, _on_root_event, panel);
|
||||
/* load plug-ins when idle */
|
||||
g_idle_add(_on_idle, panel);
|
||||
return panel;
|
||||
@ -378,26 +384,46 @@ static GdkFilterReturn _on_root_event(GdkXEvent * xevent, GdkEvent * event,
|
||||
{
|
||||
Panel * panel = data;
|
||||
XEvent * xe = xevent;
|
||||
XClientMessageEvent * xcme;
|
||||
|
||||
if(xe->type == ClientMessage)
|
||||
return _event_client_message(xevent, panel);
|
||||
else if(xe->type == ConfigureNotify)
|
||||
return _event_configure_notify(xevent, panel);
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
static GdkFilterReturn _event_client_message(XClientMessageEvent * xevent,
|
||||
Panel * panel)
|
||||
{
|
||||
PanelMessage message;
|
||||
|
||||
if(xe->type != ClientMessage)
|
||||
return GDK_FILTER_CONTINUE;
|
||||
xcme = &xe->xclient;
|
||||
if(xcme->message_type != gdk_x11_get_xatom_by_name(
|
||||
if(xevent->message_type != gdk_x11_get_xatom_by_name(
|
||||
PANEL_CLIENT_MESSAGE))
|
||||
return GDK_FILTER_CONTINUE;
|
||||
message = xcme->data.b[0];
|
||||
message = xevent->data.b[0];
|
||||
switch(message)
|
||||
{
|
||||
case PANEL_MESSAGE_SHOW:
|
||||
if(xcme->data.b[1] == PANEL_MESSAGE_SHOW_SETTINGS)
|
||||
if(xevent->data.b[1] == PANEL_MESSAGE_SHOW_SETTINGS)
|
||||
panel_show_preferences(panel, TRUE);
|
||||
break;
|
||||
}
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
static GdkFilterReturn _event_configure_notify(XConfigureEvent * xevent,
|
||||
Panel * panel)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
_panel_reset(panel, &rect);
|
||||
if(panel->top != NULL)
|
||||
panel_window_reset(panel->top, PANEL_POSITION_TOP, &rect);
|
||||
if(panel->bottom != NULL)
|
||||
panel_window_reset(panel->bottom, PANEL_POSITION_BOTTOM, &rect);
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/* panel_delete */
|
||||
void panel_delete(Panel * panel)
|
||||
@ -1151,6 +1177,7 @@ static char * _config_get_filename(void)
|
||||
}
|
||||
|
||||
|
||||
/* accessors */
|
||||
/* panel_can_suspend */
|
||||
static gboolean _panel_can_suspend(void)
|
||||
{
|
||||
@ -1175,6 +1202,18 @@ static gboolean _panel_can_suspend(void)
|
||||
}
|
||||
|
||||
|
||||
/* useful */
|
||||
static void _panel_reset(Panel * panel, GdkRectangle * rect)
|
||||
{
|
||||
gdk_screen_get_monitor_geometry(panel->screen, (panel->prefs.monitor > 0
|
||||
&& panel->prefs.monitor
|
||||
< gdk_screen_get_n_monitors(panel->screen))
|
||||
? panel->prefs.monitor : 0, rect);
|
||||
panel->root_height = rect->height;
|
||||
panel->root_width = rect->width;
|
||||
}
|
||||
|
||||
|
||||
/* helpers */
|
||||
/* panel_helper_config_get */
|
||||
static char const * _panel_helper_config_get(Panel * panel,
|
||||
|
91
src/window.c
91
src/window.c
@ -41,8 +41,6 @@ struct _PanelWindow
|
||||
/* public */
|
||||
/* functions */
|
||||
/* panel_window_new */
|
||||
static void _new_strut(PanelWindow * panel, PanelPosition position,
|
||||
GdkRectangle * root);
|
||||
static gboolean _on_closex(void);
|
||||
|
||||
PanelWindow * panel_window_new(PanelPosition position,
|
||||
@ -66,31 +64,73 @@ PanelWindow * panel_window_new(PanelPosition position,
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s() height=%d\n", __func__, panel->height);
|
||||
#endif
|
||||
gtk_window_resize(GTK_WINDOW(panel->window), root->width,
|
||||
panel->height);
|
||||
gtk_window_set_accept_focus(GTK_WINDOW(panel->window), FALSE);
|
||||
#if GTK_CHECK_VERSION(2, 6, 0)
|
||||
gtk_window_set_focus_on_map(GTK_WINDOW(panel->window), FALSE);
|
||||
#endif
|
||||
gtk_window_set_type_hint(GTK_WINDOW(panel->window),
|
||||
GDK_WINDOW_TYPE_HINT_DOCK);
|
||||
if(position == PANEL_POSITION_TOP)
|
||||
gtk_window_move(GTK_WINDOW(panel->window), root->x, 0);
|
||||
else
|
||||
gtk_window_move(GTK_WINDOW(panel->window), root->x,
|
||||
root->y + root->height - panel->height);
|
||||
gtk_window_stick(GTK_WINDOW(panel->window));
|
||||
g_signal_connect(G_OBJECT(panel->window), "delete-event", G_CALLBACK(
|
||||
_on_closex), panel);
|
||||
panel->hbox = gtk_hbox_new(FALSE, 2);
|
||||
gtk_container_add(GTK_CONTAINER(panel->window), panel->hbox);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(panel->window), 4);
|
||||
panel_window_reset(panel, position, root);
|
||||
gtk_widget_show_all(panel->window);
|
||||
_new_strut(panel, position, root);
|
||||
return panel;
|
||||
}
|
||||
|
||||
static void _new_strut(PanelWindow * panel, PanelPosition position,
|
||||
static gboolean _on_closex(void)
|
||||
{
|
||||
/* ignore delete events */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* panel_window_delete */
|
||||
void panel_window_delete(PanelWindow * panel)
|
||||
{
|
||||
gtk_widget_destroy(panel->window);
|
||||
object_delete(panel);
|
||||
}
|
||||
|
||||
|
||||
/* accessors */
|
||||
/* panel_window_get_height */
|
||||
int panel_window_get_height(PanelWindow * panel)
|
||||
{
|
||||
return panel->height;
|
||||
}
|
||||
|
||||
|
||||
/* useful */
|
||||
/* panel_window_append */
|
||||
void panel_window_append(PanelWindow * panel, GtkWidget * widget,
|
||||
gboolean expand, gboolean fill)
|
||||
{
|
||||
gtk_box_pack_start(GTK_BOX(panel->hbox), widget, expand, fill, 0);
|
||||
}
|
||||
|
||||
|
||||
/* panel_window_reset */
|
||||
static void _reset_strut(PanelWindow * panel, PanelPosition position,
|
||||
GdkRectangle * root);
|
||||
|
||||
void panel_window_reset(PanelWindow * panel, PanelPosition position,
|
||||
GdkRectangle * root)
|
||||
{
|
||||
gtk_window_resize(GTK_WINDOW(panel->window), root->width,
|
||||
panel->height);
|
||||
if(position == PANEL_POSITION_TOP)
|
||||
gtk_window_move(GTK_WINDOW(panel->window), root->x, 0);
|
||||
else
|
||||
gtk_window_move(GTK_WINDOW(panel->window), root->x,
|
||||
root->y + root->height - panel->height);
|
||||
_reset_strut(panel, position, root);
|
||||
}
|
||||
|
||||
static void _reset_strut(PanelWindow * panel, PanelPosition position,
|
||||
GdkRectangle * root)
|
||||
{
|
||||
GdkWindow * window;
|
||||
@ -125,32 +165,3 @@ static void _new_strut(PanelWindow * panel, PanelPosition position,
|
||||
gdk_property_change(window, atom, cardinal, 32, GDK_PROP_MODE_REPLACE,
|
||||
(guchar*)strut, 12);
|
||||
}
|
||||
|
||||
static gboolean _on_closex(void)
|
||||
{
|
||||
/* ignore delete events */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* panel_window_delete */
|
||||
void panel_window_delete(PanelWindow * panel)
|
||||
{
|
||||
gtk_widget_destroy(panel->window);
|
||||
object_delete(panel);
|
||||
}
|
||||
|
||||
|
||||
/* accessors */
|
||||
int panel_window_get_height(PanelWindow * panel)
|
||||
{
|
||||
return panel->height;
|
||||
}
|
||||
|
||||
|
||||
/* useful */
|
||||
void panel_window_append(PanelWindow * panel, GtkWidget * widget,
|
||||
gboolean expand, gboolean fill)
|
||||
{
|
||||
gtk_box_pack_start(GTK_BOX(panel->hbox), widget, expand, fill, 0);
|
||||
}
|
||||
|
@ -37,5 +37,7 @@ int panel_window_get_height(PanelWindow * panel);
|
||||
/* useful */
|
||||
void panel_window_append(PanelWindow * panel, GtkWidget * widget,
|
||||
gboolean expand, gboolean fill);
|
||||
void panel_window_reset(PanelWindow * panel, PanelPosition position,
|
||||
GdkRectangle * root);
|
||||
|
||||
#endif /* !PANEL_WINDOW_H */
|
||||
|
Loading…
Reference in New Issue
Block a user