--- a/pidgin/gtkconv.c Thu Mar 26 20:23:10 2020 -0500
+++ b/pidgin/gtkconv.c Wed Apr 01 18:07:49 2020 +0000
@@ -7811,34 +7811,46 @@
static gboolean gtk_conv_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data) {
- if (gtk_widget_get_visible(w))
- gtk_window_get_position(GTK_WINDOW(w), &x, &y);
+ GdkMonitor *monitor = NULL; + GdkRectangle geo, window_geo, intersect_geo; + if(!gtk_widget_get_visible(w)) { return FALSE; /* carry on normally */
+ gtk_window_get_position(GTK_WINDOW(w), &window_geo.x, &window_geo.y); + window_geo.width = event->width; + window_geo.height = event->height; /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
* when the window is being maximized */
if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED)
- /* don't save off-screen positioning */
- if (x + event->width < 0 ||
- y + event->height < 0 ||
- x > gdk_screen_width() ||
- y > gdk_screen_height())
+ monitor = gdk_display_get_monitor_at_window(gdk_display_get_default(), + gdk_monitor_get_geometry(monitor, &geo); + /* now make sure that the window is entirely within the monitor. We do + * this by finding the intersection of the window on the monitor, if that + * is equal to the window's geometry, then the window is fully contained on + gdk_rectangle_intersect(&geo, &window_geo, &intersect_geo); + if(!gdk_rectangle_equal(&window_geo, &intersect_geo)) { return FALSE; /* carry on normally */
- purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/x", x);
- purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/y", y);
- purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", event->width);
- purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height);
+ purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/x", window_geo.x); + purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/y", window_geo.y); + purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", + purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", /* continue to handle event normally */
@@ -8574,6 +8586,8 @@
conv_placement_last_created_win_type_configured_cb(GtkWidget *w,
GdkEventConfigure *event, PidginConversation *conv)
+ GdkMonitor *monitor = NULL; @@ -8587,12 +8601,17 @@
if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED)
+ monitor = gdk_display_get_monitor_at_window(gdk_display_get_default(), + gdk_monitor_get_geometry(monitor, &geo); /* don't save off-screen positioning */
- if (x + event->width < 0 ||
- y + event->height < 0 ||
- x > gdk_screen_width() ||
- y > gdk_screen_height())
+ if (x + event->width < geo.x || + y + event->height < geo.y || return FALSE; /* carry on normally */
for (all = conv->convs; all != NULL; all = all->next) {
if (PURPLE_IS_IM_CONVERSATION(conv->active_conv) != PURPLE_IS_IM_CONVERSATION(all->data)) {
--- a/pidgin/gtksound.c Thu Mar 26 20:23:10 2020 -0500
+++ b/pidgin/gtksound.c Wed Apr 01 18:07:49 2020 +0000
@@ -452,7 +452,7 @@
if (purple_strequal(method, "none")) {
} else if (purple_strequal(method, "beep")) {
+ gdk_display_beep(gdk_display_get_default()); @@ -578,7 +578,7 @@
#else /* #ifdef USE_GSTREAMER */
+ gdk_display_beep(gdk_display_get_default()); pidgin_sound_play_file_win32(filename);
--- a/pidgin/gtkstatusbox.c Thu Mar 26 20:23:10 2020 -0500
+++ b/pidgin/gtkstatusbox.c Wed Apr 01 18:07:49 2020 +0000
@@ -1168,8 +1168,8 @@
pidgin_status_box_list_position (PidginStatusBox *status_box, int *x, int *y, int *width, int *height)
GtkRequisition popup_req;
GtkPolicyType hpolicy, vpolicy;
@@ -1201,10 +1201,9 @@
*height = popup_req.height;
- screen = gtk_widget_get_screen(GTK_WIDGET(status_box));
- monitor_num = gdk_screen_get_monitor_at_window(screen,
+ m = gdk_display_get_monitor_at_window(gdk_display_get_default(), gtk_widget_get_window(GTK_WIDGET(status_box)));
- gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
+ gdk_monitor_get_geometry(m, &monitor); --- a/pidgin/gtkutils.c Thu Mar 26 20:23:10 2020 -0500
+++ b/pidgin/gtkutils.c Wed Apr 01 18:07:49 2020 +0000
@@ -803,16 +803,14 @@
GtkRequisition requisition;
+ GdkMonitor *monitor = NULL; gint space_left, space_right, space_above, space_below;
g_return_if_fail(GTK_IS_MENU(menu));
widget = GTK_WIDGET(menu);
- screen = gtk_widget_get_screen(widget);
rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL);
@@ -823,7 +821,7 @@
gtk_widget_get_preferred_size(widget, NULL, &requisition);
- monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
+ monitor = gdk_display_get_monitor_at_point(gdk_display_get_default(), *x, *y); @@ -846,12 +844,12 @@
* Positioning in the vertical direction is similar: first try below
* mouse cursor, then above.
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
- space_left = *x - monitor.x;
- space_right = monitor.x + monitor.width - *x - 1;
- space_above = *y - monitor.y;
- space_below = monitor.y + monitor.height - *y - 1;
+ gdk_monitor_get_geometry(monitor, &geo); + space_left = *x - geo.x; + space_right = geo.x + geo.width - *x - 1; + space_above = *y - geo.y; + space_below = geo.y + geo.height - *y - 1; /* position horizontally */
@@ -867,7 +865,7 @@
/* x is clamped on-screen further down */
- else if (requisition.width <= monitor.width)
+ else if (requisition.width <= geo.width) /* the menu is too big to fit on either side of the mouse
* cursor, but smaller than the monitor. Position it on
@@ -876,12 +874,12 @@
if (space_left > space_right)
- *x = monitor.x + monitor.width - requisition.width;
+ *x = geo.x + geo.width - requisition.width; else /* menu is simply too big for the monitor */
@@ -889,12 +887,12 @@
- *x = monitor.x + monitor.width - requisition.width;
+ *x = geo.x + geo.width - requisition.width;
@@ -909,13 +907,13 @@
*y = *y - requisition.height + 1;
- *y = CLAMP (*y, monitor.y,
- monitor.y + monitor.height - requisition.height);
+ geo.y + geo.height - requisition.height); if (space_below >= space_above)
- *y = monitor.y + monitor.height - requisition.height;
+ *y = geo.y + geo.height - requisition.height;
--- a/pidgin/pidgintooltip.c Thu Mar 26 20:23:10 2020 -0500
+++ b/pidgin/pidgintooltip.c Wed Apr 01 18:07:49 2020 +0000
@@ -130,20 +130,20 @@
int scr_w, scr_h, x, y, dy;
int preserved_x, preserved_y;
- GdkScreen *screen = NULL;
+ GdkDisplay *display = NULL; + GdkMonitor *monitor = NULL; GtkWidget *tipwindow = pidgin_tooltip.tipwindow;
- seat = gdk_display_get_default_seat(gdk_display_get_default());
+ display = gdk_display_get_default(); + seat = gdk_display_get_default_seat(display); dev = gdk_seat_get_pointer(seat);
- gdk_device_get_position(dev, &screen, &x, &y);
+ gdk_device_get_position(dev, NULL, &x, &y); - mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
- gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
+ monitor = gdk_display_get_monitor_at_point(display, x, y); + gdk_monitor_get_geometry(monitor, &mon_size); scr_w = mon_size.width + mon_size.x;
scr_h = mon_size.height + mon_size.y;