comparison pidgin/gtkconv.c @ 25483:c3fbb357cc81

propagate from branch 'im.pidgin.pidgin' (head 4398ffa92e9bb0a16dbede7756a4cbc5dfa96602) to branch 'im.pidgin.pidgin.yaz' (head 0d5786076f662dd1df375b07dc5310f396f57676)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 16 May 2007 09:10:30 +0000
parents e4ee1c5bd51e 80350acaa289
children 97ef4d5b7fba
comparison
equal deleted inserted replaced
25482:e4ee1c5bd51e 25483:c3fbb357cc81
4624 4624
4625 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); 4625 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU);
4626 } 4626 }
4627 } 4627 }
4628 4628
4629 static gboolean
4630 ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null)
4631 {
4632 /* A click on the pane is propagated to the notebook containing the pane.
4633 * So if Stu accidentally aims high and middle clicks on the pane-handle,
4634 * it causes a conversation tab to close. Let's stop that from happening.
4635 */
4636 if (e->button == 2 && e->type == GDK_BUTTON_PRESS)
4637 return TRUE;
4638 return FALSE;
4639 }
4640
4629 /************************************************************************** 4641 /**************************************************************************
4630 * Conversation UI operations 4642 * Conversation UI operations
4631 **************************************************************************/ 4643 **************************************************************************/
4632 static void 4644 static void
4633 private_gtkconv_new(PurpleConversation *conv, gboolean hidden) 4645 private_gtkconv_new(PurpleConversation *conv, gboolean hidden)
4697 4709
4698 gtk_drag_dest_set(gtkconv->entry, 0, 4710 gtk_drag_dest_set(gtkconv->entry, 0,
4699 te, sizeof(te) / sizeof(GtkTargetEntry), 4711 te, sizeof(te) / sizeof(GtkTargetEntry),
4700 GDK_ACTION_COPY); 4712 GDK_ACTION_COPY);
4701 4713
4714 g_signal_connect(G_OBJECT(pane), "button_press_event",
4715 G_CALLBACK(ignore_middle_click), NULL);
4702 g_signal_connect(G_OBJECT(pane), "drag_data_received", 4716 g_signal_connect(G_OBJECT(pane), "drag_data_received",
4703 G_CALLBACK(conv_dnd_recv), gtkconv); 4717 G_CALLBACK(conv_dnd_recv), gtkconv);
4704 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", 4718 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received",
4705 G_CALLBACK(conv_dnd_recv), gtkconv); 4719 G_CALLBACK(conv_dnd_recv), gtkconv);
4706 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", 4720 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received",
7421 } 7435 }
7422 else { /* Otherwise, draw the arrows. */ 7436 else { /* Otherwise, draw the arrows. */
7423 PidginWindow *dest_win; 7437 PidginWindow *dest_win;
7424 GtkNotebook *dest_notebook; 7438 GtkNotebook *dest_notebook;
7425 GtkWidget *tab; 7439 GtkWidget *tab;
7426 gint nb_x, nb_y, page_num; 7440 gint page_num;
7427 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y;
7428 gboolean horiz_tabs = FALSE; 7441 gboolean horiz_tabs = FALSE;
7429 PidginConversation *gtkconv; 7442 PidginConversation *gtkconv;
7430 gboolean to_right = FALSE; 7443 gboolean to_right = FALSE;
7431 7444
7432 /* Get the window that the cursor is over. */ 7445 /* Get the window that the cursor is over. */
7438 return TRUE; 7451 return TRUE;
7439 } 7452 }
7440 7453
7441 dest_notebook = GTK_NOTEBOOK(dest_win->notebook); 7454 dest_notebook = GTK_NOTEBOOK(dest_win->notebook);
7442 7455
7443 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y);
7444
7445 arrow1_x = arrow2_x = nb_x;
7446 arrow1_y = arrow2_y = nb_y;
7447
7448 page_num = pidgin_conv_get_tab_at_xy(dest_win, 7456 page_num = pidgin_conv_get_tab_at_xy(dest_win,
7449 e->x_root, e->y_root, &to_right); 7457 e->x_root, e->y_root, &to_right);
7450 to_right = to_right && (win != dest_win); 7458 to_right = to_right && (win != dest_win);
7451 7459
7452 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || 7460 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP ||
7453 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { 7461 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) {
7454 7462 horiz_tabs = TRUE;
7455 horiz_tabs = TRUE; 7463 }
7456 }
7457 7464
7458 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num); 7465 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num);
7459 tab = gtkconv->tabby; 7466 tab = gtkconv->tabby;
7460 7467
7461 if (horiz_tabs) { 7468 if (horiz_tabs) {
7462 arrow1_x = arrow2_x = nb_x + tab->allocation.x;
7463
7464 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { 7469 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
7465 arrow1_x += tab->allocation.width; 7470 dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP);
7466 arrow2_x += tab->allocation.width; 7471 dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM);
7472 } else {
7473 dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP);
7474 dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM);
7467 } 7475 }
7468
7469 arrow1_y = nb_y + tab->allocation.y;
7470 arrow2_y = nb_y + tab->allocation.y + tab->allocation.height;
7471 } else { 7476 } else {
7472 arrow1_x = nb_x + tab->allocation.x;
7473 arrow2_x = nb_x + tab->allocation.x + tab->allocation.width;
7474 arrow1_y = arrow2_y = nb_y + tab->allocation.y;
7475
7476 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { 7477 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) {
7477 arrow1_y += tab->allocation.height; 7478 dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM);
7478 arrow2_y += tab->allocation.height; 7479 dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM);
7480 } else {
7481 dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP);
7482 dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP);
7479 } 7483 }
7480 }
7481
7482 if (horiz_tabs) {
7483 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y);
7484 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y);
7485 } else {
7486 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y);
7487 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y);
7488 } 7484 }
7489 } 7485 }
7490 7486
7491 return TRUE; 7487 return TRUE;
7492 } 7488 }
8335 first = gtkconv->icon; 8331 first = gtkconv->icon;
8336 third = gtkconv->close; 8332 third = gtkconv->close;
8337 } 8333 }
8338 8334
8339 ebox = gtk_event_box_new(); 8335 ebox = gtk_event_box_new();
8336 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
8340 gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby); 8337 gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby);
8341 g_signal_connect(G_OBJECT(ebox), "button-press-event", 8338 g_signal_connect(G_OBJECT(ebox), "button-press-event",
8342 G_CALLBACK(alias_double_click_cb), gtkconv); 8339 G_CALLBACK(alias_double_click_cb), gtkconv);
8343 8340
8344 if (gtkconv->tab_label->parent == NULL) { 8341 if (gtkconv->tab_label->parent == NULL) {