Fix taskbar visibility update after taskbar options changed.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 19 Nov 2016 13:02:05 +0000 (15:02 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Sat, 19 Nov 2016 13:02:05 +0000 (15:02 +0200)
Update visibility on each window was missing in TaskButton.

plugins/launchtaskbar.c
plugins/task-button.c

index fae9e8d..6234b11 100644 (file)
@@ -2283,6 +2283,8 @@ static void taskbar_property_notify_event(LaunchTaskBarPlugin *tb, XEvent *ev)
                     get_net_wm_state(win, &nws);
                     if ( ! accept_net_wm_state(&nws))
                         task_button_drop_window(tk, win, FALSE);
+                    /* else
+                        task_button_window_state_changed(tk, win, nws); */
                 }
                 else if (at == a_NET_WM_WINDOW_TYPE)
                 {
index 74359ee..6f10277 100644 (file)
@@ -145,6 +145,7 @@ static gboolean task_has_urgency(Window win)
             result = TRUE;
         XFree(hints);
     }
+    //FIXME: also test _NET_WM_STATE_DEMANDS_ATTENTION flag in _NET_WM_STATE
     return result;
 }
 
@@ -235,6 +236,7 @@ static TaskDetails *task_details_for_window(TaskButton *button, Window win)
     task_update_icon(button, details, None);
     details->urgency = task_has_urgency(win);
     details->iconified = (get_wm_state(win) == IconicState);
+    // FIXME: may want _NET_WM_STATE check
     // FIXME: check if task is focused
     /* check task visibility by flags */
     details->visible = task_is_visible(button, details);
@@ -542,7 +544,7 @@ static gboolean task_button_window_do_release_event(GtkWidget *tb, TaskDetails *
         /* Middle button.  Toggle the shaded state of the window. */
         Xclimsgx(GDK_SCREEN_XSCREEN(gtk_widget_get_screen(tb)),
                 task->win, a_NET_WM_STATE,
-                2,      /* a_NET_WM_STATE_TOGGLE */
+                a_NET_WM_STATE_TOGGLE,
                 a_NET_WM_STATE_SHADED,
                 0, 0, 0);
     }
@@ -1183,6 +1185,7 @@ static gboolean task_update_visibility(TaskButton *task)
     for (l = task->details; l; l = l->next)
     {
         details = l->data;
+        details->visible = task_is_visible(task, details);
         if (!details->visible)
             continue;
         if (details->monitor == task->monitor && !details->iconified)
@@ -1629,6 +1632,25 @@ gboolean task_button_window_xprop_changed(TaskButton *button, Window win, Atom a
     return TRUE;
 }
 
+/* gboolean task_button_window_state_changed(TaskButton *button, Window win, NetWMState nws)
+{
+    TaskDetails *details;
+
+    g_return_val_if_fail(PANEL_IS_TASK_BUTTON(button), FALSE);
+
+    details = task_details_lookup(button, win);
+    if (details == NULL)
+        return FALSE;
+
+    details->iconified = nws.hidden;
+    g_debug("is hidden: %d",nws.hidden);
+    details->visible = task_is_visible(button, details);
+    if (task_update_visibility(button))
+        task_redraw_label(button);
+
+    return TRUE;
+} */
+
 gboolean task_button_window_focus_changed(TaskButton *button, Window *win)
 {
     GList *l;