--- a/pidgin/gtkconv.c Mon Oct 11 21:17:53 2021 -0500
+++ b/pidgin/gtkconv.c Mon Oct 11 23:47:26 2021 -0500
@@ -160,7 +160,6 @@
static void pidgin_conv_set_position_size(PidginConvWindow *win, int x, int y,
-static gboolean pidgin_conv_xy_to_right_infopane(PidginConvWindow *win, int x, int y);
get_conversation_blist_node(PurpleConversation *conv)
@@ -4017,21 +4016,6 @@
gray_stuff_out(PIDGIN_CONVERSATION(conv));
-pidgin_conv_xy_to_right_infopane(PidginConvWindow *win, int x, int y)
- gint pane_x, pane_y, x_rel;
- PidginConversation *gtkconv;
- GtkAllocation allocation;
- gdk_window_get_origin(gtk_widget_get_window(win->notebook),
- gtkconv = pidgin_conv_window_get_active_gtkconv(win);
- gtk_widget_get_allocation(gtkconv->infopane, &allocation);
- return (x_rel > allocation.x + allocation.width / 2);
pidgin_conv_get_tab_at_xy(PidginConvWindow *win, int x, int y, gboolean *to_right)
@@ -4964,346 +4948,6 @@
-notebook_init_grab(PidginConvWindow *gtkwin, GtkWidget *widget, GdkEvent *event)
- static GdkCursor *cursor = NULL;
- gtkwin->in_drag = TRUE;
- if (gtkwin->drag_leave_signal) {
- g_signal_handler_disconnect(G_OBJECT(widget),
- gtkwin->drag_leave_signal);
- gtkwin->drag_leave_signal = 0;
- GdkDisplay *display = gtk_widget_get_display(gtkwin->notebook);
- cursor = gdk_cursor_new_for_display(display, GDK_FLEUR);
- gtk_grab_add(gtkwin->notebook);
- device = gdk_event_get_device(event);
- if (!gdk_display_device_is_grabbed(gdk_device_get_display(device),
- gdk_seat_grab(gdk_event_get_seat(event),
- gtk_widget_get_window(gtkwin->notebook),
- GDK_SEAT_CAPABILITY_ALL_POINTING, FALSE, cursor, event,
-notebook_motion_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win)
- * Make sure the user moved the mouse far enough for the
- * drag to be initiated.
- if (e->x_root < win->drag_min_x ||
- e->x_root >= win->drag_max_x ||
- e->y_root < win->drag_min_y ||
- e->y_root >= win->drag_max_y) {
- win->in_predrag = FALSE;
- notebook_init_grab(win, widget, (GdkEvent *)e);
- else { /* Otherwise, draw the arrows. */
- PidginConvWindow *dest_win;
- GtkNotebook *dest_notebook;
- gboolean horiz_tabs = FALSE;
- gboolean to_right = FALSE;
- /* Get the window that the cursor is over. */
- dest_win = pidgin_conv_window_get_at_event((GdkEvent *)e);
- if (dest_win == NULL) {
- pidgin_dnd_hints_hide_all();
- dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
- if (gtk_notebook_get_show_tabs(dest_notebook)) {
- page_num = pidgin_conv_get_tab_at_xy(dest_win,
- e->x_root, e->y_root, &to_right);
- to_right = to_right && (win != dest_win);
- tab = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num)->tabby;
- to_right = pidgin_conv_xy_to_right_infopane(dest_win, e->x_root, e->y_root);
- tab = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num)->infopane;
- if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP ||
- gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) {
- if (gtk_notebook_get_show_tabs(dest_notebook) == FALSE && win == dest_win)
- /* dragging a tab from a single-tabbed window over its own window */
- pidgin_dnd_hints_hide_all();
- } else if (horiz_tabs) {
- if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
- pidgin_dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP);
- pidgin_dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM);
- pidgin_dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP);
- pidgin_dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM);
- if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
- pidgin_dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM);
- pidgin_dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM);
- pidgin_dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP);
- pidgin_dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP);
-notebook_leave_cb(GtkWidget *widget, GdkEventCrossing *e, PidginConvWindow *win)
- if (e->x_root < win->drag_min_x ||
- e->x_root >= win->drag_max_x ||
- e->y_root < win->drag_min_y ||
- e->y_root >= win->drag_max_y) {
- win->in_predrag = FALSE;
- notebook_init_grab(win, widget, (GdkEvent *)e);
-notebook_press_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win)
- GtkAllocation allocation;
- if (e->button == GDK_BUTTON_MIDDLE && e->type == GDK_BUTTON_PRESS) {
- PidginConversation *gtkconv;
- tab_clicked = pidgin_conv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
- gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked);
- close_conv_cb(NULL, gtkconv);
- if (e->button != GDK_BUTTON_PRIMARY || e->type != GDK_BUTTON_PRESS)
- purple_debug_warning("gtkconv",
- "Already in the middle of a window drag at tab_press_cb");
- * Make sure a tab was actually clicked. The arrow buttons
- tab_clicked = pidgin_conv_get_tab_at_xy(win, e->x_root, e->y_root, NULL);
- * Get the relative position of the press event, with regards to
- * the position of the notebook.
- gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y);
- /* Reset the min/max x/y */
- /* Find out which tab was dragged. */
- page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked);
- tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page);
- gtk_widget_get_allocation(tab, &allocation);
- win->drag_min_x = allocation.x + nb_x;
- win->drag_min_y = allocation.y + nb_y;
- win->drag_max_x = allocation.width + win->drag_min_x;
- win->drag_max_y = allocation.height + win->drag_min_y;
- /* Make sure the click occurred in the tab. */
- if (e->x_root < win->drag_min_x ||
- e->x_root >= win->drag_max_x ||
- e->y_root < win->drag_min_y ||
- e->y_root >= win->drag_max_y) {
- win->in_predrag = TRUE;
- win->drag_tab = tab_clicked;
- /* Connect the new motion signals. */
- win->drag_motion_signal =
- g_signal_connect(G_OBJECT(widget), "motion_notify_event",
- G_CALLBACK(notebook_motion_cb), win);
- win->drag_leave_signal =
- g_signal_connect(G_OBJECT(widget), "leave_notify_event",
- G_CALLBACK(notebook_leave_cb), win);
-notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginConvWindow *win)
- PidginConvWindow *dest_win;
- GtkNotebook *dest_notebook;
- PidginConversation *active_gtkconv;
- PidginConversation *gtkconv;
- gint dest_page_num = 0;
- gboolean new_window = FALSE;
- gboolean to_right = FALSE;
- * Don't check to make sure that the event's window matches the
- * widget's, because we may be getting an event passed on from the
- if (e->button != GDK_BUTTON_PRIMARY && e->type != GDK_BUTTON_RELEASE)
- device = gdk_event_get_device((GdkEvent *)e);
- if (gdk_display_device_is_grabbed(gdk_device_get_display(device), device)) {
- gdk_seat_ungrab(gdk_event_get_seat((GdkEvent *)e));
- gtk_grab_remove(widget);
- if (!win->in_predrag && !win->in_drag)
- /* Disconnect the motion signal. */
- if (win->drag_motion_signal) {
- g_signal_handler_disconnect(G_OBJECT(widget),
- win->drag_motion_signal);
- win->drag_motion_signal = 0;
- * If we're in a pre-drag, we'll also need to disconnect the leave
- win->in_predrag = FALSE;
- if (win->drag_leave_signal) {
- g_signal_handler_disconnect(G_OBJECT(widget),
- win->drag_leave_signal);
- win->drag_leave_signal = 0;
- /* If we're not in drag... */
- /* We're perfectly normal people! */
- pidgin_dnd_hints_hide_all();
- dest_win = pidgin_conv_window_get_at_event((GdkEvent *)e);
- active_gtkconv = pidgin_conv_window_get_active_gtkconv(win);
- if (dest_win == NULL) {
- /* If the current window doesn't have any other conversations,
- * there isn't much point transferring the conv to a new window. */
- if (pidgin_conv_window_get_gtkconv_count(win) > 1) {
- /* Make a new window to stick this to. */
- dest_win = pidgin_conv_window_new();
- purple_signal_emit(pidgin_conversations_get_handle(),
- "conversation-dragging", win, dest_win);
- /* Get the destination page number. */
- dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
- if (gtk_notebook_get_show_tabs(dest_notebook)) {
- dest_page_num = pidgin_conv_get_tab_at_xy(dest_win,
- e->x_root, e->y_root, &to_right);
- to_right = pidgin_conv_xy_to_right_infopane(dest_win, e->x_root, e->y_root);
- gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, win->drag_tab);
- gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, dest_page_num);
- pidgin_conv_window_remove_gtkconv(win, gtkconv);
- pidgin_conv_window_add_gtkconv(dest_win, gtkconv);
- gtk_notebook_reorder_child(GTK_NOTEBOOK(dest_win->notebook), gtkconv->tab_cont, dest_page_num + to_right);
- pidgin_conv_window_switch_gtkconv(dest_win, gtkconv);
- gint win_width, win_height;
- gtk_window_get_size(GTK_WINDOW(dest_win->window),
- &win_width, &win_height);
-#ifdef _WIN32 /* only override window manager placement on Windows */
- gtk_window_move(GTK_WINDOW(dest_win->window),
- e->x_root - (win_width / 2),
- e->y_root - (win_height / 2));
- pidgin_conv_window_show(dest_win);
- gtk_widget_grab_focus(active_gtkconv->editor);
before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num,
@@ -5546,14 +5190,6 @@
g_signal_connect_after(G_OBJECT(win->notebook), "switch_page",
G_CALLBACK(switch_conv_cb), win);
- /* Setup the tab drag and drop signals. */
- gtk_widget_add_events(win->notebook,
- GDK_BUTTON1_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
- g_signal_connect(G_OBJECT(win->notebook), "button_press_event",
- G_CALLBACK(notebook_press_cb), win);
- g_signal_connect(G_OBJECT(win->notebook), "button_release_event",
- G_CALLBACK(notebook_release_cb), win);
testidea = pidgin_conversation_window_get_vbox(PIDGIN_CONVERSATION_WINDOW(win->window));