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

Update most deprecated gdk functions

This commit is contained in:
TingPing 2014-01-18 03:06:33 -05:00
parent eb29de1c7c
commit fa1eb92a7b
4 changed files with 32 additions and 22 deletions

View File

@ -615,7 +615,7 @@ chanlist_button_cb (GtkTreeView *tree, GdkEventButton *event, server *serv)
menu = gtk_menu_new ();
if (event->window)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
gtk_menu_set_screen (GTK_MENU (menu), gdk_window_get_screen (event->window));
g_object_ref (menu);
g_object_ref_sink (menu);
g_object_unref (menu);

View File

@ -1593,7 +1593,7 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch)
menu_add_plugin_items (menu, "\x4$TAB", sess->channel);
if (event->window)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
gtk_menu_set_screen (GTK_MENU (menu), gdk_window_get_screen (event->window));
g_object_ref (menu);
g_object_ref_sink (menu);
g_object_unref (menu);
@ -3715,7 +3715,7 @@ mg_handle_drop (GtkWidget *widget, int y, int *pos, int *other_pos)
int height;
session_gui *gui = current_sess->gui;
gdk_drawable_get_size (gtk_widget_get_window (widget), NULL, &height);
height = gdk_window_get_height (gtk_widget_get_window (widget));
if (y < height / 2)
{
@ -3794,7 +3794,8 @@ mg_drag_begin_cb (GtkWidget *widget, GdkDragContext *context, gpointer userdata)
return FALSE;
cmap = gtk_widget_get_colormap (widget);
gdk_drawable_get_size (gtk_widget_get_window (widget), &width, &height);
width = gdk_window_get_width (gtk_widget_get_window (widget));
height = gdk_window_get_height (gtk_widget_get_window (widget));
pix = gdk_pixbuf_get_from_drawable (NULL, gtk_widget_get_window (widget), cmap, 0, 0, 0, 0, width, height);
pix2 = gdk_pixbuf_scale_simple (pix, width * 4 / 5, height / 2, GDK_INTERP_HYPER);
@ -3874,7 +3875,8 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
else
{
ox = oy = 0;
gdk_drawable_get_size (gtk_widget_get_window (widget), &width, &height);
width = gdk_window_get_width (gtk_widget_get_window (widget));
height = gdk_window_get_height (gtk_widget_get_window (widget));
draw = gtk_widget_get_window (widget);
}

View File

@ -561,7 +561,7 @@ static void
menu_popup (GtkWidget *menu, GdkEventButton *event, gpointer objtounref)
{
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_window_get_screen (event->window));
g_object_ref (menu);
g_object_ref_sink (menu);

View File

@ -55,6 +55,9 @@
#include <gdk/gdkwin32.h>
#else
#include <unistd.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#endif
/* is delimiter */
@ -704,8 +707,8 @@ gtk_xtext_realize (GtkWidget * widget)
gdk_gc_set_fill (xtext->bgc, GDK_TILED);
}
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->hand_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), GDK_HAND1);
xtext->resize_cursor = gdk_cursor_new_for_display (gdk_window_get_display (widget->window), GDK_LEFT_SIDE);
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
widget->style = gtk_style_attach (widget->style, widget->window);
@ -1330,7 +1333,7 @@ gtk_xtext_scrolldown_timeout (GtkXText * xtext)
GtkAdjustment *adj = xtext->adj;
gdk_window_get_pointer (GTK_WIDGET (xtext)->window, 0, &p_y, 0);
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, 0, &win_height);
win_height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (xtext)));
if (buf->last_ent_end == NULL || /* If context has changed OR */
buf->pagetop_ent == NULL || /* pagetop_ent is reset OR */
@ -1400,7 +1403,7 @@ gtk_xtext_selection_update (GtkXText * xtext, GdkEventMotion * event, int p_y, g
return;
}
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, 0, &win_height);
win_height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (xtext)));
/* selecting past top of window, scroll up! */
if (p_y < 0 && xtext->adj->value >= 0)
@ -2092,20 +2095,22 @@ gtk_xtext_selection_get (GtkWidget * widget,
break;
case TARGET_TEXT:
case TARGET_COMPOUND_TEXT:
#ifdef GDK_WINDOWING_X11
{
GdkDisplay *display = gdk_window_get_display (widget->window);
GdkAtom encoding;
gint format;
gint new_length;
gdk_string_to_compound_text_for_display (
gdk_drawable_get_display (widget->window),
stripped, &encoding, &format, &new_text,
&new_length);
gdk_x11_display_string_to_compound_text (display, stripped, &encoding,
&format, &new_text, &new_length);
gtk_selection_data_set (selection_data_ptr, encoding, format,
new_text, new_length);
gdk_free_compound_text (new_text);
gdk_x11_free_compound_text (new_text);
}
break;
#endif
default:
new_text = g_locale_from_utf8 (stripped, len, NULL, &glen, NULL);
gtk_selection_data_set (selection_data_ptr, GDK_SELECTION_TYPE_STRING,
@ -3039,7 +3044,7 @@ gtk_xtext_find_subline (GtkXText *xtext, textentry *ent, int line)
if (line <= RECORD_WRAPS)
return ent->wrap_offset[line - 1];
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &win_width, 0);
win_width = gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (xtext)));
win_width -= MARGIN;
/* indent = ent->indent;
@ -3419,7 +3424,8 @@ gtk_xtext_calc_lines (xtext_buffer *buf, int fire_signal)
int height;
int lines;
gdk_drawable_get_size (GTK_WIDGET (buf->xtext)->window, &width, &height);
height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (buf->xtext)));
width = gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (buf->xtext)));
width -= MARGIN;
if (width < 30 || height < buf->xtext->fontsize || width < buf->indent + 30)
@ -3514,7 +3520,8 @@ gtk_xtext_render_ents (GtkXText * xtext, textentry * enta, textentry * entb)
if (xtext->buffer->indent < MARGIN)
xtext->buffer->indent = MARGIN; /* 2 pixels is our left margin */
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (xtext)));
width = gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (xtext)));
width -= MARGIN;
if (width < 32 || height < xtext->fontsize || width < xtext->buffer->indent + 30)
@ -3595,7 +3602,6 @@ gtk_xtext_render_page (GtkXText * xtext)
int subline;
int startline = xtext->adj->value;
int pos, overlap;
GdkRectangle area;
if(!GTK_WIDGET_REALIZED(xtext))
return;
@ -3630,6 +3636,8 @@ gtk_xtext_render_page (GtkXText * xtext)
#ifndef __APPLE__
if (!xtext->pixmap && abs (overlap) < height)
{
GdkRectangle area;
/* so the obscured regions are exposed */
gdk_gc_set_exposures (xtext->fgc, TRUE);
if (overlap < 1) /* DOWN */
@ -3879,7 +3887,6 @@ gtk_xtext_check_ent_visibility (GtkXText * xtext, textentry *find_ent, int add)
textentry *ent;
int lines;
xtext_buffer *buf = xtext->buffer;
int width;
int height;
if (find_ent == NULL)
@ -3887,7 +3894,7 @@ gtk_xtext_check_ent_visibility (GtkXText * xtext, textentry *find_ent, int add)
return FALSE;
}
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &width, &height);
height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (xtext)));
ent = buf->pagetop_ent;
/* If top line not completely displayed return FALSE */
@ -4679,7 +4686,8 @@ gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render)
if (!GTK_WIDGET_REALIZED (GTK_WIDGET (xtext)))
gtk_widget_realize (GTK_WIDGET (xtext));
gdk_drawable_get_size (GTK_WIDGET (xtext)->window, &w, &h);
h = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (xtext)));
w = gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (xtext)));
/* after a font change */
if (buf->needs_recalc)