aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk/ScintillaGTK.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/ScintillaGTK.cxx')
-rw-r--r--gtk/ScintillaGTK.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index a67494678..3788275c9 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -238,6 +238,8 @@ private:
gint FocusOutThis(GtkWidget *widget);
static gint FocusOut(GtkWidget *widget, GdkEventFocus *event);
static void SizeRequest(GtkWidget *widget, GtkRequisition *requisition);
+ static void GetPreferredWidth(GtkWidget *widget, gint *minimalWidth, gint *naturalWidth);
+ static void GetPreferredHeight(GtkWidget *widget, gint *minimalHeight, gint *naturalHeight);
static void SizeAllocate(GtkWidget *widget, GtkAllocation *allocation);
gboolean Expose(GtkWidget *widget, GdkEventExpose *ose);
static gboolean ExposeMain(GtkWidget *widget, GdkEventExpose *ose);
@@ -637,6 +639,18 @@ void ScintillaGTK::SizeRequest(GtkWidget *widget, GtkRequisition *requisition) {
gtk_widget_size_request(PWidget(sciThis->scrollbarv), &child_requisition);
}
+void ScintillaGTK::GetPreferredWidth(GtkWidget *widget, gint *minimalWidth, gint *naturalWidth) {
+ GtkRequisition requisition;
+ SizeRequest(widget, &requisition);
+ *minimalWidth = *naturalWidth = requisition.width;
+}
+
+void ScintillaGTK::GetPreferredHeight(GtkWidget *widget, gint *minimalHeight, gint *naturalHeight) {
+ GtkRequisition requisition;
+ SizeRequest(widget, &requisition);
+ *minimalHeight = *naturalHeight = requisition.height;
+}
+
void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) {
ScintillaGTK *sciThis = ScintillaFromWidget(widget);
try {
@@ -2672,7 +2686,12 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_
// in Initialise() may require coordinate translation?)
object_class->finalize = Destroy;
+#if GTK_CHECK_VERSION(3,0,0)
+ widget_class->get_preferred_width = GetPreferredWidth;
+ widget_class->get_preferred_height = GetPreferredHeight;
+#else
widget_class->size_request = SizeRequest;
+#endif
widget_class->size_allocate = SizeAllocate;
widget_class->expose_event = ExposeMain;
widget_class->motion_notify_event = Motion;