[gnumeric] Compilation: dead kittens.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Compilation: dead kittens.
- Date: Thu, 11 Nov 2010 20:17:51 +0000 (UTC)
commit 25a7a60bedc9f4b093a66970490e43066c7ab230
Author: Morten Welinder <terra gnome org>
Date: Thu Nov 11 15:17:17 2010 -0500
Compilation: dead kittens.
NEWS | 1 +
configure.in | 9 ++++
src/dead-kittens.h | 12 +++++
src/gnm-pane.c | 89 +++++++++++++++++++++++++++-----------
src/gui-clipboard.c | 109 ++++++++++++++++++++++++-----------------------
src/sheet-control-gui.c | 75 +++++++++++++++++++++------------
src/wbc-gtk.c | 51 +++++++++++++++-------
7 files changed, 224 insertions(+), 122 deletions(-)
---
diff --git a/NEWS b/NEWS
index 52a4ff0..0bc44d6 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,7 @@ Morten:
* Partially fix problem with undefined names. [#633140]
* Fix analysis tools problems when "as values" is chosen.
* Fix gtk+/X crash with large tooltips.
+ * Take care of dead kittens.
Sameer Morar:
* Add key combinations to move sheets. [#634139]
diff --git a/configure.in b/configure.in
index dda52d1..644c82f 100644
--- a/configure.in
+++ b/configure.in
@@ -695,6 +695,7 @@ AC_CHECK_FUNCS(gtk_dialog_get_content_area gtk_dialog_get_action_area)
AC_CHECK_FUNCS(gtk_entry_get_text_length gtk_entry_set_icon_from_stock gtk_entry_get_buffer gtk_entry_get_text_area gtk_entry_set_editing_cancelled gtk_entry_get_overwrite_mode)
AC_CHECK_FUNCS(gtk_layout_get_bin_window)
AC_CHECK_FUNCS(gtk_orientable_set_orientation)
+AC_CHECK_FUNCS(gtk_selection_data_get_data gtk_selection_data_get_length gtk_selection_data_get_target)
AC_CHECK_FUNCS(gtk_table_get_size)
AC_CHECK_FUNCS(gtk_tree_view_column_get_button)
AC_CHECK_FUNCS(gtk_widget_get_visible gtk_widget_set_visible gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gtk_widget_get_can_focus gtk_widget_has_focus gtk_widget_get_style gtk_widget_get_allocation gtk_widget_is_sensitive gtk_widget_set_can_focus gtk_widget_set_can_default gtk_widget_get_realized)
@@ -718,6 +719,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
+AC_MSG_CHECKING([for GtkHandleBox::float_window])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
+ [[GtkHandleBox *hb = NULL;
+ (void)(hb->float_window);]])],
+ [AC_DEFINE(HAVE_GTK_HANDLE_BOX_FLOAT_WINDOW, 1, [Define if GtkHandleBox::float_window exists])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
+
AC_MSG_CHECKING([for GtkTable::nrows])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
[[GtkTable *t = NULL;
diff --git a/src/dead-kittens.h b/src/dead-kittens.h
index 5020e8b..d683dff 100644
--- a/src/dead-kittens.h
+++ b/src/dead-kittens.h
@@ -75,6 +75,18 @@
#define gtk_layout_get_bin_window(x) ((x)->bin_window)
#endif
+#ifndef HAVE_GTK_SELECTION_DATA_GET_DATA
+#define gtk_selection_data_get_data(_s_) ((_s_)->data)
+#endif
+
+#ifndef HAVE_GTK_SELECTION_DATA_GET_LENGTH
+#define gtk_selection_data_get_length(_s_) ((_s_)->length)
+#endif
+
+#ifndef HAVE_GTK_SELECTION_DATA_GET_TARGET
+#define gtk_selection_data_get_target(_s_) ((_s_)->target)
+#endif
+
#ifndef HAVE_GTK_WIDGET_SET_VISIBLE
#define gtk_widget_set_visible(_w_,_v_) do { if (_v_) gtk_widget_show (_w_); else gtk_widget_hide (_w_); } while (0)
#endif
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index fc84075..1b0ffd0 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -1044,7 +1044,7 @@ cb_pane_drag_data_received (GtkWidget *widget, GdkDragContext *context,
double wx, wy;
if (gnm_debug_flag ("dnd")) {
- gchar *target_name = gdk_atom_name (selection_data->target);
+ gchar *target_name = gdk_atom_name (gtk_selection_data_get_target (selection_data));
g_printerr ("drag-data-received - %s\n", target_name);
g_free (target_name);
}
@@ -1062,7 +1062,7 @@ cb_pane_drag_data_get (GtkWidget *widget, GdkDragContext *context,
SheetControlGUI *scg)
{
if (gnm_debug_flag ("dnd")) {
- gchar *target_name = gdk_atom_name (selection_data->target);
+ gchar *target_name = gdk_atom_name (gtk_selection_data_get_target (selection_data));
g_printerr ("drag-data-get - %s \n", target_name);
g_free (target_name);
}
@@ -1335,12 +1335,15 @@ gnm_pane_compute_visible_region (GnmPane *pane,
GocCanvas *canvas = GOC_CANVAS (pane);
gint64 pixels;
int col, row, width, height;
+ GtkAllocation ca;
#if 0
g_warning ("compute_vis(W)[%d] = %d", pane->index,
GTK_WIDGET (pane)->allocation.width);
#endif
+ gtk_widget_get_allocation (GTK_WIDGET (canvas), &ca);
+
/* When col/row sizes change we need to do a full recompute */
if (full_recompute) {
gint64 col_offset = pane->first_offset.x = scg_colrow_distance_get (scg,
@@ -1361,7 +1364,7 @@ gnm_pane_compute_visible_region (GnmPane *pane,
/* Find out the last visible col and the last full visible column */
pixels = 0;
col = pane->first.col;
- width = GTK_WIDGET (canvas)->allocation.width;
+ width = ca.width;
do {
ColRowInfo const * const ci = sheet_col_get_info (sheet, col);
@@ -1394,7 +1397,7 @@ gnm_pane_compute_visible_region (GnmPane *pane,
/* Find out the last visible row and the last fully visible row */
pixels = 0;
row = pane->first.row;
- height = GTK_WIDGET (canvas)->allocation.height;
+ height = ca.height;
do {
ColRowInfo const * const ri = sheet_row_get_info (sheet, row);
if (ri->visible) {
@@ -1530,17 +1533,21 @@ cb_pane_sliding (GnmPane *pane)
int col = -1, row = -1;
Sheet *sheet = scg_sheet (pane->simple.scg);
GnmPaneSlideInfo info;
+ GtkAllocation pa;
#if 0
g_warning ("slide: %d, %d", pane->sliding_dx, pane->sliding_dy);
#endif
+
+ gtk_widget_get_allocation (GTK_WIDGET (pane), &pa);
+
if (pane->sliding_dx > 0) {
GnmPane *target_pane = pane;
slide_x = TRUE;
if (pane_index == 1 || pane_index == 2) {
if (!pane->sliding_adjacent_h) {
- int width = GTK_WIDGET (pane)->allocation.width;
+ int width = pa.width;
int x = pane->first_offset.x + width + pane->sliding_dx;
/* in case pane is narrow */
@@ -1569,7 +1576,13 @@ cb_pane_sliding (GnmPane *pane)
if (pane1 != NULL) {
if (pane_index == 0 || pane_index == 3) {
- int width = GTK_WIDGET (pane1)->allocation.width;
+ GtkAllocation p1a;
+ int width;
+
+ gtk_widget_get_allocation (GTK_WIDGET (pane1),
+ &p1a);
+
+ width = p1a.width;
if (pane->sliding_dx > (-width) &&
col <= pane1->last_visible.col) {
int x = pane1->first_offset.x + width + pane->sliding_dx;
@@ -1594,7 +1607,7 @@ cb_pane_sliding (GnmPane *pane)
slide_y = TRUE;
if (pane_index == 3 || pane_index == 2) {
if (!pane->sliding_adjacent_v) {
- int height = GTK_WIDGET (pane)->allocation.height;
+ int height = pa.height;
int y = pane->first_offset.y + height + pane->sliding_dy;
/* in case pane is short */
@@ -1623,7 +1636,13 @@ cb_pane_sliding (GnmPane *pane)
if (pane3 != NULL) {
if (pane_index == 0 || pane_index == 1) {
- int height = GTK_WIDGET (pane3)->allocation.height;
+ GtkAllocation p3a;
+ int height;
+
+ gtk_widget_get_allocation (GTK_WIDGET (pane3),
+ &p3a);
+
+ height = p3a.height;
if (pane->sliding_dy > (-height) &&
row <= pane3->last_visible.row) {
int y = pane3->first_offset.y + height + pane->sliding_dy;
@@ -1691,6 +1710,7 @@ gnm_pane_handle_motion (GnmPane *pane,
GnmPane *pane0, *pane1, *pane3;
int pindex, width, height;
gint64 dx = 0, dy = 0, left, top;
+ GtkAllocation pa, p0a, p1a, p3a;
g_return_val_if_fail (IS_GNM_PANE (pane), FALSE);
g_return_val_if_fail (GOC_IS_CANVAS (canvas), FALSE);
@@ -1699,12 +1719,18 @@ gnm_pane_handle_motion (GnmPane *pane,
pindex = pane->index;
left = pane->first_offset.x;
top = pane->first_offset.y;
- width = GTK_WIDGET (pane)->allocation.width;
- height = GTK_WIDGET (pane)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (pane), &pa);
+ width = pa.width;
+ height = pa.height;
pane0 = scg_pane (pane->simple.scg, 0);
+ gtk_widget_get_allocation (GTK_WIDGET (pane0), &p0a);
+
pane1 = scg_pane (pane->simple.scg, 1);
+ gtk_widget_get_allocation (GTK_WIDGET (pane1), &p1a);
+
pane3 = scg_pane (pane->simple.scg, 3);
+ gtk_widget_get_allocation (GTK_WIDGET (pane3), &p3a);
if (slide_flags & GNM_PANE_SLIDE_X) {
if (x < left)
@@ -1724,7 +1750,7 @@ gnm_pane_handle_motion (GnmPane *pane,
if (pindex == 0 || pindex == 3) {
if (dx < 0) {
x = pane1->first_offset.x;
- dx += GTK_WIDGET (pane1)->allocation.width;
+ dx += p1a.width;
if (dx > 0)
x += dx;
dx = 0;
@@ -1733,7 +1759,7 @@ gnm_pane_handle_motion (GnmPane *pane,
} else {
if (dx > 0) {
x = pane0->first_offset.x + dx;
- dx -= GTK_WIDGET (pane0)->allocation.width;
+ dx -= p0a.width;
if (dx < 0)
dx = 0;
} else if (dx == 0) {
@@ -1749,7 +1775,7 @@ gnm_pane_handle_motion (GnmPane *pane,
if (pindex == 0 || pindex == 1) {
if (dy < 0) {
y = pane3->first_offset.y;
- dy += GTK_WIDGET (pane3)->allocation.height;
+ dy += p3a.height;
if (dy > 0)
y += dy;
dy = 0;
@@ -1758,7 +1784,7 @@ gnm_pane_handle_motion (GnmPane *pane,
} else {
if (dy > 0) {
y = pane0->first_offset.y + dy;
- dy -= GTK_WIDGET (pane0)->allocation.height;
+ dy -= p0a.height;
if (dy < 0)
dy = 0;
} else if (dy == 0) {
@@ -1859,29 +1885,40 @@ gnm_pane_object_autoscroll (GnmPane *pane, GdkDragContext *context,
GnmPane *pane1 = scg_pane (scg, 1);
GnmPane *pane3 = scg_pane (scg, 3);
GtkWidget *w = GTK_WIDGET (pane);
+ GtkAllocation wa;
gint dx, dy;
- if (y < w->allocation.y) {
- if (pane_index < 2 && pane3 != NULL)
+ gtk_widget_get_allocation (w, &wa);
+
+ if (y < wa.y) {
+ if (pane_index < 2 && pane3 != NULL) {
w = GTK_WIDGET (pane3);
- dy = y - w->allocation.y;
+ gtk_widget_get_allocation (w, &wa);
+ }
+ dy = y - wa.y;
g_return_if_fail (dy <= 0);
- } else if (y >= (w->allocation.y + w->allocation.height)) {
- if (pane_index >= 2)
+ } else if (y >= (wa.y + wa.height)) {
+ if (pane_index >= 2) {
w = GTK_WIDGET (pane0);
- dy = y - (w->allocation.y + w->allocation.height);
+ gtk_widget_get_allocation (w, &wa);
+ }
+ dy = y - (wa.y + wa.height);
g_return_if_fail (dy >= 0);
} else
dy = 0;
- if (x < w->allocation.x) {
- if ((pane_index == 0 || pane_index == 3) && pane1 != NULL)
+ if (x < wa.x) {
+ if ((pane_index == 0 || pane_index == 3) && pane1 != NULL) {
w = GTK_WIDGET (pane1);
- dx = x - w->allocation.x;
+ gtk_widget_get_allocation (w, &wa);
+ }
+ dx = x - wa.x;
g_return_if_fail (dx <= 0);
- } else if (x >= (w->allocation.x + w->allocation.width)) {
- if (pane_index >= 2)
+ } else if (x >= (wa.x + wa.width)) {
+ if (pane_index >= 2) {
w = GTK_WIDGET (pane0);
- dx = x - (w->allocation.x + w->allocation.width);
+ gtk_widget_get_allocation (w, &wa);
+ }
+ dx = x - (wa.x + wa.width);
g_return_if_fail (dx >= 0);
} else
dx = 0;
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index b9a64ce..6009d76 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -188,36 +188,37 @@ text_content_received (GtkClipboard *clipboard, GtkSelectionData *sel,
WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
GnmPasteTarget *pt = ctxt->paste_target;
GnmCellRegion *content = NULL;
+ GdkAtom target = gtk_selection_data_get_target (sel);
if (debug_clipboard ()) {
int maxlen = 1024;
- char *name = gdk_atom_name (sel->target);
+ char *name = gdk_atom_name (gtk_selection_data_get_target (sel));
g_printerr ("Received %d bytes of text for target %s\n",
- sel->length,
+ gtk_selection_data_get_length (sel),
name);
g_free (name);
- if (sel->length > 0) {
- gsf_mem_dump (sel->data, MIN (sel->length, maxlen));
- if (sel->length > maxlen)
+ if (gtk_selection_data_get_length (sel) > 0) {
+ gsf_mem_dump (gtk_selection_data_get_data (sel), MIN (gtk_selection_data_get_length (sel), maxlen));
+ if (gtk_selection_data_get_length (sel) > maxlen)
g_printerr ("...\n");
}
}
/* Nothing on clipboard? */
- if (sel->length < 0) {
+ if (gtk_selection_data_get_length (sel) < 0) {
;
- } else if (sel->target == gdk_atom_intern (UTF8_ATOM_NAME, FALSE)) {
- content = text_to_cell_region (wbcg, (const char *)sel->data, sel->length, "UTF-8", TRUE);
- } else if (sel->target == gdk_atom_intern (CTEXT_ATOM_NAME, FALSE)) {
+ } else if (target == gdk_atom_intern (UTF8_ATOM_NAME, FALSE)) {
+ content = text_to_cell_region (wbcg, (const char *)gtk_selection_data_get_data (sel), gtk_selection_data_get_length (sel), "UTF-8", TRUE);
+ } else if (target == gdk_atom_intern (CTEXT_ATOM_NAME, FALSE)) {
/* COMPOUND_TEXT is icky. Just let GTK+ do the work. */
char *data_utf8 = (char *)gtk_selection_data_get_text (sel);
content = text_to_cell_region (wbcg, data_utf8, strlen (data_utf8), "UTF-8", TRUE);
g_free (data_utf8);
- } else if (sel->target == gdk_atom_intern (STRING_ATOM_NAME, FALSE)) {
+ } else if (target == gdk_atom_intern (STRING_ATOM_NAME, FALSE)) {
char const *locale_encoding;
g_get_charset (&locale_encoding);
- content = text_to_cell_region (wbcg, (const char *)sel->data, sel->length, locale_encoding, FALSE);
+ content = text_to_cell_region (wbcg, (const char *)gtk_selection_data_get_data (sel), gtk_selection_data_get_length (sel), locale_encoding, FALSE);
}
if (content) {
/*
@@ -275,7 +276,7 @@ utf8_content_received (GtkClipboard *clipboard, const gchar *text,
**/
static GnmCellRegion *
table_cellregion_read (WorkbookControl *wbc, char const *reader_id,
- GnmPasteTarget *pt, guchar *buffer, int length)
+ GnmPasteTarget *pt, const guchar *buffer, int length)
{
WorkbookView *wb_view = NULL;
Workbook *wb = NULL;
@@ -344,21 +345,21 @@ image_content_received (GtkClipboard *clipboard, GtkSelectionData *sel,
if (debug_clipboard ()) {
int maxlen = 1024;
- char *name = gdk_atom_name (sel->target);
+ char *name = gdk_atom_name (gtk_selection_data_get_target (sel));
g_printerr ("Received %d bytes of image for target %s\n",
- sel->length,
+ gtk_selection_data_get_length (sel),
name);
g_free (name);
- if (sel->length > 0) {
- gsf_mem_dump (sel->data, MIN (sel->length, maxlen));
- if (sel->length > maxlen)
+ if (gtk_selection_data_get_length (sel) > 0) {
+ gsf_mem_dump (gtk_selection_data_get_data (sel), MIN (gtk_selection_data_get_length (sel), maxlen));
+ if (gtk_selection_data_get_length (sel) > maxlen)
g_printerr ("...\n");
}
}
- if (sel->length > 0) {
+ if (gtk_selection_data_get_length (sel) > 0) {
scg_paste_image (wbcg_cur_scg (wbcg), &pt->range,
- sel->data, sel->length);
+ gtk_selection_data_get_data (sel), gtk_selection_data_get_length (sel));
g_free (ctxt->paste_target);
g_free (ctxt);
} else if (ctxt->string_atom != GDK_NONE) {
@@ -456,25 +457,26 @@ table_content_received (GtkClipboard *clipboard, GtkSelectionData *sel,
WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
GnmPasteTarget *pt = ctxt->paste_target;
GnmCellRegion *content = NULL;
+ GdkAtom target = gtk_selection_data_get_target (sel);
if (debug_clipboard ()) {
int maxlen = 1024;
- char *name = gdk_atom_name (sel->target);
+ char *name = gdk_atom_name (gtk_selection_data_get_target (sel));
g_printerr ("Received %d bytes of table for target %s\n",
- sel->length,
+ gtk_selection_data_get_length (sel),
name);
g_free (name);
- if (sel->length > 0) {
- gsf_mem_dump (sel->data, MIN (sel->length, maxlen));
- if (sel->length > maxlen)
+ if (gtk_selection_data_get_length (sel) > 0) {
+ gsf_mem_dump (gtk_selection_data_get_data (sel), MIN (gtk_selection_data_get_length (sel), maxlen));
+ if (gtk_selection_data_get_length (sel) > maxlen)
g_printerr ("...\n");
}
}
/* Nothing on clipboard? */
- if (sel->length < 0) {
+ if (gtk_selection_data_get_length (sel) < 0) {
;
- } else if (sel->target == gdk_atom_intern (GNUMERIC_ATOM_NAME,
+ } else if (target == gdk_atom_intern (GNUMERIC_ATOM_NAME,
FALSE)) {
/* The data is the gnumeric specific XML interchange format */
GOIOContext *io_context =
@@ -482,37 +484,37 @@ table_content_received (GtkClipboard *clipboard, GtkSelectionData *sel,
content = xml_cellregion_read
(wbc, io_context,
pt->sheet,
- (const char *)sel->data, sel->length);
+ (const char *)gtk_selection_data_get_data (sel), gtk_selection_data_get_length (sel));
g_object_unref (io_context);
- } else if (sel->target == gdk_atom_intern (OOO_ATOM_NAME, FALSE) ||
- sel->target == gdk_atom_intern (OOO_ATOM_NAME_WINDOWS, FALSE) ||
- sel->target == gdk_atom_intern (OOO11_ATOM_NAME, FALSE)) {
+ } else if (target == gdk_atom_intern (OOO_ATOM_NAME, FALSE) ||
+ target == gdk_atom_intern (OOO_ATOM_NAME_WINDOWS, FALSE) ||
+ target == gdk_atom_intern (OOO11_ATOM_NAME, FALSE)) {
content = table_cellregion_read (wbc, "Gnumeric_OpenCalc:openoffice",
- pt, sel->data,
- sel->length);
- } else if (sel->target == gdk_atom_intern (HTML_ATOM_NAME_UNIX, FALSE) ||
- sel->target == gdk_atom_intern (HTML_ATOM_NAME_WINDOWS, FALSE)) {
- size_t length = sel->length;
+ pt, gtk_selection_data_get_data (sel),
+ gtk_selection_data_get_length (sel));
+ } else if (target == gdk_atom_intern (HTML_ATOM_NAME_UNIX, FALSE) ||
+ target == gdk_atom_intern (HTML_ATOM_NAME_WINDOWS, FALSE)) {
+ size_t length = gtk_selection_data_get_length (sel);
size_t start = 0, end = length;
- if (sel->target == gdk_atom_intern (HTML_ATOM_NAME_WINDOWS, FALSE)) {
+ if (target == gdk_atom_intern (HTML_ATOM_NAME_WINDOWS, FALSE)) {
/* See bug 143084 */
- parse_ms_headers (sel->data, length, &start, &end);
+ parse_ms_headers (gtk_selection_data_get_data (sel), length, &start, &end);
}
content = table_cellregion_read (wbc, "Gnumeric_html:html",
pt,
- sel->data + start,
+ gtk_selection_data_get_data (sel) + start,
end - start);
- } else if ((sel->target == gdk_atom_intern ( BIFF8_ATOM_NAME, FALSE)) ||
- (sel->target == gdk_atom_intern ( BIFF8_ATOM_NAME_CITRIX, FALSE)) ||
- (sel->target == gdk_atom_intern ( BIFF5_ATOM_NAME, FALSE)) ||
- (sel->target == gdk_atom_intern ( BIFF4_ATOM_NAME, FALSE)) ||
- (sel->target == gdk_atom_intern ( BIFF3_ATOM_NAME, FALSE)) ||
- (sel->target == gdk_atom_intern ( BIFF_ATOM_NAME, FALSE))) {
+ } else if ((target == gdk_atom_intern ( BIFF8_ATOM_NAME, FALSE)) ||
+ (target == gdk_atom_intern ( BIFF8_ATOM_NAME_CITRIX, FALSE)) ||
+ (target == gdk_atom_intern ( BIFF5_ATOM_NAME, FALSE)) ||
+ (target == gdk_atom_intern ( BIFF4_ATOM_NAME, FALSE)) ||
+ (target == gdk_atom_intern ( BIFF3_ATOM_NAME, FALSE)) ||
+ (target == gdk_atom_intern ( BIFF_ATOM_NAME, FALSE))) {
content = table_cellregion_read (wbc, "Gnumeric_Excel:excel",
- pt, sel->data,
- sel->length);
+ pt, gtk_selection_data_get_data (sel),
+ gtk_selection_data_get_length (sel));
}
if (content) {
/*
@@ -838,7 +840,8 @@ x_clipboard_get_cb (GtkClipboard *gclipboard, GtkSelectionData *selection_data,
Sheet *sheet = gnm_app_clipboard_sheet_get ();
GnmRange const *a = gnm_app_clipboard_area_get ();
GOCmdContext *ctx = cmd_context_stderr_new ();
- gchar *target_name = gdk_atom_name (selection_data->target);
+ GdkAtom target = gtk_selection_data_get_target (selection_data);
+ gchar *target_name = gdk_atom_name (target);
if (debug_clipboard ())
g_printerr ("clipboard target=%s\n", target_name);
@@ -864,7 +867,7 @@ x_clipboard_get_cb (GtkClipboard *gclipboard, GtkSelectionData *selection_data,
goto out;
/* What format does the other application want? */
- if (selection_data->target == gdk_atom_intern (GNUMERIC_ATOM_NAME, FALSE)) {
+ if (target == gdk_atom_intern (GNUMERIC_ATOM_NAME, FALSE)) {
GsfOutputMemory *output = gnm_cellregion_to_xml (clipboard);
if (output) {
gsf_off_t size = gsf_output_size (GSF_OUTPUT (output));
@@ -872,13 +875,13 @@ x_clipboard_get_cb (GtkClipboard *gclipboard, GtkSelectionData *selection_data,
g_printerr ("clipboard .gnumeric of %d bytes\n",
(int)size);
gtk_selection_data_set
- (selection_data, selection_data->target, 8,
+ (selection_data, target, 8,
gsf_output_memory_get_bytes (output),
size);
g_object_unref (output);
to_gnumeric = TRUE;
}
- } else if (selection_data->target == gdk_atom_intern (HTML_ATOM_NAME, FALSE)) {
+ } else if (target == gdk_atom_intern (HTML_ATOM_NAME, FALSE)) {
char *saver_id = (char *) "Gnumeric_html:xhtml_range";
int buffer_size;
guchar *buffer = table_cellregion_write (ctx, clipboard,
@@ -888,7 +891,7 @@ x_clipboard_get_cb (GtkClipboard *gclipboard, GtkSelectionData *selection_data,
g_message ("clipboard html of %d bytes",
buffer_size);
gtk_selection_data_set (selection_data,
- selection_data->target, 8,
+ target, 8,
(guchar *) buffer, buffer_size);
g_free (buffer);
} else if (strcmp (target_name, "application/x-goffice-graph") == 0) {
@@ -899,7 +902,7 @@ x_clipboard_get_cb (GtkClipboard *gclipboard, GtkSelectionData *selection_data,
g_message ("clipboard graph of %d bytes",
buffer_size);
gtk_selection_data_set (selection_data,
- selection_data->target, 8,
+ target, 8,
(guchar *) buffer, buffer_size);
g_free (buffer);
} else if (strncmp (target_name, "image/", 6) == 0) {
@@ -910,7 +913,7 @@ x_clipboard_get_cb (GtkClipboard *gclipboard, GtkSelectionData *selection_data,
g_message ("clipboard image of %d bytes",
buffer_size);
gtk_selection_data_set (selection_data,
- selection_data->target, 8,
+ target, 8,
(guchar *) buffer, buffer_size);
g_free (buffer);
} else if (strcmp (target_name, "SAVE_TARGETS") == 0) {
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 3c4f2a9..a61044e 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -558,14 +558,15 @@ cb_select_all_btn_expose (GtkWidget *widget, GdkEventExpose *event, SheetControl
int offset = scg_sheet (scg)->text_is_rtl ? -1 : 0;
GtkAllocation a;
+ gtk_widget_get_allocation (widget, &a);
+
/* This should be keep in sync with item_bar_cell code (item-bar.c) */
gdk_draw_rectangle (gtk_widget_get_window (widget),
gtk_widget_get_style (widget)->bg_gc[GTK_STATE_ACTIVE],
TRUE,
- offset + 1, 1, widget->allocation.width - 1, widget->allocation.height - 1);
+ offset + 1, 1, a.width - 1, a.height - 1);
/* The widget parameters could be NULL, but if so some themes would emit a warning.
* (Murrine is known to do this: http://bugzilla.gnome.org/show_bug.cgi?id=564410). */
- gtk_widget_get_allocation (widget, &a);
gtk_paint_shadow (gtk_widget_get_style (widget),
gtk_widget_get_window (widget),
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
@@ -646,7 +647,7 @@ cb_table_destroy (SheetControlGUI *scg)
/* Only pane-0 ever gets focus */
if (NULL != toplevel &&
- toplevel->focus_widget == GTK_WIDGET (scg_pane (scg, 0)))
+ gtk_window_get_focus (toplevel) == GTK_WIDGET (scg_pane (scg, 0)))
gtk_window_set_focus (toplevel, NULL);
}
@@ -882,6 +883,7 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
Sheet *sheet;
int new_first_col, new_first_row;
GnmRange range;
+ GtkAllocation ca;
g_return_if_fail (IS_GNM_PANE (pane));
@@ -903,11 +905,13 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
range.start.row = range.end.row = row;
gnm_sheet_merge_find_container (sheet, &range);
+ gtk_widget_get_allocation (GTK_WIDGET (canvas), &ca);
+
/* Find the new pane->first.col */
if (range.start.col < pane->first.col) {
new_first_col = range.start.col;
} else if (range.end.col > pane->last_full.col) {
- int width = GTK_WIDGET (canvas)->allocation.width;
+ int width = ca.width;
ColRowInfo const * const ci = sheet_col_get_info (sheet, range.end.col);
if (ci->size_pixels < width) {
int first_col = (pane->last_visible.col == pane->first.col)
@@ -933,7 +937,7 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
if (range.start.row < pane->first.row) {
new_first_row = range.start.row;
} else if (range.end.row > pane->last_full.row) {
- int height = GTK_WIDGET (canvas)->allocation.height;
+ int height = ca.height;
ColRowInfo const * const ri = sheet_row_get_info (sheet, range.end.row);
if (ri->size_pixels < height) {
int first_row = (pane->last_visible.row == pane->first.row)
@@ -1217,30 +1221,40 @@ resize_pane_pos (SheetControlGUI *scg, GtkPaned *p,
gtk_widget_style_get (GTK_WIDGET (p), "handle-size", &handle, NULL);
pos += handle / 2;
if (vert) {
- pos -= GTK_WIDGET (scg->pane[0]->row.canvas)->allocation.width;
+ GtkAllocation ca;
+ gtk_widget_get_allocation (GTK_WIDGET (scg->pane[0]->row.canvas), &ca);
+ pos -= ca.width;
if (scg->pane[1]) {
- int const w = GTK_WIDGET (scg->pane[1])->allocation.width;
- if (pos < w)
+ GtkAllocation pa;
+ gtk_widget_get_allocation (GTK_WIDGET (scg->pane[1]),
+ &pa);
+
+ if (pos < pa.width)
pane = scg_pane (scg, 1);
else
- pos -= w;
+ pos -= pa.width;
}
pos += pane->first_offset.x;
colrow = gnm_pane_find_col (pane, pos, guide_pos);
} else {
- pos -= GTK_WIDGET (scg->pane[0]->col.canvas)->allocation.height;
+ GtkAllocation ca;
+ gtk_widget_get_allocation (GTK_WIDGET (scg->pane[0]->col.canvas), &ca);
+
+ pos -= ca.height;
if (scg->pane[3]) {
- int const h = GTK_WIDGET (scg->pane[3])->allocation.height;
- if (pos < h)
+ GtkAllocation pa;
+ gtk_widget_get_allocation (GTK_WIDGET (scg->pane[3]),
+ &pa);
+ if (pos < pa.height)
pane = scg_pane (scg, 3);
else
- pos -= h;
+ pos -= pa.height;
}
pos += pane->first_offset.y;
colrow = gnm_pane_find_row (pane, pos, guide_pos);
}
cri = sheet_colrow_get_info (scg_sheet (scg), colrow, vert);
- if (pos >= (*guide_pos + cri->size_pixels/2)) {
+ if (pos >= (*guide_pos + cri->size_pixels / 2)) {
*guide_pos += cri->size_pixels;
colrow++;
}
@@ -3898,15 +3912,15 @@ void
scg_drag_data_received (SheetControlGUI *scg, GtkWidget *source_widget,
double x, double y, GtkSelectionData *selection_data)
{
- gchar *target_type = gdk_atom_name (selection_data->target);
- const char *sel_data = (const char *)selection_data->data;
- gsize sel_len = selection_data->length;
+ gchar *target_type = gdk_atom_name (gtk_selection_data_get_target (selection_data));
+ const char *sel_data = (const char *)gtk_selection_data_get_data (selection_data);
+ gsize sel_len = gtk_selection_data_get_length (selection_data);
if (!strcmp (target_type, "text/uri-list")) {
scg_drag_receive_uri_list (scg, x, y, sel_data, sel_len);
} else if (!strncmp (target_type, "image/", 6)) {
- scg_drag_receive_img_data (scg, x, y, selection_data->data, sel_len);
+ scg_drag_receive_img_data (scg, x, y, sel_data, sel_len);
} else if (!strcmp (target_type, "GNUMERIC_SAME_PROC")) {
scg_drag_receive_same_process (scg, source_widget, x, y);
} else if (!strcmp (target_type, "application/x-gnumeric")) {
@@ -3978,7 +3992,8 @@ scg_drag_send_image (SheetControlGUI *scg,
osize = gsf_output_size (output);
gtk_selection_data_set
- (selection_data, selection_data->target,
+ (selection_data,
+ gtk_selection_data_get_target (selection_data),
8, gsf_output_memory_get_bytes (omem), osize);
gsf_output_close (output);
g_object_unref (output);
@@ -4015,7 +4030,8 @@ scg_drag_send_graph (SheetControlGUI *scg,
osize = gsf_output_size (output);
gtk_selection_data_set
- (selection_data, selection_data->target,
+ (selection_data,
+ gtk_selection_data_get_target (selection_data),
8, gsf_output_memory_get_bytes (omem), osize);
gsf_output_close (output);
g_object_unref (output);
@@ -4033,9 +4049,12 @@ scg_drag_send_clipboard_objects (SheetControl *sc,
return;
output = gnm_cellregion_to_xml (content);
- gtk_selection_data_set (selection_data, selection_data->target, 8,
- gsf_output_memory_get_bytes (output),
- gsf_output_size (GSF_OUTPUT (output)));
+ gtk_selection_data_set
+ (selection_data,
+ gtk_selection_data_get_target (selection_data),
+ 8,
+ gsf_output_memory_get_bytes (output),
+ gsf_output_size (GSF_OUTPUT (output)));
g_object_unref (output);
cellregion_unref (content);
}
@@ -4052,24 +4071,26 @@ scg_drag_send_text (SheetControlGUI *scg, GtkSelectionData *sd)
cellregion_unref (reg);
if (!s)
return;
- gtk_selection_data_set (sd, sd->target, 8, s->str, s->len);
+ gtk_selection_data_set (sd, gtk_selection_data_get_target (sd),
+ 8, s->str, s->len);
g_string_free (s, TRUE);
}
void
scg_drag_data_get (SheetControlGUI *scg, GtkSelectionData *selection_data)
{
- gchar *target_name = gdk_atom_name (selection_data->target);
+ GdkAtom target = gtk_selection_data_get_target (selection_data);
+ gchar *target_name = gdk_atom_name (target);
GSList *objects = scg->selected_objects
? go_hash_keys (scg->selected_objects)
: NULL;
if (strcmp (target_name, "GNUMERIC_SAME_PROC") == 0)
/* Set dummy selection for process internal dnd */
- gtk_selection_data_set (selection_data, selection_data->target,
+ gtk_selection_data_set (selection_data, target,
8, (const guint8 *)"", 1);
else if (strcmp (target_name, "GNUMERIC_SHEET") == 0)
- gtk_selection_data_set (selection_data, selection_data->target,
+ gtk_selection_data_set (selection_data, target,
8, (void *)scg, sizeof (scg));
else if (strcmp (target_name, "application/x-gnumeric") == 0)
scg_drag_send_clipboard_objects (SHEET_CONTROL (scg),
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 9c16bc8..7678922 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -661,8 +661,7 @@ cb_sheet_label_drag_data_received (GtkWidget *widget, GdkDragContext *context,
old_state,
s_src);
} else {
-
- g_return_if_fail (IS_SHEET_CONTROL_GUI (data->data));
+ g_return_if_fail (IS_SHEET_CONTROL_GUI (gtk_selection_data_get_data (data)));
/* Different workbook, same process */
g_warning ("Not yet implemented!");
@@ -735,6 +734,7 @@ cb_sheet_label_drag_motion (GtkWidget *widget, GdkDragContext *context,
SheetControlGUI *scg_src, *scg_dst;
GtkWidget *w_source, *arrow, *window;
gint root_x, root_y, pos_x, pos_y;
+ GtkAllocation wa, wsa;
g_return_val_if_fail (IS_WBC_GTK (wbcg), FALSE);
g_return_val_if_fail (IS_WBC_GTK (wbcg), FALSE);
@@ -757,10 +757,12 @@ cb_sheet_label_drag_motion (GtkWidget *widget, GdkDragContext *context,
/* Move the arrow to the correct position and show it. */
window = gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW);
gtk_window_get_position (GTK_WINDOW (window), &root_x, &root_y);
- pos_x = root_x + widget->allocation.x;
- pos_y = root_y + widget->allocation.y;
- if (w_source->allocation.x < widget->allocation.x)
- pos_x += widget->allocation.width;
+ gtk_widget_get_allocation (widget ,&wa);
+ pos_x = root_x + wa.x;
+ pos_y = root_y + wa.y;
+ gtk_widget_get_allocation (w_source ,&wsa);
+ if (wsa.x < wa.x)
+ pos_x += wa.width;
gtk_window_move (GTK_WINDOW (arrow), pos_x, pos_y);
gtk_widget_show (arrow);
@@ -953,6 +955,7 @@ cb_paned_size_allocate (GtkHPaned *hpaned,
gboolean position_set;
GtkWidget *child1 = gtk_paned_get_child1 (paned);
GtkWidget *child2 = gtk_paned_get_child2 (paned);
+ GtkAllocation pa;
if (child1 == NULL || !gtk_widget_get_visible (child1) ||
child2 == NULL || !gtk_widget_get_visible (child2))
@@ -990,7 +993,9 @@ cb_paned_size_allocate (GtkHPaned *hpaned,
* used for auto-expr and other little things. This helps with
* wide windows.
*/
- wp = gtk_widget_get_parent (GTK_WIDGET (hpaned))->allocation.width;
+ gtk_widget_get_allocation (gtk_widget_get_parent (GTK_WIDGET (hpaned)),
+ &pa);
+ wp = pa.width;
p1 = MAX (p1, w - (wp - w) * 125 / 100);
/* However, never use more for tabs than we want. */
@@ -2286,7 +2291,7 @@ edit_area_button_menu (WBCGtk *wbcg, GtkToolbar *tb,
static void
cb_set_focus (GtkWindow *window, GtkWidget *focus, WBCGtk *wbcg)
{
- if (focus && !window->focus_widget)
+ if (focus && !gtk_window_get_focus (window))
wbcg_focus_cur_scg (wbcg);
}
@@ -2359,13 +2364,12 @@ cb_scroll_wheel (GtkWidget *w, GdkEventScroll *event,
static void
cb_realize (GtkWindow *toplevel, WBCGtk *wbcg)
{
- GtkAllocation *allocation;
+ GtkAllocation ta;
g_return_if_fail (GTK_IS_WINDOW (toplevel));
- allocation = >K_WIDGET (toplevel)->allocation;
- gtk_window_set_default_size (toplevel,
- allocation->width, allocation->height);
+ gtk_widget_get_allocation (GTK_WIDGET (toplevel), &ta);
+ gtk_window_set_default_size (toplevel, ta.width, ta.height);
/* if we are already initialized set the focus. Without this loading a
* multpage book sometimes leaves focus on the last book rather than
@@ -2568,12 +2572,14 @@ wbcg_get_label_for_position (WBCGtk *wbcg, GtkWidget *source,
for (i = 0; i < n; i++) {
GtkWidget *label = gnm_notebook_get_nth_label (wbcg->bnotebook, i);
int x0, x1;
+ GtkAllocation la;
if (!gtk_widget_get_visible (label))
continue;
- x0 = label->allocation.x;
- x1 = x0 + label->allocation.width;
+ gtk_widget_get_allocation (label, &la);
+ x0 = la.x;
+ x1 = x0 + la.width;
if (x <= x1) {
/*
@@ -2636,7 +2642,7 @@ cb_wbcg_drag_data_received (GtkWidget *widget, GdkDragContext *context,
gint x, gint y, GtkSelectionData *selection_data,
guint info, guint time, WBCGtk *wbcg)
{
- gchar *target_type = gdk_atom_name (selection_data->target);
+ gchar *target_type = gdk_atom_name (gtk_selection_data_get_target (selection_data));
if (!strcmp (target_type, "text/uri-list")) { /* filenames from nautilus */
scg_drag_data_received (wbcg_cur_scg (wbcg),
@@ -4021,6 +4027,7 @@ cb_set_toolbar_position (GtkMenuItem *item, WBCGtk *gtk)
set_toolbar_position (tb, side, gtk);
}
+#ifdef HAVE_GTK_HANDLE_BOX_FLOAT_WINDOW
static void
cb_tcm_reattach (GtkWidget *widget, GtkHandleBox *hdlbox)
{
@@ -4031,12 +4038,15 @@ cb_tcm_reattach (GtkWidget *widget, GtkHandleBox *hdlbox)
gtk_main_do_event (event);
gdk_event_free (event);
}
+#endif
static void
cb_tcm_hide (GtkWidget *widget, GtkWidget *box)
{
+#ifdef HAVE_GTK_HANDLE_BOX_FLOAT_WINDOW
if (GTK_IS_HANDLE_BOX (box) && GTK_HANDLE_BOX (box)->child_detached)
cb_tcm_reattach (widget, GTK_HANDLE_BOX (box));
+#endif
gtk_widget_hide (box);
}
@@ -4047,6 +4057,7 @@ toolbar_context_menu (GtkToolbar *tb, WBCGtk *gtk, GdkEventButton *event_button)
GtkWidget *zone = gtk_widget_get_parent (GTK_WIDGET (box));
GtkWidget *menu = gtk_menu_new ();
GtkWidget *item;
+ gboolean detached;
static struct {
char const *text;
@@ -4057,12 +4068,20 @@ toolbar_context_menu (GtkToolbar *tb, WBCGtk *gtk, GdkEventButton *event_button)
{ N_("Display to the right of sheets"), GTK_POS_RIGHT }
};
- if (GTK_IS_HANDLE_BOX (box) && GTK_HANDLE_BOX (box)->child_detached) {
+#ifdef HAVE_GTK_HANDLE_BOX_FLOAT_WINDOW
+ detached = (GTK_IS_HANDLE_BOX (box) &&
+ GTK_HANDLE_BOX (box)->child_detached);
+#else
+ detached = FALSE;
+#endif
+ if (detached) {
+#ifdef HAVE_GTK_HANDLE_BOX_FLOAT_WINDOW
item = gtk_menu_item_new_with_label (_("Reattach to main window"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (cb_tcm_reattach),
box);
+#endif
} else {
size_t ui;
GSList *group = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]