summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <fourdan.olivier@wanadoo.fr>2008-11-02 17:45:46 +0000
committerOlivier Fourdan <fourdan.olivier@wanadoo.fr>2008-11-02 17:45:46 +0000
commitb85476db5d6b4766c5a1801680e035e751151937 (patch)
tree9b7b5432736ef940c3cb7d38211bead124a91cfa
parent05a3739faf5b962ef14ce935e7e300518d3673c7 (diff)
downloadxfwm4-b85476db5d6b4766c5a1801680e035e751151937.tar.gz
* settings-dialogs/xfwm4-tweaks-dialog.glade,
settings-dialogs/tweaks-settings.c, src/settings.c, src/settings.h, src/client.c, src/client.h, defaults/defaults: Add new option do disable blinking of urgent windows. (Old svn revision: 28585)
-rw-r--r--ChangeLog7
-rw-r--r--NEWS1
-rw-r--r--defaults/defaults3
-rw-r--r--settings-dialogs/tweaks-settings.c29
-rw-r--r--settings-dialogs/xfwm4-tweaks-dialog.glade47
-rw-r--r--src/client.c61
-rw-r--r--src/client.h2
-rw-r--r--src/settings.c7
-rw-r--r--src/settings.h1
9 files changed, 113 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 80e3d1995..a47730f61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-11-02 olivier
+
+ * settings-dialogs/xfwm4-tweaks-dialog.glade,
+ settings-dialogs/tweaks-settings.c, src/settings.c, src/settings.h,
+ src/client.c, src/client.h, defaults/defaults: Add new option do
+ disable blinking of urgent windows.
+
2008-10-30 olivier
* settings-dialogs/xfwm4-settings.c: Fix compiler warnings
diff --git a/NEWS b/NEWS
index 9fdc0ade9..811a3ace1 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
- Rework the window menu to improve consistency with libwnck menu (Bug #4531).
- Simplify management of transients.
- Add support for keyboard shortcuts (Bug #4492).
+- Add new option do disable blinking of urgent windows.
4.5.91 (Xfce 4.6beta1)
======================
diff --git a/defaults/defaults b/defaults/defaults
index 2b6545ddb..56a4f799a 100644
--- a/defaults/defaults
+++ b/defaults/defaults
@@ -29,7 +29,7 @@ raise_delay=250
raise_on_click=true
raise_on_focus=false
raise_with_any_button=true
-repeat_urgent_blink=true
+repeat_urgent_blink=false
resize_opacity=100
restore_on_move=true
scroll_workspaces=true
@@ -56,6 +56,7 @@ title_vertical_offset_active=0
title_vertical_offset_inactive=0
toggle_workspaces=false
unredirect_overlays=true
+urgent_blink=false
use_compositing=false
workspace_count=4
wrap_cycle=true
diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index bec7d6cbd..4bb241cc4 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2008 Stephan Arts <stephan@xfce.org>
* Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
+ * Copyright (c) 2008 Olivier Fourdan <olivier@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -128,6 +129,13 @@ cb_activate_placement_mouse_radio_toggled (GtkToggleButton *toggle, XfconfChanne
}
static void
+cb_urgent_blink_button_toggled (GtkToggleButton *toggle, GtkWidget *repeat_urgent_blink)
+{
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (repeat_urgent_blink), FALSE);
+ gtk_widget_set_sensitive (repeat_urgent_blink, gtk_toggle_button_get_active (toggle));
+}
+
+static void
wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
{
GtkWidget *vbox;
@@ -150,7 +158,6 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
/* Focus tab */
GtkWidget *prevent_focus_stealing_check = glade_xml_get_widget (gxml, "prevent_focus_stealing_check");
GtkWidget *focus_hint_check = glade_xml_get_widget (gxml, "focus_hint_check");
- GtkWidget *repeat_urgent_blink = glade_xml_get_widget (gxml, "repeat_urgent_blink");
GtkWidget *activate_action_bring_option = glade_xml_get_widget (gxml, "activate_action_bring_option");
GtkWidget *activate_action_switch_option = glade_xml_get_widget (gxml, "activate_action_switch_option");
@@ -162,6 +169,8 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
GtkWidget *borderless_maximize_check = glade_xml_get_widget (gxml, "borderless_maximize_check");
GtkWidget *restore_on_move_check = glade_xml_get_widget (gxml, "restore_on_move_check");
GtkWidget *snap_resist_check = glade_xml_get_widget (gxml, "snap_resist_check");
+ GtkWidget *urgent_blink = glade_xml_get_widget (gxml, "urgent_blink");
+ GtkWidget *repeat_urgent_blink = glade_xml_get_widget (gxml, "repeat_urgent_blink");
/* Workspaces tab */
GtkWidget *scroll_workspaces_check = glade_xml_get_widget (gxml, "scroll_workspaces_check");
@@ -265,6 +274,10 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
"changed",
G_CALLBACK (cb_easy_click_combo_box_changed),
xfwm4_channel);
+ g_signal_connect (G_OBJECT (urgent_blink),
+ "toggled",
+ G_CALLBACK (cb_urgent_blink_button_toggled),
+ repeat_urgent_blink);
/* Bind easy properties */
/* Cycling tab */
@@ -294,10 +307,6 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
"/general/focus_hint",
G_TYPE_BOOLEAN,
(GObject *)focus_hint_check, "active");
- xfconf_g_property_bind (xfwm4_channel,
- "/general/repeat_urgent_blink",
- G_TYPE_BOOLEAN,
- (GObject *)repeat_urgent_blink, "active");
/* Accessibility tab */
xfconf_g_property_bind (xfwm4_channel,
@@ -316,6 +325,16 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
"/general/snap_resist",
G_TYPE_BOOLEAN,
(GObject *)snap_resist_check, "active");
+ xfconf_g_property_bind (xfwm4_channel,
+ "/general/urgent_blink",
+ G_TYPE_BOOLEAN,
+ (GObject *)urgent_blink, "active");
+ xfconf_g_property_bind (xfwm4_channel,
+ "/general/repeat_urgent_blink",
+ G_TYPE_BOOLEAN,
+ (GObject *)repeat_urgent_blink, "active");
+ gtk_widget_set_sensitive (repeat_urgent_blink,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (urgent_blink)));
/* Workspaces tab */
xfconf_g_property_bind (xfwm4_channel,
diff --git a/settings-dialogs/xfwm4-tweaks-dialog.glade b/settings-dialogs/xfwm4-tweaks-dialog.glade
index fa978d25a..126802d6c 100644
--- a/settings-dialogs/xfwm4-tweaks-dialog.glade
+++ b/settings-dialogs/xfwm4-tweaks-dialog.glade
@@ -132,21 +132,6 @@ or "skip taskbar" properties set</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="repeat_urgent_blink">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Keep urgent windows blinking</property>
- <property name="use_underline">True</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
<widget class="GtkVBox" id="prevent_focus_stealing_box">
<property name="visible">True</property>
<property name="spacing">6</property>
@@ -219,7 +204,7 @@ or "skip taskbar" properties set</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -338,6 +323,36 @@ or "skip taskbar" properties set</property>
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <widget class="GtkCheckButton" id="urgent_blink">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Notify of _urgency by making window's decoration blink</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="repeat_urgent_blink">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Keep urgent windows _blinking repeatedly</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">2</property>
diff --git a/src/client.c b/src/client.c
index d4312ede6..a0d7c503e 100644
--- a/src/client.c
+++ b/src/client.c
@@ -353,31 +353,48 @@ urgent_cb (gpointer data)
if (c != clientGetFocus ())
{
- c->blink_iterations++;
- if (c->blink_iterations < (2 * MAX_BLINK_ITERATIONS + 1))
- {
- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
- frameQueueDraw (c, FALSE);
- }
- else if (c->blink_iterations > (8 * MAX_BLINK_ITERATIONS))
- {
- /*
- * A bit of hack. Instead of removing the callback
- * if "repeat_urgent_blink" is unset, we simply reset
- * the number of iterations at a higher value so that
- * it does not blink.
- * This way, if the user changes the setting later on,
- * we don't have to go through all windows to reinstall
- * the callbacks...
- */
- if (!screen_info->params->repeat_urgent_blink)
- {
- c->blink_iterations = 2 * MAX_BLINK_ITERATIONS;
- }
- else
+ /*
+ * If we do not blink on urgency, check if the window was last
+ * drawn focused and redraw it unfocused.
+ * This is for th case when the tuser changes the settings
+ * in between two redraws.
+ */
+ if (!screen_info->params->urgent_blink)
+ {
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE))
+ {
+ FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
+ frameQueueDraw (c, FALSE);
+ }
+
+ if (c->blink_iterations)
{
c->blink_iterations = 0;
}
+ return TRUE;
+ }
+ /*
+ * If we blink on urgency, check if we've not reach the number
+ * of iterations and if not, simply change the status and redraw
+ */
+ if (c->blink_iterations < (2 * MAX_BLINK_ITERATIONS))
+ {
+ c->blink_iterations++;
+ FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
+ frameQueueDraw (c, FALSE);
+ return TRUE;
+ }
+ /*
+ * If we reached the max number of iterations, check if we
+ * repeat. If repeat_urgent_blink is set, redraw the frame and
+ * restart counting from 1
+ */
+ if (screen_info->params->repeat_urgent_blink)
+ {
+ FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
+ frameQueueDraw (c, FALSE);
+ c->blink_iterations = 1;
+ return TRUE;
}
}
else if (c->blink_iterations)
diff --git a/src/client.h b/src/client.h
index f40cf04ef..0f5c48d44 100644
--- a/src/client.h
+++ b/src/client.h
@@ -102,7 +102,7 @@
#endif
#ifndef CLIENT_BLINK_TIMEOUT
-#define CLIENT_BLINK_TIMEOUT 200 /* ms */
+#define CLIENT_BLINK_TIMEOUT 500 /* ms */
#endif
#ifndef CLIENT_PING_TIMEOUT
diff --git a/src/settings.c b/src/settings.c
index db0d99996..b1d16991d 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -693,6 +693,7 @@ loadSettings (ScreenInfo *screen_info)
{"title_vertical_offset_inactive", NULL, G_TYPE_INT, TRUE},
{"toggle_workspaces", NULL, G_TYPE_BOOLEAN, TRUE},
{"unredirect_overlays", NULL, G_TYPE_BOOLEAN, TRUE},
+ {"urgent_blink", NULL, G_TYPE_BOOLEAN, TRUE},
{"use_compositing", NULL, G_TYPE_BOOLEAN, TRUE},
{"workspace_count", NULL, G_TYPE_INT, TRUE},
{"wrap_cycle", NULL, G_TYPE_BOOLEAN, TRUE},
@@ -812,6 +813,8 @@ loadSettings (ScreenInfo *screen_info)
getBoolValue ("raise_with_any_button", rc);
screen_info->params->repeat_urgent_blink =
getBoolValue ("repeat_urgent_blink", rc);
+ screen_info->params->urgent_blink =
+ getBoolValue ("urgent_blink", rc);
screen_info->params->restore_on_move =
getBoolValue ("restore_on_move", rc);
screen_info->params->frame_opacity =
@@ -1239,6 +1242,10 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
{
screen_info->params->repeat_urgent_blink = g_value_get_boolean (value);
}
+ else if (!strcmp (name, "urgent_blink"))
+ {
+ screen_info->params->urgent_blink = g_value_get_boolean (value);
+ }
else if (!strcmp (name, "snap_to_border"))
{
screen_info->params->snap_to_border = g_value_get_boolean (value);
diff --git a/src/settings.h b/src/settings.h
index 94071f348..64e0d9766 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -217,6 +217,7 @@ struct _XfwmParams
gboolean title_vertical_offset_inactive;
gboolean toggle_workspaces;
gboolean unredirect_overlays;
+ gboolean urgent_blink;
gboolean use_compositing;
gboolean wrap_cycle;
gboolean wrap_layout;