Fixup and improve gtk-touch-workaround

upstream-master
Fabian Keßler 5 years ago committed by Fabian Keßler
parent 45ea715612
commit 04f0389137
  1. 3
      src/gui/Layout.cpp
  2. 24
      src/gui/MainWindow.cpp
  3. 6
      src/gui/widgets/XournalWidget.cpp

@ -168,7 +168,8 @@ void Layout::layoutPages(int width, int height) {
recalculate_int();
}
// Todo: remove, just a hack-hotfix
scrollHandling->setLayoutSize(width, height);
scrollHandling->setLayoutSize(std::max(width, int(unsigned(this->pc.minWidth))),
std::max(height, int(unsigned(this->pc.minHeight))));
size_t const len = this->view->viewPages.size();
Settings* settings = this->view->getControl()->getSettings();

@ -243,23 +243,19 @@ void MainWindow::initXournalWidget() {
usingTouchWorkaround = control->getSettings()->isTouchWorkaround();
if (usingTouchWorkaround) {
GtkWidget* box1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(boxContents), box1);
GtkWidget* box2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add(GTK_CONTAINER(box1), box2);
GtkWidget* grid = gtk_grid_new();
gtk_container_add(GTK_CONTAINER(boxContents), grid);
this->scrollHandling = new ScrollHandlingXournalpp();
this->xournal = new XournalView(box2, control, scrollHandling);
gtk_container_add(GTK_CONTAINER(box2),
gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, scrollHandling->getVertical()));
gtk_container_add(GTK_CONTAINER(box1),
gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, scrollHandling->getHorizontal()));
this->xournal = new XournalView(grid, control, scrollHandling);
control->getZoomControl()->initZoomHandler(this->window, box2, xournal, control);
gtk_widget_show_all(box1);
gtk_grid_attach(GTK_GRID(grid), gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, scrollHandling->getVertical()), //
1, 0, 1, 1);
gtk_grid_attach(GTK_GRID(grid),
gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, scrollHandling->getHorizontal()), //
0, 1, 1, 1);
control->getZoomControl()->initZoomHandler(this->window, grid, xournal, control);
gtk_widget_show_all(grid);
} else {
winXournal = gtk_scrolled_window_new(nullptr, nullptr);

@ -163,12 +163,14 @@ static void gtk_xournal_init(GtkXournal* xournal) {
static void gtk_xournal_get_preferred_width(GtkWidget* widget, gint* minimal_width, gint* natural_width) {
GtkXournal* xournal = GTK_XOURNAL(widget);
*minimal_width = *natural_width = xournal->layout->getMinimalWidth();
*minimal_width = 20;
*natural_width = xournal->layout->getMinimalWidth();
}
static void gtk_xournal_get_preferred_height(GtkWidget* widget, gint* minimal_height, gint* natural_height) {
GtkXournal* xournal = GTK_XOURNAL(widget);
*minimal_height = *natural_height = xournal->layout->getMinimalHeight();
*minimal_height = 20;
*natural_height = xournal->layout->getMinimalHeight();
}
/**

Loading…
Cancel
Save