Commit dbec3c4a authored by Paolo Bacchilega's avatar Paolo Bacchilega

added utility function: _gtk_widget_get_monitor_geometry

parent 2238e242
......@@ -26,6 +26,7 @@
#include "gth-main.h"
#include "gth-tags-entry.h"
#include "gth-tags-file.h"
#include "gtk-utils.h"
#define EXPANDED_LIST_HEIGHT 160
......@@ -1005,9 +1006,7 @@ popup_window_show (GthTagsEntry *self)
int y;
GtkAllocation allocation;
int selector_height;
GdkScreen *screen;
gint monitor_num;
cairo_rectangle_int_t monitor;
GdkRectangle monitor;
GdkDevice *device;
GdkDevice *pointer;
GdkDevice *keyboard;
......@@ -1022,10 +1021,7 @@ popup_window_show (GthTagsEntry *self)
popup_req.width = allocation.width;
popup_req.height = POPUP_WINDOW_HEIGHT;
screen = gtk_widget_get_screen (GTK_WIDGET (self));
monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (self)));
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
_gtk_widget_get_monitor_geometry (GTK_WIDGET (self), &monitor);
if (x < monitor.x)
x = monitor.x;
else if (x + popup_req.width > monitor.x + monitor.width)
......
......@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include "glib-utils.h"
#include "gth-time-selector.h"
#include "gtk-utils.h"
enum {
......@@ -236,9 +237,7 @@ show_calendar_popup (GthTimeSelector *self)
int y;
GtkAllocation allocation;
int selector_height;
GdkScreen *screen;
gint monitor_num;
cairo_rectangle_int_t monitor;
GdkRectangle monitor;
GdkDevice *device;
GdkDevice *pointer;
GdkDevice *keyboard;
......@@ -253,10 +252,7 @@ show_calendar_popup (GthTimeSelector *self)
y += allocation.y;
selector_height = allocation.height;
screen = gtk_widget_get_screen (GTK_WIDGET (self));
monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (self)));
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
_gtk_widget_get_monitor_geometry (GTK_WIDGET (self), &monitor);
if (x < monitor.x)
x = monitor.x;
else if (x + popup_req.width > monitor.x + monitor.width)
......
......@@ -1223,6 +1223,27 @@ _gtk_window_get_monitor_info (GtkWindow *window,
}
void
_gtk_widget_get_monitor_geometry (GtkWidget *widget,
GdkRectangle *geometry)
{
GdkScreen *screen;
int monitor_num;
cairo_rectangle_int_t monitor;
screen = gtk_widget_get_screen (widget);
monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
if (geometry != NULL) {
geometry->x = monitor.x;
geometry->y = monitor.y;
geometry->width = monitor.width;
geometry->height = monitor.height;
}
}
GdkDevice *
_gtk_widget_get_client_pointer (GtkWidget *widget)
{
......
......@@ -154,6 +154,8 @@ gboolean _gtk_window_get_monitor_info (GtkWindow *window,
GdkRectangle *geometry,
int *number,
char **name);
void _gtk_widget_get_monitor_geometry (GtkWidget *widget,
GdkRectangle *geometry);
GdkDevice * _gtk_widget_get_client_pointer (GtkWidget *widget);
void _gtk_list_box_add_separator (GtkListBox *list_box);
gboolean _gtk_settings_get_dialogs_use_header (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment