diff --git a/src/control/ClipboardHandler.cpp b/src/control/ClipboardHandler.cpp index 5263a2d7..fec18c47 100644 --- a/src/control/ClipboardHandler.cpp +++ b/src/control/ClipboardHandler.cpp @@ -340,7 +340,7 @@ void ClipboardHandler::pasteClipboardContents(GtkClipboard* clipboard, GtkSelect ObjectInputStream in; - if (in.read((const char*) selectionData->data, selectionData->length)) + if (in.read((const char*) gtk_selection_data_get_data(selectionData), gtk_selection_data_get_length(selectionData))) { handler->listener->clipboardPasteXournal(in); } diff --git a/src/control/settings/Settings.cpp b/src/control/settings/Settings.cpp index e90278d5..b934713a 100644 --- a/src/control/settings/Settings.cpp +++ b/src/control/settings/Settings.cpp @@ -1432,6 +1432,9 @@ void Settings::checkCanXInput() { XOJ_CHECK_TYPE(Settings); +#if GTK3_ENABLED + this->canXIput = TRUE; +#else this->canXIput = FALSE; GList* devList = gdk_devices_list(); @@ -1456,6 +1459,7 @@ void Settings::checkCanXInput() } devList = devList->next; } +#endif } void Settings::setMainWndSize(int width, int height) diff --git a/src/gui/widgets/XournalWidget.h b/src/gui/widgets/XournalWidget.h index 6c2da731..0179029a 100644 --- a/src/gui/widgets/XournalWidget.h +++ b/src/gui/widgets/XournalWidget.h @@ -29,6 +29,10 @@ class XournalView; typedef struct _GtkXournal GtkXournal; typedef struct _GtkXournalClass GtkXournalClass; +#if GTK3_ENABLED +#define GtkType GType +#endif + struct _GtkXournal { GtkWidget widget; diff --git a/src/util/XInputUtils.cpp b/src/util/XInputUtils.cpp index 39940744..71e7487a 100644 --- a/src/util/XInputUtils.cpp +++ b/src/util/XInputUtils.cpp @@ -69,7 +69,7 @@ void XInputUtils::fixXInputCoords(GdkEvent* event, GtkWidget* widget) // fix broken events with the core pointer's location if (!finite(axes[0]) || !finite(axes[1]) || (axes[0] == 0. && axes[1] == 0.)) { - gdk_window_get_pointer(GTK_WIDGET(widget)->window, &ix, &iy, NULL); + gdk_window_get_pointer(gtk_widget_get_parent_window(GTK_WIDGET(widget)), &ix, &iy, NULL); *px = ix; *py = iy; } @@ -90,7 +90,7 @@ void XInputUtils::fixXInputCoords(GdkEvent* event, GtkWidget* widget) #else if (!finite(*px) || !finite(*py) || (*px == 0. && *py == 0.)) { - gdk_window_get_pointer(GTK_WIDGET(widget)->window, &ix, &iy, NULL); + gdk_window_get_pointer(gtk_widget_get_parent_window(GTK_WIDGET(widget)), &ix, &iy, NULL); *px = ix; *py = iy; } @@ -100,7 +100,7 @@ void XInputUtils::fixXInputCoords(GdkEvent* event, GtkWidget* widget) GdkWindow isn't even the same for ButtonDown as for MotionNotify... */ if (gtk_major_version == 2 && gtk_minor_version == 17) // GTK+ 2.17 issues !! { - gdk_window_get_position(GTK_WIDGET(widget)->window, &wx, &wy); + gdk_window_get_position(gtk_widget_get_parent_window(GTK_WIDGET(widget)), &wx, &wy); *px += wx; *py += wy; } @@ -147,6 +147,7 @@ void XInputUtils::handleScrollEvent(GdkEventButton* event, GtkWidget* widget) gboolean XInputUtils::onMouseEnterNotifyEvent(GtkWidget* widget, GdkEventCrossing* event) { +#if !GTK3_ENABLED if (!XInputUtils::enableLeafEnterWorkaround) { return FALSE; @@ -168,11 +169,15 @@ gboolean XInputUtils::onMouseEnterNotifyEvent(GtkWidget* widget, GdkEventCrossin gdk_flush(); gdk_error_trap_pop(); } + +#endif return FALSE; } gboolean XInputUtils::onMouseLeaveNotifyEvent(GtkWidget* widget, GdkEventCrossing* event) { +#if !GTK3_ENABLED + if (!XInputUtils::enableLeafEnterWorkaround) { return FALSE; @@ -195,5 +200,7 @@ gboolean XInputUtils::onMouseLeaveNotifyEvent(GtkWidget* widget, GdkEventCrossin gdk_flush(); gdk_error_trap_pop(); } + +#endif return FALSE; }