Only draw the panel on the first monitor

This commit is contained in:
Pierre Pronchery 2009-08-26 01:48:17 +00:00
parent 2ee2f879e3
commit ec32c582c2

View File

@ -72,11 +72,9 @@ static gboolean _on_closex(GtkWidget * widget, GdkEvent * event, gpointer data);
Panel * panel_new(void) Panel * panel_new(void)
{ {
Panel * panel; Panel * panel;
GdkScreen * screen;
GtkWidget * event; GtkWidget * event;
gint x; GdkRectangle rect;
gint y;
gint height;
gint depth;
if((panel = malloc(sizeof(*panel))) == NULL) if((panel = malloc(sizeof(*panel))) == NULL)
{ {
@ -94,28 +92,28 @@ Panel * panel_new(void)
panel->helper.logout_dialog = _panel_helper_logout_dialog; panel->helper.logout_dialog = _panel_helper_logout_dialog;
panel->helper.position_menu = _panel_helper_position_menu; panel->helper.position_menu = _panel_helper_position_menu;
/* root window */ /* root window */
panel->root = gdk_screen_get_root_window( panel->root = gdk_screen_get_root_window(gdk_screen_get_default());
gdk_display_get_default_screen( screen = gdk_screen_get_default();
gdk_display_get_default())); gdk_screen_get_monitor_geometry(screen, 0, &rect);
gdk_window_get_geometry(panel->root, &x, &y, &panel->root_width, panel->root_width = rect.width;
&panel->root_height, &depth); panel->root_height = rect.height;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "DEBUG: %s() x=%d y=%d width=%d height=%d depth=%d\n", fprintf(stderr, "DEBUG: %s() width=%d height=%d\n", __func__,
__func__, x, y, panel->root_width, panel->root_height, panel->root_width, panel->root_height);
depth);
#endif #endif
/* panel */ /* panel */
g_idle_add(_on_idle, panel); g_idle_add(_on_idle, panel);
panel->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); panel->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
height = panel->icon_height + (PANEL_BORDER_WIDTH * 8); rect.height = panel->icon_height + (PANEL_BORDER_WIDTH * 8);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "DEBUG: %s() height=%d\n", __func__, height); fprintf(stderr, "DEBUG: %s() height=%d\n", __func__, rect.height);
#endif #endif
gtk_window_resize(GTK_WINDOW(panel->window), panel->root_width, height); gtk_window_resize(GTK_WINDOW(panel->window), panel->root_width,
rect.height);
gtk_window_set_type_hint(GTK_WINDOW(panel->window), gtk_window_set_type_hint(GTK_WINDOW(panel->window),
GDK_WINDOW_TYPE_HINT_DOCK); GDK_WINDOW_TYPE_HINT_DOCK);
gtk_window_move(GTK_WINDOW(panel->window), 0, panel->root_height gtk_window_move(GTK_WINDOW(panel->window), 0, panel->root_height
- height); - rect.height);
g_signal_connect(G_OBJECT(panel->window), "delete-event", G_CALLBACK( g_signal_connect(G_OBJECT(panel->window), "delete-event", G_CALLBACK(
_on_closex), panel); _on_closex), panel);
event = gtk_event_box_new(); event = gtk_event_box_new();