Mercurial > pidgin.yaz
diff pidgin/gtkconv.c @ 27760:e9cf897bd873
propagate from branch 'im.pidgin.pidgin' (head ae7f8e3acb446776f833c3b44514295ae56184b3)
to branch 'im.pidgin.pidgin.yaz' (head 952151791a1f3b4e3469a5621f4cfa2de608a8b8)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 30 Jan 2008 10:53:22 +0000 |
parents | 4426e530c156 6d9757319bf6 |
children | ed6de6a3604f |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Thu Jan 10 05:32:41 2008 +0000 +++ b/pidgin/gtkconv.c Wed Jan 30 10:53:22 2008 +0000 @@ -173,6 +173,7 @@ static void pidgin_conv_set_position_size(PidginWindow *win, int x, int y, int width, int height); +static gboolean pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y); static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) { static GdkColor col; @@ -494,6 +495,13 @@ cmdline = cmd + strlen(prefix); + if (strcmp(cmdline, "xyzzy") == 0) { + purple_conversation_write(conv, "", "Nothing happens", + PURPLE_MESSAGE_NO_LOG, time(NULL)); + g_free(cmd); + return TRUE; + } + gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); @@ -3489,9 +3497,14 @@ gtk_text_buffer_delete_mark(buffer, stmark); gtk_text_buffer_delete_mark(buffer, enmark); gtk_text_buffer_delete(buffer, &start, &end); - } else if (message && *message == '\n' && !*(message + 1)) + } else if (message && *message == '\n' && message[1] == ' ' && message[2] == '\0') message = NULL; +#ifdef RESERVE_LINE + if (!message) + message = "\n "; /* The blank space is required to avoid a GTK+/Pango bug */ +#endif + if (message) { GtkTextIter iter; gtk_text_buffer_get_end_iter(buffer, &iter); @@ -3519,7 +3532,11 @@ return; if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) { - update_typing_message(gtkconv, "\n"); +#ifdef RESERVE_LINE + update_typing_message(gtkconv, NULL); +#else + update_typing_message(gtkconv, "\n "); +#endif return; } @@ -5070,7 +5087,7 @@ gtk_text_buffer_create_tag(GTK_IMHTML(gtkconv->imhtml)->text_buffer, "TYPING-NOTIFICATION", "foreground", "#888888", "justification", GTK_JUSTIFY_LEFT, /* XXX: RTL'ify */ - "weight", PANGO_WEIGHT_BOLD, + "weight", PANGO_WEIGHT_LIGHT, "scale", PANGO_SCALE_SMALL, NULL); @@ -6988,6 +7005,18 @@ gray_stuff_out(PIDGIN_CONVERSATION(conv)); } +static gboolean +pidgin_conv_xy_to_right_infopane(PidginWindow *win, int x, int y) +{ + gint pane_x, pane_y, x_rel; + PidginConversation *gtkconv; + + gdk_window_get_origin(win->notebook->window, &pane_x, &pane_y); + x_rel = x - pane_x; + gtkconv = pidgin_conv_window_get_active_gtkconv(win); + return (x_rel > gtkconv->infopane->allocation.x + gtkconv->infopane->allocation.width / 2); +} + int pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right) { @@ -7023,7 +7052,7 @@ tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page); /* Make sure the tab is not hidden beyond an arrow */ - if (!GTK_WIDGET_DRAWABLE(tab)) + if (!GTK_WIDGET_DRAWABLE(tab) && gtk_notebook_get_show_tabs(notebook)) continue; if (horiz) { @@ -8304,7 +8333,6 @@ GtkWidget *tab; gint page_num; gboolean horiz_tabs = FALSE; - PidginConversation *gtkconv; gboolean to_right = FALSE; /* Get the window that the cursor is over. */ @@ -8318,20 +8346,27 @@ dest_notebook = GTK_NOTEBOOK(dest_win->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); + 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; + } else { + page_num = 0; + 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) { horiz_tabs = TRUE; } - gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num); - tab = gtkconv->tabby; - if (gtk_notebook_get_show_tabs(dest_notebook) == FALSE) { - dnd_hints_show_relative(HINT_ARROW_DOWN, gtkconv->infopane, HINT_POSITION_CENTER, HINT_POSITION_TOP); - dnd_hints_show_relative(HINT_ARROW_UP, gtkconv->infopane, HINT_POSITION_CENTER, HINT_POSITION_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 */ + dnd_hints_hide_all(); + return TRUE; } else if (horiz_tabs) { if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP); @@ -8528,6 +8563,7 @@ notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) { PidginWindow *dest_win; + GtkNotebook *dest_notebook; PurpleConversation *conv; PidginConversation *gtkconv; gint dest_page_num = 0; @@ -8603,9 +8639,16 @@ "conversation-dragging", win, dest_win); /* Get the destination page number. */ - if (!new_window) - dest_page_num = pidgin_conv_get_tab_at_xy(dest_win, - e->x_root, e->y_root, &to_right); + if (!new_window) { + 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); + } else { + dest_page_num = 0; + 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);