1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-22 17:22:18 -05:00

Update XChat to r1516

This commit is contained in:
Berke Viktor 2012-07-14 20:46:42 +02:00
parent a5cc3b15d7
commit c80cb47e5c
8 changed files with 5 additions and 67 deletions

View File

@ -586,12 +586,7 @@ struct popup
/* CL: get a random int in the range [0..n-1]. DON'T use rand() % n, it gives terrible results. */ /* CL: get a random int in the range [0..n-1]. DON'T use rand() % n, it gives terrible results. */
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n))) #define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))
#if defined(WIN32) && GLIB_CHECK_VERSION(2,4,0)
#define xchat_filename_from_utf8 g_locale_from_utf8 #define xchat_filename_from_utf8 g_locale_from_utf8
#define xchat_filename_to_utf8 g_locale_to_utf8 #define xchat_filename_to_utf8 g_locale_to_utf8
#else
#define xchat_filename_from_utf8 g_filename_from_utf8
#define xchat_filename_to_utf8 g_filename_to_utf8
#endif
#endif #endif

View File

@ -100,10 +100,10 @@ cv_tree_init (chanview *cv)
/*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/ /*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/
GTK_WIDGET_UNSET_FLAGS (view, GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS (view, GTK_CAN_FOCUS);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
#if GTK_CHECK_VERSION(2,10,0)
if (!(prefs.gui_tweaks & 8)) if (!(prefs.gui_tweaks & 8))
gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (view), TRUE); gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (view), TRUE);
#endif
gtk_container_add (GTK_CONTAINER (win), view); gtk_container_add (GTK_CONTAINER (win), view);
/* icon column */ /* icon column */

View File

@ -908,13 +908,8 @@ fe_gui_info (session *sess, int info_type)
if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (sess->gui->window))) if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (sess->gui->window)))
#endif #endif
return 2; /* hidden (iconified or systray) */ return 2; /* hidden (iconified or systray) */
#if GTK_CHECK_VERSION(2,4,0)
if (gtk_window_is_active (GTK_WINDOW (sess->gui->window))) if (gtk_window_is_active (GTK_WINDOW (sess->gui->window)))
#else
#if GTK_CHECK_VERSION(2,2,0)
if (GTK_WINDOW (sess->gui->window)->is_active)
#endif
#endif
return 1; /* active/focused */ return 1; /* active/focused */
return 0; /* normal (no keyboard focus or behind a window) */ return 0; /* normal (no keyboard focus or behind a window) */

View File

@ -1544,11 +1544,7 @@ key_action_tab_comp (GtkWidget *t, GdkEventKey *entry, char *d1, char *d2,
comp = 0; comp = 0;
} }
#if GLIB_CHECK_VERSION(2,4,0)
list = g_completion_complete_utf8 (gcomp, comp ? old_gcomp.data : ent, &result); list = g_completion_complete_utf8 (gcomp, comp ? old_gcomp.data : ent, &result);
#else
list = g_completion_complete (gcomp, comp ? old_gcomp.data : ent, &result);
#endif
if (result == NULL) /* No matches found */ if (result == NULL) /* No matches found */
{ {

View File

@ -436,10 +436,9 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter)); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
} }
#if GTK_CHECK_VERSION(2,8,0)
if (!(flags & FRF_NOASKOVERWRITE)) if (!(flags & FRF_NOASKOVERWRITE))
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
#endif
} }
else else
dialog = gtk_file_chooser_dialog_new (title, NULL, dialog = gtk_file_chooser_dialog_new (title, NULL,

View File

@ -228,9 +228,6 @@ ignore_delete_entry_clicked (GtkWidget * wid, struct session *sess)
if (gtkutil_treeview_get_selected (view, &iter, 0, &mask, -1)) if (gtkutil_treeview_get_selected (view, &iter, 0, &mask, -1))
{ {
/* delete this row, select next one */ /* delete this row, select next one */
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
gtk_list_store_remove (store, &iter);
#else
if (gtk_list_store_remove (store, &iter)) if (gtk_list_store_remove (store, &iter))
{ {
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
@ -238,7 +235,6 @@ ignore_delete_entry_clicked (GtkWidget * wid, struct session *sess)
gtk_tree_view_set_cursor (view, path, NULL, FALSE); gtk_tree_view_set_cursor (view, path, NULL, FALSE);
gtk_tree_path_free (path); gtk_tree_path_free (path);
} }
#endif
ignore_del (mask, NULL); ignore_del (mask, NULL);
g_free (mask); g_free (mask);

View File

@ -565,10 +565,8 @@ menu_destroy (GtkWidget *menu, gpointer objtounref)
static void static void
menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref) menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref)
{ {
#if (GTK_MAJOR_VERSION != 2) || (GTK_MINOR_VERSION != 0)
if (event && event->window) if (event && event->window)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window)); gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
#endif
g_object_ref (menu); g_object_ref (menu);
g_object_ref_sink (menu); g_object_ref_sink (menu);
@ -1746,8 +1744,6 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock)
return item; return item;
} }
#if GTK_CHECK_VERSION(2,4,0)
/* Override the default GTK2.4 handler, which would make menu /* Override the default GTK2.4 handler, which would make menu
bindings not work when the menu-bar is hidden. */ bindings not work when the menu-bar is hidden. */
static gboolean static gboolean
@ -1761,9 +1757,6 @@ menu_canacaccel (GtkWidget *widget, guint signal_id, gpointer user_data)
#endif #endif
} }
#endif
/* === STUFF FOR /MENU === */ /* === STUFF FOR /MENU === */
static GtkMenuItem * static GtkMenuItem *
@ -2139,10 +2132,8 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
/* /MENU needs to know this later */ /* /MENU needs to know this later */
g_object_set_data (G_OBJECT (menu_bar), "accel", accel_group); g_object_set_data (G_OBJECT (menu_bar), "accel", accel_group);
#if GTK_CHECK_VERSION(2,4,0)
g_signal_connect (G_OBJECT (menu_bar), "can-activate-accel", g_signal_connect (G_OBJECT (menu_bar), "can-activate-accel",
G_CALLBACK (menu_canacaccel), 0); G_CALLBACK (menu_canacaccel), 0);
#endif
/* set the initial state of toggles */ /* set the initial state of toggles */
mymenu[MENUBAR_OFFSET].state = !prefs.hidemenu; mymenu[MENUBAR_OFFSET].state = !prefs.hidemenu;

View File

@ -1094,13 +1094,8 @@ gtk_xtext_realize (GtkWidget * widget)
gdk_gc_set_fill (xtext->bgc, GDK_TILED); gdk_gc_set_fill (xtext->bgc, GDK_TILED);
} }
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
xtext->hand_cursor = gdk_cursor_new (GDK_HAND1);
xtext->resize_cursor = gdk_cursor_new (GDK_LEFT_SIDE);
#else
xtext->hand_cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), GDK_HAND1); xtext->hand_cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), GDK_HAND1);
xtext->resize_cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), GDK_LEFT_SIDE); xtext->resize_cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (widget->window), GDK_LEFT_SIDE);
#endif
gdk_window_set_back_pixmap (widget->window, NULL, FALSE); gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
widget->style = gtk_style_attach (widget->style, widget->window); widget->style = gtk_style_attach (widget->style, widget->window);
@ -1368,11 +1363,7 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
gdk_draw_line (xtext->draw_buf, xtext->marker_gc, x, render_y, x + width, render_y); gdk_draw_line (xtext->draw_buf, xtext->marker_gc, x, render_y, x + width, render_y);
#if GTK_CHECK_VERSION(2,4,0)
if (gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext))))) if (gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext)))))
#else
if (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (xtext)))->has_focus)
#endif
{ {
xtext->buffer->marker_seen = TRUE; xtext->buffer->marker_seen = TRUE;
} }
@ -2160,13 +2151,8 @@ gtk_xtext_set_clip_owner (GtkWidget * xtext, GdkEventButton * event)
str = gtk_xtext_selection_get_text (GTK_XTEXT (xtext), &len); str = gtk_xtext_selection_get_text (GTK_XTEXT (xtext), &len);
if (str) if (str)
{ {
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
str, len);
#else
gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD), gtk_clipboard_set_text (gtk_widget_get_clipboard (xtext, GDK_SELECTION_CLIPBOARD),
str, len); str, len);
#endif
free (str); free (str);
} }
@ -2516,16 +2502,10 @@ gtk_xtext_selection_get (GtkWidget * widget,
gint format; gint format;
gint new_length; gint new_length;
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
gdk_string_to_compound_text (
stripped, &encoding, &format, &new_text,
&new_length);
#else
gdk_string_to_compound_text_for_display ( gdk_string_to_compound_text_for_display (
gdk_drawable_get_display (widget->window), gdk_drawable_get_display (widget->window),
stripped, &encoding, &format, &new_text, stripped, &encoding, &format, &new_text,
&new_length); &new_length);
#endif
gtk_selection_data_set (selection_data_ptr, encoding, format, gtk_selection_data_set (selection_data_ptr, encoding, format,
new_text, new_length); new_text, new_length);
gdk_free_compound_text (new_text); gdk_free_compound_text (new_text);
@ -3876,14 +3856,9 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
#ifdef USE_SHM #ifdef USE_SHM
if (xtext->shm && shm_pixmaps) if (xtext->shm && shm_pixmaps)
{ {
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
shaded_pix = gdk_pixmap_foreign_new (
XShmCreatePixmap (xdisplay, p, ximg->data, &xtext->shminfo, w, h, depth));
#else
shaded_pix = gdk_pixmap_foreign_new_for_display ( shaded_pix = gdk_pixmap_foreign_new_for_display (
gdk_drawable_get_display (xtext->draw_buf), gdk_drawable_get_display (xtext->draw_buf),
XShmCreatePixmap (xdisplay, p, ximg->data, &xtext->shminfo, w, h, depth)); XShmCreatePixmap (xdisplay, p, ximg->data, &xtext->shminfo, w, h, depth));
#endif
} else } else
#endif #endif
{ {
@ -4104,11 +4079,7 @@ gtk_xtext_load_trans (GtkXText * xtext)
} else } else
{ {
noshade: noshade:
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
xtext->pixmap = gdk_pixmap_foreign_new (rootpix);
#else
xtext->pixmap = gdk_pixmap_foreign_new_for_display (gdk_drawable_get_display (GTK_WIDGET (xtext)->window), rootpix); xtext->pixmap = gdk_pixmap_foreign_new_for_display (gdk_drawable_get_display (GTK_WIDGET (xtext)->window), rootpix);
#endif
gdk_gc_set_tile (xtext->bgc, xtext->pixmap); gdk_gc_set_tile (xtext->bgc, xtext->pixmap);
gdk_gc_set_ts_origin (xtext->bgc, -x, -y); gdk_gc_set_ts_origin (xtext->bgc, -x, -y);
xtext->ts_x = -x; xtext->ts_x = -x;
@ -5646,12 +5617,7 @@ gtk_xtext_append_entry (xtext_buffer *buf, textentry * ent, time_t stamp)
if (buf->reset_marker_pos || if (buf->reset_marker_pos ||
((buf->marker_pos == NULL || buf->marker_seen) && (buf->xtext->buffer != buf || ((buf->marker_pos == NULL || buf->marker_seen) && (buf->xtext->buffer != buf ||
#if GTK_CHECK_VERSION(2,4,0) !gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (buf->xtext)))))))
!gtk_window_has_toplevel_focus (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (buf->xtext))))
#else
!(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (buf->xtext))))->has_focus
#endif
)))
{ {
buf->marker_pos = ent; buf->marker_pos = ent;
dontscroll (buf); /* force scrolling off */ dontscroll (buf); /* force scrolling off */