[gnome-applets/wip/segeiger/type-changed] task-list: Only show windows from list's monitor
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/type-changed] task-list: Only show windows from list's monitor
- Date: Fri, 22 Jan 2016 10:18:26 +0000 (UTC)
commit fe719c285a3aea5c6c0b1f9265e299d4c199088f
Author: Sebastian Geiger <sbastig gmx net>
Date: Thu Jan 21 14:51:00 2016 +0100
task-list: Only show windows from list's monitor
* This patch makes a given tasklist ignore windows that
are not on the same monitor as the tasklist, if there is more than one
task list added to gnome-panel.
windowpicker/src/task-list.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/windowpicker/src/task-list.c b/windowpicker/src/task-list.c
index f9229b3..076097a 100644
--- a/windowpicker/src/task-list.c
+++ b/windowpicker/src/task-list.c
@@ -29,6 +29,8 @@ struct _TaskListPrivate {
WpApplet *windowPickerApplet;
};
+static GSList *task_lists;
+
G_DEFINE_TYPE_WITH_PRIVATE (TaskList, task_list, GTK_TYPE_BOX);
static void on_task_item_closed (
@@ -45,6 +47,35 @@ static void on_task_item_closed (
static void create_task_item (TaskList *taskList,
WnckWindow *window)
{
+ GdkScreen *gdk_screen;
+ GdkWindow *gdk_window;
+ gint list_monitor, window_monitor;
+ gint x, y, w, h;
+
+ if (g_slist_length (task_lists) > 1) {
+ g_message ("[task_list] Number of task_lists: %d",
+ g_slist_length (task_lists));
+ // we have more than one tasklist running, so only show items
+ // of the current monitor on this task_list
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (taskList));
+ gdk_screen = gtk_widget_get_screen (GTK_WIDGET (taskList));
+ list_monitor = gdk_screen_get_monitor_at_window (gdk_screen,
+ gdk_window);
+
+ g_message ("[task_list] list_monitor=%d", list_monitor);
+
+ wnck_window_get_geometry (window, &x, &y, &w, &h);
+ /* Don't include the window if its center point is not on the same monitor */
+
+ window_monitor = gdk_screen_get_monitor_at_point (gdk_screen,
+ x + w / 2,
+ y + h / 2);
+
+ g_message ("[task_list] window_monitor=%d", window_monitor);
+ if (list_monitor != window_monitor)
+ return;
+ }
+
GtkWidget *item = task_item_new (taskList->priv->windowPickerApplet,
window);
@@ -121,6 +152,8 @@ task_list_dispose (GObject *object)
static void
task_list_finalize (GObject *object)
{
+ task_lists = g_slist_remove (task_lists, object);
+
G_OBJECT_CLASS (task_list_parent_class)->finalize (object);
}
@@ -159,6 +192,8 @@ GtkWidget *task_list_new (WpApplet *windowPickerApplet) {
NULL
);
+ task_lists = g_slist_append (task_lists, taskList);
+
taskList->priv->windowPickerApplet = windowPickerApplet;
g_signal_connect(PANEL_APPLET(windowPickerApplet), "change-orient",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]