diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/PlatGTK.cxx | 24 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 26 |
2 files changed, 37 insertions, 13 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index a89b1e4f5..0a7806f19 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -2023,11 +2023,17 @@ PRectangle Window::GetPosition() { // Before any size allocated pretend its 1000 wide so not scrolled PRectangle rc(0, 0, 1000, 1000); if (wid) { - rc.left = PWidget(wid)->allocation.x; - rc.top = PWidget(wid)->allocation.y; - if (PWidget(wid)->allocation.width > 20) { - rc.right = rc.left + PWidget(wid)->allocation.width; - rc.bottom = rc.top + PWidget(wid)->allocation.height; + GtkAllocation allocation; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_allocation(PWidget(wid), &allocation); +#else + allocation = PWidget(wid)->allocation; +#endif + rc.left = allocation.x; + rc.top = allocation.y; + if (allocation.width > 20) { + rc.right = rc.left + allocation.width; + rc.bottom = rc.top + allocation.height; } } return rc; @@ -2378,10 +2384,18 @@ PRectangle ListBoxX::GetDesiredRect() { gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0); gtk_tree_view_column_cell_get_size(column, NULL, NULL, NULL, &row_width, &row_height); +#if GTK_CHECK_VERSION(3,0,0) + GtkStyle *styleList = gtk_widget_get_style(PWidget(list)); + int ythickness = styleList->ythickness; + height = (rows * row_height + + 2 * (ythickness + + gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))) + 1)); +#else int ythickness = PWidget(list)->style->ythickness; height = (rows * row_height + 2 * (ythickness + GTK_CONTAINER(PWidget(list))->border_width + 1)); +#endif gtk_widget_set_size_request(GTK_WIDGET(PWidget(list)), -1, height); // Get the size of the scroller because we set usize on the window diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index edbdd7a3a..d121326c8 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -394,10 +394,16 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) { #endif GdkWindowAttr attrs; attrs.window_type = GDK_WINDOW_CHILD; - attrs.x = widget->allocation.x; - attrs.y = widget->allocation.y; - attrs.width = widget->allocation.width; - attrs.height = widget->allocation.height; + GtkAllocation allocation; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_get_allocation(widget, &allocation); +#else + allocation = widget->allocation; +#endif + attrs.x = allocation.x; + attrs.y = allocation.y; + attrs.width = allocation.width; + attrs.height = allocation.height; attrs.wclass = GDK_INPUT_OUTPUT; attrs.visual = gtk_widget_get_visual(widget); attrs.colormap = gtk_widget_get_colormap(widget); @@ -634,13 +640,17 @@ void ScintillaGTK::SizeRequest(GtkWidget *widget, GtkRequisition *requisition) { void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { ScintillaGTK *sciThis = ScintillaFromWidget(widget); try { +#if GTK_CHECK_VERSION(2,20,0) + gtk_widget_set_allocation(widget, allocation); +#else widget->allocation = *allocation; +#endif if (IS_WIDGET_REALIZED(widget)) gdk_window_move_resize(WindowFromWidget(widget), - widget->allocation.x, - widget->allocation.y, - widget->allocation.width, - widget->allocation.height); + allocation->x, + allocation->y, + allocation->width, + allocation->height); sciThis->Resize(allocation->width, allocation->height); |