Browse Source

Several fixes and updates:

* Some multihead fixes (patches by Brian).
 * Windowlist fixes, sync with xfdesktop (patch by Nick).
 * Add option to keep panel transparent on mouse-over (bug #1442).
 * Change panel properties dialog layout...again (based on suggestions from Nick).


(Old svn revision: 19967)
upstream/xfce4-panel-4.10.1
Jasper Huijsmans 16 years ago
parent
commit
effa40f18d
  1. 9
      libxfce4panel/xfce-panel-external-item.c
  2. 2
      panel/panel-app-messages.c
  3. 4
      panel/panel-app.c
  4. 2
      panel/panel-app.h
  5. 15
      panel/panel-config.c
  6. 183
      panel/panel-dialogs.c
  7. 5
      panel/panel-private.h
  8. 110
      panel/panel-properties.c
  9. 3
      panel/panel-properties.h
  10. 79
      panel/panel.c
  11. 2
      panel/panel.h
  12. 504
      plugins/windowlist/windowlist.c

9
libxfce4panel/xfce-panel-external-item.c

@ -479,6 +479,8 @@ _item_construct (XfceExternalPanelItem * item)
static void
_item_setup (XfceExternalPanelItem * item, const char *file)
{
GdkScreen *gscreen;
gchar *gdkdisplay_name;
char **argv = NULL;
gulong sock;
XfceExternalPanelItemPrivate *priv;
@ -507,6 +509,9 @@ _item_setup (XfceExternalPanelItem * item, const char *file)
g_signal_connect (item, "client-event",
G_CALLBACK (_item_event_received), NULL);
gscreen = gtk_widget_get_screen (GTK_WIDGET (item));
gdkdisplay_name = gdk_screen_make_display_name (gscreen);
switch (fork())
{
case -1:
@ -514,6 +519,9 @@ _item_setup (XfceExternalPanelItem * item, const char *file)
gtk_widget_destroy (GTK_WIDGET (item));
break;
case 0:
xfce_setenv ("DISPLAY", gdkdisplay_name, TRUE);
g_free (gdkdisplay_name);
execv (argv[0], argv);
g_critical ("Could not run plugin: %s", g_strerror (errno));
gtk_widget_destroy (GTK_WIDGET (item));
@ -522,6 +530,7 @@ _item_setup (XfceExternalPanelItem * item, const char *file)
/* parent: do nothing */;
}
g_free (gdkdisplay_name);
g_strfreev (argv);
}

2
panel/panel-app-messages.c

@ -68,7 +68,7 @@ client_event_received (GtkWidget *win, GdkEventClient *ev)
panel_app_customize_items (NULL);
break;
case PANEL_APP_ABOUT:
panel_app_about ();
panel_app_about (win);
break;
default:
return FALSE;

4
panel/panel-app.c

@ -758,7 +758,7 @@ panel_app_remove_panel (GtkWidget *panel)
}
void
panel_app_about (void)
panel_app_about (GtkWidget *panel)
{
XfceAboutInfo *info;
GtkWidget *dlg;
@ -776,6 +776,8 @@ panel_app_about (void)
pb = xfce_themed_icon_load ("xfce4-panel", 48);
dlg = xfce_about_dialog_new_with_values (NULL, info, pb);
gtk_window_set_screen (GTK_WINDOW (dlg),
gtk_widget_get_screen (panel));
g_object_unref (pb);
gtk_widget_set_size_request (dlg, 400, 300);

2
panel/panel-app.h

@ -122,7 +122,7 @@ void panel_app_add_panel (void);
void panel_app_remove_panel (GtkWidget *panel);
void panel_app_about (void);
void panel_app_about (GtkWidget *panel);
Window panel_app_get_ipc_window (void);

15
panel/panel-config.c

@ -216,6 +216,7 @@ struct _ConfigParser
int handle_style;
gboolean autohide;
int transparency;
gboolean activetrans;
};
static void
@ -233,6 +234,7 @@ init_properties (ConfigParser *parser)
parser->handle_style = XFCE_HANDLE_STYLE_NONE;
parser->autohide = DEFAULT_AUTOHIDE;
parser->transparency = DEFAULT_TRANSPARENCY;
parser->activetrans = DEFAULT_ACTIVE_TRANS;
}
static void
@ -280,6 +282,10 @@ config_set_property (ConfigParser *parser,
{
parser->transparency = (int) strtol (value, NULL, 0);
}
else if (strcmp (name, "activetrans") == 0)
{
parser->activetrans = ((int) strtol (value, NULL, 0) == 1);
}
}
static void
@ -441,6 +447,7 @@ end_element_handler (GMarkupParseContext * context,
"handle-style", parser->handle_style,
"autohide", parser->autohide,
"transparency", parser->transparency,
"activetrans", parser->activetrans,
NULL);
}
panel_init_position (parser->current_panel);
@ -638,7 +645,7 @@ config_save_to_file (GPtrArray *array, const char *filename)
Panel *panel;
int size, monitor, screen_position, xoffset, yoffset, handle_style,
transparency, fullwidth, j;
gboolean autohide;
gboolean autohide, activetrans;
XfcePanelItemConfig *configlist;
DBG ("Saving panel %d", i + 1);
@ -647,7 +654,7 @@ config_save_to_file (GPtrArray *array, const char *filename)
size = monitor = screen_position = xoffset = yoffset =
transparency = fullwidth = 0;
autohide = FALSE;
autohide = activetrans = FALSE;
g_object_get (G_OBJECT (panel),
"size", &size,
@ -659,6 +666,7 @@ config_save_to_file (GPtrArray *array, const char *filename)
"handle-style", &handle_style,
"autohide", &autohide,
"transparency", &transparency,
"activetrans", &activetrans,
NULL);
/* grouping */
@ -693,6 +701,9 @@ config_save_to_file (GPtrArray *array, const char *filename)
fprintf (fp, "\t\t\t<property name=\"transparency\" value=\"%d\"/>\n",
transparency);
fprintf (fp, "\t\t\t<property name=\"activetrans\" value=\"%d\"/>\n",
activetrans);
/* grouping */
fprintf (fp, "\t\t</properties>\n"
"\t\t<items>\n");

183
panel/panel-dialogs.c

@ -82,6 +82,7 @@ struct _PanelManagerDialog
/* appearance */
GtkWidget *size;
GtkWidget *transparency;
GtkWidget *activetrans;
/* monitors */
GPtrArray *monitors;
@ -679,8 +680,13 @@ update_widgets (PanelManagerDialog *pmd)
gtk_range_set_value (GTK_RANGE (pmd->size), priv->size);
if (pmd->transparency)
{
gtk_range_set_value (GTK_RANGE (pmd->transparency),
priv->transparency);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->activetrans),
!priv->activetrans);
}
/* behavior */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->autohide),
@ -933,29 +939,34 @@ handle_style_changed (GtkComboBox *box, PanelManagerDialog *pmd)
static void
add_position_options (GtkBox *box, PanelManagerDialog *pmd)
{
GtkWidget *frame, *vbox, *vbox2, *hbox, *table, *align, *label;
GtkWidget *frame, *vbox, *vbox2, *hbox, *table, *align, *label, *sep;
GtkSizeGroup *sg;
int i;
/* floating? */
frame = xfce_create_framebox (_("Panel Type"), &align);
/* position */
frame = xfce_create_framebox (_("Position"), &align);
gtk_widget_show (frame);
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
vbox = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (align), vbox);
vbox2 = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox2);
gtk_container_add (GTK_CONTAINER (align), vbox2);
/* type */
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
pmd->fixed =
gtk_radio_button_new_with_label (NULL, _("Fixed Position"));
gtk_widget_show (pmd->fixed);
gtk_box_pack_start (GTK_BOX (vbox), pmd->fixed, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pmd->fixed, FALSE, FALSE, 0);
pmd->floating =
gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON (pmd->fixed), _("Freely Moveable"));
gtk_widget_show (pmd->floating);
gtk_box_pack_start (GTK_BOX (vbox), pmd->floating, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pmd->floating, FALSE, FALSE, 0);
g_signal_connect (pmd->fixed, "toggled", G_CALLBACK (type_changed),
pmd);
@ -963,31 +974,27 @@ add_position_options (GtkBox *box, PanelManagerDialog *pmd)
g_signal_connect (pmd->floating, "toggled", G_CALLBACK (type_changed),
pmd);
/* position */
frame = xfce_create_framebox (_("Position"), &align);
gtk_widget_show (frame);
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
sep = gtk_hseparator_new ();
gtk_widget_show (sep);
gtk_box_pack_start (GTK_BOX (vbox2), sep, FALSE, FALSE, 0);
vbox2 = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox2);
gtk_container_add (GTK_CONTAINER (align), vbox2);
/* fixed */
pmd->fixed_box = vbox = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (vbox2), vbox, TRUE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 0);
pmd->fixed_box = hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
/* fixed: position */
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
table = gtk_table_new (5, 5, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
align = gtk_alignment_new (0, 0, 0, 0);
gtk_widget_show (align);
gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
for (i = 0; i < 12; ++i)
{
@ -997,7 +1004,7 @@ add_position_options (GtkBox *box, PanelManagerDialog *pmd)
if (i <= 2 || i >= 9)
gtk_widget_set_size_request (pmd->screen_position[i], 30, 15);
else
gtk_widget_set_size_request (pmd->screen_position[i], 15, 30);
gtk_widget_set_size_request (pmd->screen_position[i], 15, 25);
g_signal_connect (pmd->screen_position[i], "button-press-event",
G_CALLBACK (screen_position_pressed), pmd);
@ -1301,45 +1308,48 @@ transparency_changed (GtkRange *range, PanelManagerDialog *pmd)
panel_set_transparency (pmd->panel, (int) gtk_range_get_value (range));
}
static void
activetrans_toggled (GtkToggleButton *tb, PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
panel_set_activetrans (pmd->panel, !gtk_toggle_button_get_active (tb));
}
static void
add_appearance_options (GtkBox *box, PanelManagerDialog *pmd)
{
static Atom composite_atom = 0;
GtkWidget *frame, *hbox, *label, *align;
GtkSizeGroup *sg;
GtkWidget *frame, *table, *label, *align;
sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* size */
frame = xfce_create_framebox (_("Size"), &align);
frame = xfce_create_framebox (_("Appearance"), &align);
gtk_widget_show (frame);
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (align), hbox);
gtk_box_pack_start (box, frame, FALSE, FALSE, BORDER);
label = xfce_create_small_label (_("Small"));
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
table = gtk_table_new (3, 2, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), BORDER);
gtk_table_set_col_spacings (GTK_TABLE (table), BORDER);
gtk_widget_show (table);
gtk_container_add (GTK_CONTAINER (align), table);
/* size */
label = gtk_label_new (_("Size (pixels):"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_size_group_add_widget (sg, label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
GTK_FILL, 0, 0, 0);
pmd->size = gtk_hscale_new_with_range (MIN_SIZE, MAX_SIZE, 2);
gtk_scale_set_value_pos (GTK_SCALE (pmd->size), GTK_POS_BOTTOM);
gtk_scale_set_value_pos (GTK_SCALE (pmd->size), GTK_POS_LEFT);
gtk_range_set_update_policy (GTK_RANGE (pmd->size), GTK_UPDATE_DELAYED);
gtk_widget_set_size_request (pmd->size, 120, -1);
gtk_widget_show (pmd->size);
gtk_box_pack_start (GTK_BOX (hbox), pmd->size, FALSE, FALSE, 0);
gtk_table_attach (GTK_TABLE (table), pmd->size, 1, 2, 0, 1,
GTK_FILL|GTK_EXPAND, 0, 0, 0);
label = xfce_create_small_label (_("Large"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
g_signal_connect (pmd->size, "value-changed",
G_CALLBACK (size_changed), pmd);
/* transparency */
if (G_UNLIKELY (!composite_atom))
composite_atom =
@ -1347,38 +1357,37 @@ add_appearance_options (GtkBox *box, PanelManagerDialog *pmd)
if (XGetSelectionOwner (GDK_DISPLAY (), composite_atom))
{
frame = xfce_create_framebox (_("Transparency"), &align);
gtk_widget_show (frame);
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (align), hbox);
label = xfce_create_small_label (_("None"));
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
label = gtk_label_new (_("Transparency (%):"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_size_group_add_widget (sg, label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
GTK_FILL, 0, 0, 0);
pmd->transparency = gtk_hscale_new_with_range (0, 100, 5);
gtk_scale_set_value_pos (GTK_SCALE (pmd->transparency), GTK_POS_BOTTOM);
gtk_scale_set_value_pos (GTK_SCALE (pmd->transparency), GTK_POS_LEFT);
gtk_range_set_update_policy (GTK_RANGE (pmd->transparency),
GTK_UPDATE_DELAYED);
gtk_widget_set_size_request (pmd->transparency, 120, -1);
gtk_widget_show (pmd->transparency);
gtk_box_pack_start (GTK_BOX (hbox), pmd->transparency, FALSE, FALSE, 0);
gtk_table_attach (GTK_TABLE (table), pmd->transparency, 1, 2, 1, 2,
GTK_FILL|GTK_EXPAND, 0, 0, 0);
label = xfce_create_small_label (_("Full"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
g_signal_connect (pmd->transparency, "value-changed",
G_CALLBACK (transparency_changed), pmd);
}
align = gtk_alignment_new (0, 0, 0, 0);
gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0);
gtk_widget_show (align);
gtk_table_attach (GTK_TABLE (table), align, 0, 3, 2, 3,
GTK_FILL|GTK_EXPAND, 0, 0, 0);
g_object_unref (sg);
pmd->activetrans =
gtk_check_button_new_with_label (_("Make active panel opaque"));
gtk_widget_show (pmd->activetrans);
gtk_container_add (GTK_CONTAINER (align), pmd->activetrans);
g_signal_connect (pmd->activetrans, "toggled",
G_CALLBACK (activetrans_toggled), pmd);
}
}
/* panel selector: add/remove/rename panel */
@ -1465,12 +1474,12 @@ create_panel_selector (PanelManagerDialog *pmd)
GtkWidget *hbox, *img;
int i;
hbox = gtk_hbox_new (FALSE, 0);
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
pmd->panel_selector = gtk_combo_box_new_text ();
gtk_widget_show (pmd->panel_selector);
gtk_box_pack_start (GTK_BOX (hbox), pmd->panel_selector, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pmd->panel_selector, TRUE, TRUE, 0);
for (i = 0; i < pmd->panels->len; ++i)
{
@ -1550,7 +1559,7 @@ void
panel_manager_dialog (GPtrArray *panels)
{
PanelManagerDialog *pmd;
GtkWidget *header, *vbox, *img, *sel, *frame, *hbox;
GtkWidget *header, *vbox, *img, *sel;
Panel *panel;
if (panel_dialog_widget)
@ -1602,36 +1611,18 @@ panel_manager_dialog (GPtrArray *panels)
/* add/remove/rename panel */
sel = create_panel_selector (pmd);
gtk_widget_show (sel);
gtk_box_pack_start (GTK_BOX (vbox), sel, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
gtk_frame_set_label_widget (GTK_FRAME (frame), sel);
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 2 * BORDER);
gtk_container_set_border_width (GTK_CONTAINER (hbox), BORDER);
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (frame), hbox);
/* appearance */
add_appearance_options (GTK_BOX (vbox), pmd);
/* left box */
vbox = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
/* position */
add_position_options (GTK_BOX (vbox), pmd);
/* right box */
vbox = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
/* monitors */
add_monitor_selector (GTK_BOX (vbox), pmd);
/* appearance */
add_appearance_options (GTK_BOX (vbox), pmd);
pmd->updating = FALSE;
/* fill in values */

5
panel/panel-private.h

@ -35,8 +35,9 @@
#define DEFAULT_XOFFSET 0
#define DEFAULT_YOFFSET 0
#define DEFAULT_AUTOHIDE FALSE
#define DEFAULT_FULL_WIDTH FALSE
#define DEFAULT_FULL_WIDTH XFCE_PANEL_NORMAL_WIDTH
#define DEFAULT_TRANSPARENCY 20
#define DEFAULT_ACTIVE_TRANS FALSE
#define PANEL_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_PANEL, PanelPrivate))
@ -64,8 +65,10 @@ struct _PanelPrivate
guint autohide:1;
XfcePanelWidthType full_width;
int transparency;
guint activetrans:1;
guint opacity;
guint saved_opacity;
guint hidden:1;
int block_autohide;

110
panel/panel-properties.c

@ -148,7 +148,7 @@ _set_borders (Panel *panel)
PanelPrivate *priv;
gboolean top, bottom, left, right;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
top = bottom = left = right = TRUE;
@ -235,7 +235,17 @@ _set_struts (Panel *panel, XfceMonitor *xmon, int x, int y, int w, int h)
PanelPrivate *priv;
gulong data[12] = { 0, };
priv = PANEL_GET_PRIVATE (panel);
/* _NET_WM_STRUT_PARTIAL: CARDINAL[12]/32
*
* 0: left 1: right 2: top 3: bottom
* 4: left_start_y 5: left_end_y 6: right_start_y 7: right_end_y
* 8: top_start_x 9: top_end_x 10: bottom_start_x 11: bottom_end_x
*
* Note: In xinerama use struts relative to combined screen dimensions, not
* just the current monitor.
*/
priv = panel->priv;
if (!priv->autohide &&
!xfce_screen_position_is_floating (priv->screen_position))
@ -317,7 +327,7 @@ panel_move_end (XfcePanelWindow *window, int x, int y)
PanelPrivate *priv;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (window);
priv = PANEL (window)->priv;
if (xfce_screen_position_is_floating (priv->screen_position))
{
@ -343,7 +353,7 @@ panel_move_function (XfcePanelWindow *window, Panel *panel, int *x, int *y)
PanelPrivate *priv;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
priv->monitor = gdk_screen_get_monitor_at_point (
gtk_widget_get_screen (GTK_WIDGET (window)), *x, *y);
@ -363,7 +373,7 @@ panel_resize_function (XfcePanelWindow *window, Panel *panel,
PanelPrivate *priv;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
xmon = panel_app_get_monitor (priv->monitor);
@ -388,7 +398,7 @@ panel_set_position (Panel *panel, XfceScreenPosition position,
int x, y;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
xmon = panel_app_get_monitor (priv->monitor);
@ -448,7 +458,7 @@ panel_screen_size_changed (GdkScreen *screen, Panel *panel)
PanelPrivate *priv;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
xmon = panel_app_get_monitor (priv->monitor);
@ -467,7 +477,10 @@ _set_transparent (Panel *panel, gboolean transparent)
PanelPrivate *priv;
guint opacity;
priv = PANEL_GET_PRIVATE (panel);
if (!GTK_WIDGET (panel)->window)
return;
priv = panel->priv;
if (G_UNLIKELY (priv->opacity == 0))
{
@ -478,18 +491,23 @@ _set_transparent (Panel *panel, gboolean transparent)
priv->opacity = OPAQUE;
}
opacity = (transparent ? priv->opacity : OPAQUE);
opacity = (transparent || priv->activetrans) ? priv->opacity : OPAQUE;
gdk_error_trap_push ();
if (opacity != priv->saved_opacity)
{
priv->saved_opacity = opacity;
gdk_error_trap_push ();
gdk_property_change (GTK_WIDGET (panel)->window,
gdk_atom_intern ("_NET_WM_WINDOW_OPACITY", FALSE),
gdk_atom_intern ("CARDINAL", FALSE), 32,
GDK_PROP_MODE_REPLACE, (guchar *) & opacity, 1L);
gdk_property_change (GTK_WIDGET (panel)->window,
gdk_atom_intern ("_NET_WM_WINDOW_OPACITY", FALSE),
gdk_atom_intern ("CARDINAL", FALSE), 32,
GDK_PROP_MODE_REPLACE, (guchar *) & opacity, 1L);
gdk_error_trap_pop ();
gdk_error_trap_pop ();
gtk_widget_queue_draw (GTK_WIDGET (panel));
gtk_widget_queue_draw (GTK_WIDGET (panel));
}
}
static void
@ -498,7 +516,7 @@ _set_hidden (Panel *panel, gboolean hide)
PanelPrivate *priv;
int w, h;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
priv->hidden = hide;
@ -561,7 +579,7 @@ _hide_timeout (Panel *panel)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
priv->hide_timeout = 0;
if (!priv->hidden && !priv->block_autohide)
@ -575,7 +593,7 @@ _unhide_timeout (Panel *panel)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
priv->unhide_timeout = 0;
if (priv->hidden)
@ -593,7 +611,7 @@ panel_enter (Panel *panel, GdkEventCrossing * event)
{
panel_app_set_current_panel ((gpointer)panel);
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (priv->block_autohide)
return;
@ -624,7 +642,7 @@ panel_leave (Panel *panel, GdkEventCrossing * event)
if (event->detail != GDK_NOTIFY_INFERIOR)
{
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (priv->block_autohide)
return;
@ -654,7 +672,7 @@ _window_mapped (Panel *panel)
XfceMonitor *xmon;
int x, y;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
panel_set_position (panel, priv->screen_position,
priv->xoffset, priv->yoffset);
@ -685,7 +703,7 @@ panel_init_position (Panel *panel)
GtkOrientation orientation;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
orientation =
xfce_screen_position_is_horizontal (priv->screen_position) ?
@ -761,7 +779,7 @@ panel_center (Panel *panel)
GtkRequisition req;
XfceMonitor *xmon;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (priv->screen_position < XFCE_SCREEN_POSITION_FLOATING_H)
return;
@ -781,7 +799,7 @@ void panel_set_autohide (Panel *panel, gboolean autohide)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (autohide == priv->autohide)
return;
@ -819,7 +837,7 @@ void panel_block_autohide (Panel *panel)
DBG ("block");
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
priv->block_autohide++;
@ -835,7 +853,7 @@ void panel_unblock_autohide (Panel *panel)
DBG ("unblock");
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (priv->block_autohide > 0)
{
@ -867,7 +885,7 @@ panel_set_full_width (Panel *panel, int fullwidth)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (fullwidth != priv->full_width)
{
@ -918,13 +936,12 @@ panel_set_full_width (Panel *panel, int fullwidth)
}
}
/* not really positioning, but easier to put here */
void
panel_set_transparency (Panel *panel, int transparency)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (transparency != priv->transparency)
{
@ -937,6 +954,19 @@ panel_set_transparency (Panel *panel, int transparency)
}
}
void
panel_set_activetrans (Panel *panel, gboolean activetrans)
{
PanelPrivate *priv = panel->priv;
if (activetrans != priv->activetrans)
{
priv->activetrans = activetrans;
_set_transparent (panel, TRUE);
}
}
/* properties */
int
@ -946,7 +976,7 @@ panel_get_size (Panel *panel)
g_return_val_if_fail (PANEL_IS_PANEL (panel), DEFAULT_SIZE);
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
return priv->size;
}
@ -958,7 +988,7 @@ panel_set_size (Panel *panel, int size)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (size != priv->size)
{
@ -977,7 +1007,7 @@ panel_get_monitor (Panel *panel)
g_return_val_if_fail (PANEL_IS_PANEL (panel), DEFAULT_MONITOR);
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
return priv->monitor;
}
@ -989,7 +1019,7 @@ panel_set_monitor (Panel *panel, int monitor)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (monitor != priv->monitor)
{
@ -1016,7 +1046,7 @@ panel_get_screen_position (Panel *panel)
g_return_val_if_fail (PANEL_IS_PANEL (panel), DEFAULT_SCREEN_POSITION);
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
return priv->screen_position;
}
@ -1028,7 +1058,7 @@ panel_set_screen_position (Panel *panel, XfceScreenPosition position)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (position != priv->screen_position)
{
@ -1100,7 +1130,7 @@ panel_get_xoffset (Panel *panel)
g_return_val_if_fail (PANEL_IS_PANEL (panel), DEFAULT_XOFFSET);
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
return priv->xoffset;
}
@ -1112,7 +1142,7 @@ panel_set_xoffset (Panel *panel, int xoffset)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (xoffset != priv->xoffset)
{
@ -1128,7 +1158,7 @@ panel_get_yoffset (Panel *panel)
g_return_val_if_fail (PANEL_IS_PANEL (panel), DEFAULT_YOFFSET);
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
return priv->yoffset;
}
@ -1140,7 +1170,7 @@ panel_set_yoffset (Panel *panel, int yoffset)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if (yoffset != priv->yoffset)
{

3
panel/panel-properties.h

@ -73,6 +73,9 @@ void panel_set_full_width (Panel *panel,
void panel_set_transparency (Panel *panel,
int transparency);
void panel_set_activetrans (Panel *panel,
gboolean activetrans);
G_END_DECLS
#endif /* _PANEL_POSITION_H */

79
panel/panel.c

@ -57,7 +57,8 @@ enum
PROP_YOFFSET,
PROP_AUTOHIDE,
PROP_FULL_WIDTH,
PROP_TRANSPARENCY
PROP_TRANSPARENCY,
PROP_ACTIVE_TRANS
};
@ -204,10 +205,12 @@ panel_class_init (PanelClass * klass)
g_object_class_install_property (object_class, PROP_AUTOHIDE, pspec);
pspec = g_param_spec_boolean ("fullwidth",
"panel_fullwidth",
"Use the full screen width",
DEFAULT_FULL_WIDTH, G_PARAM_READWRITE);
pspec = g_param_spec_int ("fullwidth",
"panel_fullwidth",
"Use the full screen width",
XFCE_PANEL_NORMAL_WIDTH,
XFCE_PANEL_SPAN_MONITORS,
DEFAULT_FULL_WIDTH, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_FULL_WIDTH, pspec);
@ -218,6 +221,13 @@ panel_class_init (PanelClass * klass)
DEFAULT_TRANSPARENCY, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_TRANSPARENCY, pspec);
pspec = g_param_spec_boolean ("activetrans",
"panel_activetrans",
"Keep the active panel transparent",
DEFAULT_ACTIVE_TRANS, G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_ACTIVE_TRANS, pspec);
}
static void
@ -225,7 +235,7 @@ panel_init (Panel * panel)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv = PANEL_GET_PRIVATE (panel);
priv->size = DEFAULT_SIZE;
priv->monitor = DEFAULT_MONITOR;
@ -235,6 +245,7 @@ panel_init (Panel * panel)
priv->autohide = DEFAULT_AUTOHIDE;
priv->full_width = DEFAULT_FULL_WIDTH;
priv->transparency = DEFAULT_TRANSPARENCY;
priv->activetrans = DEFAULT_ACTIVE_TRANS;
gtk_window_set_title (GTK_WINDOW (panel), "Xfce Panel");
@ -267,6 +278,8 @@ panel_init (Panel * panel)
/* menu */
priv->menu = _panel_create_menu (PANEL (panel));
priv->opacity = priv->saved_opacity = 0;
}
static void
@ -279,11 +292,9 @@ panel_finalize (GObject * object)
static void
panel_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
GValue * value, GParamSpec * pspec)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (object);
PanelPrivate *priv = PANEL(object)->priv;
switch (prop_id)
{
@ -306,11 +317,14 @@ panel_get_property (GObject * object, guint prop_id,
g_value_set_boolean (value, priv->autohide);
break;
case PROP_FULL_WIDTH:
g_value_set_boolean (value, priv->full_width);
g_value_set_int (value, priv->full_width);
break;
case PROP_TRANSPARENCY:
g_value_set_int (value, priv->transparency);
break;
case PROP_ACTIVE_TRANS:
g_value_set_boolean (value, priv->activetrans);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -344,11 +358,14 @@ panel_set_property (GObject * object, guint prop_id,
panel_set_autohide (panel, g_value_get_boolean (value));
break;
case PROP_FULL_WIDTH:
panel_set_full_width (panel, g_value_get_boolean (value));
panel_set_full_width (panel, g_value_get_int (value));
break;
case PROP_TRANSPARENCY:
panel_set_transparency (panel, g_value_get_int (value));
break;
case PROP_ACTIVE_TRANS:
panel_set_activetrans (panel, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -376,7 +393,7 @@ panel_button_pressed (GtkWidget *widget, GdkEventButton *ev)
{
PanelPrivate *priv;
priv = PANEL_GET_PRIVATE (widget);
priv = PANEL (widget)->priv;
gtk_menu_set_screen (GTK_MENU (priv->menu),
gtk_widget_get_screen (widget));
@ -424,7 +441,7 @@ _panel_drag_data_received (GtkWidget *widget, GdkDragContext *context,
x, y);
if (plugin->parent != widget)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
gtk_widget_reparent (plugin, widget);
xfce_panel_item_set_size (XFCE_PANEL_ITEM (plugin),
@ -482,7 +499,7 @@ _panel_drag_begin (GtkWidget *widget, GdkDragContext *drag_context,
int x, y, rootx, rooty, w, h;
GtkWidget *plugin;
GdkPixbuf *pb;
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
DBG (" + drag begin");
@ -526,7 +543,7 @@ static void
_panel_drag_end (GtkWidget *widget, GdkDragContext *drag_context,
Panel *panel)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
priv->drag_widget = NULL;
@ -539,7 +556,7 @@ _panel_drag_end (GtkWidget *widget, GdkDragContext *drag_context,
{
Panel *p = g_ptr_array_index (panels, i);
priv = PANEL_GET_PRIVATE (p);
priv = p->priv;
xfce_itembar_lower_event_window (XFCE_ITEMBAR (priv->itembar));
panel_dnd_unset_dest (priv->itembar);
@ -558,7 +575,7 @@ _panel_drag_data_get (GtkWidget *widget, GdkDragContext *drag_context,
{
if (info == TARGET_PLUGIN_WIDGET)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
if (priv->drag_widget)
{
@ -571,7 +588,7 @@ static void
_panel_drag_data_delete (GtkWidget *widget, GdkDragContext *drag_context,
Panel *panel)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
if (priv->drag_widget)
xfce_panel_item_remove (XFCE_PANEL_ITEM (priv->drag_widget));
@ -606,7 +623,7 @@ _panel_itembar_button_pressed (GtkWidget *widget, GdkEventButton *ev,
}
else if (ev->button == 1)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
priv->drag_widget =
xfce_itembar_get_item_at_point (XFCE_ITEMBAR (widget),
@ -683,8 +700,8 @@ _panel_create_menu (Panel *panel)
gtk_widget_show (img);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), img);
g_signal_connect (mi, "activate", G_CALLBACK (panel_app_about),
NULL);
g_signal_connect_swapped (mi, "activate", G_CALLBACK (panel_app_about),
panel);
return menu;
}
@ -706,7 +723,7 @@ panel_free_data (Panel *panel)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
for (l = gtk_container_get_children (GTK_CONTAINER (priv->itembar));
l != NULL; l = l->next)
@ -741,7 +758,7 @@ _item_expand_changed (GtkWidget *item, gboolean expand, Panel *panel)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
xfce_itembar_set_child_expand (XFCE_ITEMBAR (priv->itembar), item, expand);
}
@ -757,7 +774,7 @@ _item_start_move (GtkWidget *item, Panel *panel)
{
Panel *p = g_ptr_array_index (panels, i);
priv = PANEL_GET_PRIVATE (p);
priv = p->priv;
if (!priv->edit_mode)
{
@ -771,7 +788,7 @@ _item_start_move (GtkWidget *item, Panel *panel)
}
}
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
priv->drag_widget = item;
panel_dnd_begin_drag (priv->itembar);
@ -783,7 +800,7 @@ panel_create_item (Panel *panel, const char *name, const char *id)
PanelPrivate *priv;
GtkWidget *item = NULL;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
if ((item = xfce_panel_item_manager_create_item (name, id,
priv->size, priv->screen_position)) != NULL)
@ -813,7 +830,7 @@ panel_create_item (Panel *panel, const char *name, const char *id)
static void
panel_insert_widget (Panel *panel, GtkWidget *item, int position)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
gtk_widget_show (item);
@ -887,7 +904,7 @@ panel_get_item_config_list (Panel * panel)
GList *children, *l;
int len, i;
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
children = gtk_container_get_children (GTK_CONTAINER (priv->itembar));
@ -921,7 +938,7 @@ panel_save_items (Panel *panel)
g_return_if_fail (PANEL_IS_PANEL (panel));
priv = PANEL_GET_PRIVATE (panel);
priv = panel->priv;
gtk_container_foreach (GTK_CONTAINER (priv->itembar),
(GtkCallback)xfce_panel_item_save, NULL);
@ -939,7 +956,7 @@ panel_is_horizontal (Panel *panel)
void
panel_set_items_sensitive (Panel *panel, gboolean sensitive)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
PanelPrivate *priv = panel->priv;
GList *l, *children;
children = gtk_container_get_children (GTK_CONTAINER (priv->itembar));

2
panel/panel.h

@ -46,6 +46,8 @@ typedef struct _XfcePanelItemConfig XfcePanelItemConfig;
struct _Panel
{
XfcePanelWindow parent;
/*< private >*/
gpointer priv;
};
struct _PanelClass

504
plugins/windowlist/windowlist.c

@ -6,6 +6,7 @@
* Copyright © 2003 Benedikt Meurer <benedikt.meurer@unix-ag.uni-siegen.de>
* Copyright © 2006 Jani Monoses <jani@ubuntu.com>
* Copyright © 2006 Jasper Huijsmans <jasper@xfce.org>
* Copyright © 2006 Nick Schermer <nick@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
@ -29,48 +30,53 @@
#include <gtk/gtk.h>
#include <libxfcegui4/libxfcegui4.h>
#include <libxfcegui4/netk-window-action-menu.h>
#include <libxfce4panel/xfce-panel-plugin.h>
typedef struct
{
XfcePanelPlugin *plugin;
GtkWidget *windowlist;
GtkWidget *button;
GtkWidget *img;
NetkScreen *screen;
gboolean show_all_workspaces;
gboolean show_windowlist_icons;
int screen_callback_id;
gboolean all_workspaces;
GtkTooltips *tooltips;
}
Windowlist;
/* Panel Plugin Interface */
/**
* REGISTER PLUGIN
**/
static void windowlist_construct (XfcePanelPlugin * plugin);
XFCE_PANEL_PLUGIN_REGISTER_INTERNAL (windowlist_construct);
/* internal functions */
/**
* MENU FUNCTIONS
**/
static void
action_menu_deactivated (GtkMenu *menu, GtkMenu *parent)
action_menu_deactivated (GtkMenu *menu,
GtkMenu *parent)
{
gtk_menu_popdown (parent);
g_signal_emit_by_name (parent, "deactivate", 0);
}
static void
popup_action_menu (GtkWidget * widget, gpointer data)
popup_action_menu (GtkWidget * widget,
gpointer data)
{
NetkWindow *win = data;
static GtkWidget *menu = NULL;
if (menu)
{
gtk_widget_destroy (menu);
}
gtk_widget_destroy (menu);
menu = netk_create_window_action_menu (win);
@ -82,17 +88,20 @@ popup_action_menu (GtkWidget * widget, gpointer data)
}
static gboolean
menu_item_clicked (GtkWidget * item, GdkEventButton * ev, gpointer data)
menu_item_clicked (GtkWidget *mi,
GdkEventButton * ev,
gpointer data)
{
NetkWindow *win = data;
NetkWindow *netk_window = data;
if (ev->button == 1)
{
netk_window_activate (win);
netk_workspace_activate(netk_window_get_workspace(netk_window));
netk_window_activate (netk_window);
}
else if (ev->button == 3)
{
popup_action_menu (item, win);
popup_action_menu (mi, netk_window);
return TRUE;
}
@ -108,266 +117,320 @@ set_num_screens (gpointer num)
/* the following two functions are based on xfdesktop code */
static GtkWidget *
create_menu_item (NetkWindow * win, Windowlist * wl)
create_menu_item (NetkWindow * window,
Windowlist * wl,
gint icon_width,
gint icon_height)
{
const char *wname = NULL;
GtkWidget *item;
const char *window_name = NULL;
GtkWidget *mi;
GString *label;
GdkPixbuf *icon, *tmp = NULL;
GdkPixbuf *icon = NULL, *tmp = NULL;
gboolean truncated = FALSE;
if (netk_window_is_skip_pager (win) || netk_window_is_skip_tasklist (win))
if (netk_window_is_skip_pager (window) || netk_window_is_skip_tasklist (window))
return NULL;
wname = netk_window_get_name (win);
label = g_string_new (wname);
window_name = netk_window_get_name (window);
label = g_string_new (window_name);
if (label->len >= 20)
{
g_string_truncate (label, 20);
g_string_append (label, " ...");
truncated = TRUE;
}
if (netk_window_is_minimized (win))
if (netk_window_is_minimized (window))
{
g_string_prepend (label, "[");
g_string_append (label, "]");
}
/* Italic fonts are not completely shown */
g_string_append (label, " ");
if (wl->show_windowlist_icons)
icon = netk_window_get_icon (window);
icon = netk_window_get_icon (win);
if (icon)
{
GtkWidget *img;
gint w, h;
w = gdk_pixbuf_get_width (icon);
h = gdk_pixbuf_get_height (icon);
w = gdk_pixbuf_get_width (tmp);
h = gdk_pixbuf_get_height (tmp);
if (w != 24 || h != 24)
if (w != icon_width || h != icon_height)
{
tmp = gdk_pixbuf_scale_simple (icon, 24, 24, GDK_INTERP_BILINEAR);
tmp = gdk_pixbuf_scale_simple (icon, icon_width, icon_height, GDK_INTERP_BILINEAR);
icon = tmp;
}
item = gtk_image_menu_item_new_with_label (label->str);
gtk_widget_show (item);
mi = gtk_image_menu_item_new_with_label (label->str);
img = gtk_image_new_from_pixbuf (icon);
gtk_widget_show (img);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), img);
if (tmp)
g_object_unref (tmp);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), img);
if (tmp)
g_object_unref (tmp);
}
else
{
item = gtk_menu_item_new_with_label (label->str);
mi = gtk_menu_item_new_with_label (label->str);
}
gtk_tooltips_set_tip (wl->tooltips, item, wname, NULL);
if (truncated)
gtk_tooltips_set_tip (wl->tooltips, mi, window_name, NULL);
g_string_free (label, TRUE);
return item;
return mi;
}