[gnome-applets/wip/windowpicker] windowpicker: use GdkMonitor
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/windowpicker] windowpicker: use GdkMonitor
- Date: Sat, 15 Dec 2018 16:30:33 +0000 (UTC)
commit 6c452512ded9fda58c392a82a43c7e86ac4bf72c
Author: Sebastian Geiger <sbastig gmx net>
Date: Fri Dec 14 16:56:26 2018 +0100
windowpicker: use GdkMonitor
windowpicker/src/task-item.c | 26 ++++++++++++++------------
windowpicker/src/task-item.h | 8 +++++---
windowpicker/src/task-list.c | 42 +++++++++++++++++++++---------------------
windowpicker/src/task-list.h | 6 +++---
4 files changed, 43 insertions(+), 39 deletions(-)
---
diff --git a/windowpicker/src/task-item.c b/windowpicker/src/task-item.c
index 3bb52a2c3..1a3c1c58b 100644
--- a/windowpicker/src/task-item.c
+++ b/windowpicker/src/task-item.c
@@ -43,7 +43,7 @@ struct _TaskItemPrivate {
GTimeVal urgent_time;
guint blink_timer;
gboolean mouse_over;
- gint monitor;
+ GdkMonitor *monitor;
WpApplet *windowPickerApplet;
};
@@ -488,22 +488,23 @@ on_window_type_changed (WnckWindow *window,
}
}
-static gint
+static GdkMonitor *
get_window_monitor (WnckWindow *window)
{
gint x;
gint y;
gint w;
gint h;
- gint window_monitor;
- GdkScreen *gdk_screen;
+ GdkMonitor *window_monitor;
+ GdkDisplay *gdk_display;
wnck_window_get_geometry (window, &x, &y, &w, &h);
- gdk_screen = gdk_screen_get_default ();
- window_monitor = gdk_screen_get_monitor_at_point (gdk_screen,
- x + w / 2,
- y + h / 2);
+ gdk_display = gdk_display_get_default ();
+ window_monitor = gdk_display_get_monitor_at_point (gdk_display,
+ x + w / 2,
+ y + h / 2);
+
return window_monitor;
}
@@ -511,8 +512,8 @@ static void
on_window_geometry_changed (WnckWindow *window,
TaskItem *item)
{
- gint old_monitor;
- gint window_monitor;
+ GdkMonitor *old_monitor;
+ GdkMonitor *window_monitor;
window_monitor = get_window_monitor (window);
@@ -855,7 +856,7 @@ static void task_item_class_init (TaskItemClass *klass) {
task_item_signals [TASK_ITEM_MONITOR_CHANGED] =
g_signal_new ("monitor-changed", TASK_TYPE_ITEM, G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_INT);
+ 0, NULL, NULL, NULL, G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
}
static void task_item_init (TaskItem *item) {
@@ -967,7 +968,8 @@ GtkWidget *task_item_new (WpApplet* windowPickerApplet, WnckWindow *window) {
return item;
}
-gint task_item_get_monitor (TaskItem *item)
+GdkMonitor *
+task_item_get_monitor (TaskItem *item)
{
return item->priv->monitor;
}
diff --git a/windowpicker/src/task-item.h b/windowpicker/src/task-item.h
index 666513da8..513d292ee 100644
--- a/windowpicker/src/task-item.h
+++ b/windowpicker/src/task-item.h
@@ -48,9 +48,11 @@ struct _TaskItemClass {
void (* itemclosed) (TaskItem *item);
};
-GType task_item_get_type (void) G_GNUC_CONST;
-GtkWidget * task_item_new (WpApplet *windowPickerApplet, WnckWindow *window);
+GType task_item_get_type (void) G_GNUC_CONST;
-gint task_item_get_monitor (TaskItem *item);
+GtkWidget *task_item_new (WpApplet *windowPickerApplet,
+ WnckWindow *window);
+
+GdkMonitor *task_item_get_monitor (TaskItem *item);
#endif /* _TASK_ITEM_H_ */
diff --git a/windowpicker/src/task-list.c b/windowpicker/src/task-list.c
index 0836622a7..ed17f27e0 100644
--- a/windowpicker/src/task-list.c
+++ b/windowpicker/src/task-list.c
@@ -36,11 +36,11 @@ G_DEFINE_TYPE_WITH_PRIVATE (TaskList, task_list, GTK_TYPE_BOX);
static GSList *task_lists;
static TaskList *
-get_task_list_for_monitor (TaskList *task_list,
- gint monitor)
+get_task_list_for_monitor (TaskList *task_list,
+ GdkMonitor *monitor)
{
GSList *list;
- gint list_monitor;
+ GdkMonitor *list_monitor;
list = task_lists;
@@ -67,19 +67,19 @@ static void on_task_item_closed (
GTK_WIDGET (item));
}
-static gint
+static GdkMonitor *
window_get_monitor (WnckWindow *window)
{
- GdkScreen *gdk_screen;
+ GdkDisplay *gdk_display;
gint x, y, w, h;
- gdk_screen = gdk_screen_get_default ();
+ gdk_display = gdk_display_get_default ();
wnck_window_get_geometry (window, &x, &y, &w, &h);
- return gdk_screen_get_monitor_at_point (gdk_screen,
- x + w / 2,
- y + h / 2);
+ return gdk_display_get_monitor_at_point (gdk_display,
+ x + w / 2,
+ y + h / 2);
}
static void
@@ -87,8 +87,8 @@ on_task_item_monitor_changed_cb (TaskItem *item,
gint old_monitor,
TaskList *current_list)
{
- gint monitor;
- gint list_monitor;
+ GdkMonitor *monitor;
+ GdkMonitor *list_monitor;
TaskList *list;
monitor = task_item_get_monitor (item);
@@ -122,8 +122,8 @@ static void create_task_item (TaskList *taskList,
WnckWindow *window)
{
GtkWidget *item;
- gint list_monitor;
- gint window_monitor;
+ GdkMonitor *list_monitor;
+ GdkMonitor *window_monitor;
guint num;
num = g_slist_length (task_lists);
@@ -224,13 +224,13 @@ on_monitors_changed (gpointer user_data)
{
TaskList *list;
GdkWindow *window;
- gint list_monitor;
+ GdkMonitor *list_monitor;
list = user_data;
window = gtk_widget_get_window (GTK_WIDGET (list));
- list_monitor = gdk_screen_get_monitor_at_window (gdk_screen_get_default (),
- window);
+ list_monitor = gdk_display_get_monitor_at_window (gdk_display_get_default (),
+ window);
if (task_list_get_monitor (list) == list_monitor)
gtk_container_foreach (GTK_CONTAINER (list), remove_task_item, list);
@@ -367,15 +367,15 @@ GtkWidget *task_list_new (WpApplet *windowPickerApplet) {
return (GtkWidget *) taskList;
}
-gint
+GdkMonitor *
task_list_get_monitor (TaskList *list)
{
- GdkScreen *gdk_screen;
+ GdkDisplay *gdk_display;
GdkWindow *gdk_window;
+ gdk_display = gdk_display_get_default ();
gdk_window = gtk_widget_get_window (GTK_WIDGET (list));
- gdk_screen = gtk_widget_get_screen (GTK_WIDGET (list));
- return gdk_screen_get_monitor_at_window (gdk_screen,
- gdk_window);
+ return gdk_display_get_monitor_at_window (gdk_display,
+ gdk_window);
}
diff --git a/windowpicker/src/task-list.h b/windowpicker/src/task-list.h
index 582c89bbf..ea37cc1da 100644
--- a/windowpicker/src/task-list.h
+++ b/windowpicker/src/task-list.h
@@ -55,9 +55,9 @@ struct _TaskListClass {
GtkBoxClass parent_class;
};
-GType task_list_get_type (void) G_GNUC_CONST;
+GType task_list_get_type (void) G_GNUC_CONST;
-GtkWidget *task_list_new (WpApplet *applet);
-gint task_list_get_monitor (TaskList *list);
+GtkWidget *task_list_new (WpApplet *applet);
+GdkMonitor *task_list_get_monitor (TaskList *list);
#endif /* _TASK_LIST_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]