Added a bunch of gdk_threads_enter() magic. TBD.

presentation
Wilson Brenna 13 years ago
parent 103c9a3936
commit 5b4e8bfb4a
  1. 4
      src/control/tools/Selection.cpp
  2. 2
      src/control/tools/VerticalToolHandler.cpp
  3. 2
      src/gui/dialog/ImagesDialog.cpp
  4. 4
      src/gui/sidebar/previews/SidebarPreviewPage.cpp
  5. 2
      src/gui/toolbarMenubar/ToolZoomSlider.cpp
  6. 2
      src/gui/widgets/SelectColor.cpp
  7. 4
      src/gui/widgets/XournalWidget.cpp
  8. 2
      src/view/DocumentView.cpp

@ -131,7 +131,9 @@ void RectSelection::paint(cairo_t * cr, GdkRectangle * rect, double zoom) {
// set the line always the same size on display
cairo_set_line_width(cr, 1 / zoom);
gdk_threads_enter();
gdk_cairo_set_source_color(cr, &selectionColor);
gdk_threads_leave();
int aX = MIN(this->sx, this->ex);
@ -193,7 +195,9 @@ void RegionSelect::paint(cairo_t * cr, GdkRectangle * rect, double zoom) {
// set the line always the same size on display
cairo_set_line_width(cr, 1 / zoom);
gdk_threads_enter();
gdk_cairo_set_source_color(cr, &selectionColor);
gdk_threads_leave();
RegionPoint * r0 = (RegionPoint *) this->points->data;
cairo_move_to(cr, r0->x, r0->y);

@ -66,6 +66,7 @@ void VerticalToolHandler::paint(cairo_t * cr, GdkRectangle * rect, double zoom)
cairo_set_line_width(cr, 1);
gdk_threads_enter();
gdk_cairo_set_source_color(cr, &selectionColor);
double y;
@ -87,6 +88,7 @@ void VerticalToolHandler::paint(cairo_t * cr, GdkRectangle * rect, double zoom)
cairo_set_source_surface(cr, this->crBuffer, 0, this->endY * zoom);
cairo_paint(cr);
gdk_threads_leave();
}
void VerticalToolHandler::currentPos(double x, double y) {

@ -131,6 +131,7 @@ private:
GtkAllocation alloc;
gtk_widget_get_allocation(this->widget, &alloc);
gdk_threads_enter();
if (this->crBuffer == NULL) {
this->crBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, alloc.width, alloc.height);
@ -191,6 +192,7 @@ private:
cairo_paint(cr);
cairo_destroy(cr);
gdk_threads_leave();
}
public:

@ -90,8 +90,10 @@ void SidebarPreviewPage::paint() {
}
this->firstPainted = true;
gdk_threads_enter();
gdk_window_set_background(widget->window, &widget->style->white);
gtk_widget_queue_draw(this->widget);
gdk_threads_leave();
return;
}
@ -128,6 +130,7 @@ void SidebarPreviewPage::paint() {
repaint();
}
gdk_threads_enter();
cairo_t * cr = gdk_cairo_create(widget->window);
cairo_set_source_surface(cr, this->crBuffer, 0, 0);
cairo_paint(cr);
@ -154,6 +157,7 @@ void SidebarPreviewPage::paint() {
}
cairo_destroy(cr);
gdk_threads_leave();
g_mutex_unlock(this->drawingMutex);
}

@ -60,9 +60,11 @@ void ToolZoomSlider::updateScaleMarks() {
return;
}
gdk_threads_enter();
gtk_scale_clear_marks( GTK_SCALE(this->slider));
gtk_scale_add_mark(GTK_SCALE(this->slider), zoom->getZoom100(), horizontal ? GTK_POS_BOTTOM : GTK_POS_RIGHT, NULL);
gtk_scale_add_mark(GTK_SCALE(this->slider), zoom->getZoomFit(), horizontal ? GTK_POS_BOTTOM : GTK_POS_RIGHT, NULL);
gdk_threads_leave();
}
void ToolZoomSlider::setHorizontal(bool horizontal) {

@ -147,6 +147,7 @@ static gboolean selectcolor_expose(GtkWidget *widget, GdkEventExpose *event) {
static void selectcolor_paint(GtkWidget *widget) {
cairo_t *cr;
gdk_threads_enter();
cr = gdk_cairo_create(widget->window);
cairo_fill(cr);
@ -203,6 +204,7 @@ static void selectcolor_paint(GtkWidget *widget) {
cairo_stroke(cr);
cairo_destroy(cr);
gdk_threads_leave();
}
static void selectcolor_destroy(GtkObject *object) {

@ -617,11 +617,13 @@ cairo_t * gtk_xournal_create_cairo_for(GtkWidget * widget, PageView * view) {
double zoom = xournal->view->getZoom();
// TODO LOW PRIO: stroke draw to this cairo surface look a little different than rendererd to a cairo surface
gdk_threads_enter();
cairo_t * cr = gdk_cairo_create(GTK_WIDGET(widget)->window);
int x = view->getX() - xournal->x;
int y = view->getY() - xournal->y;
cairo_translate(cr, x, y);
cairo_scale(cr, zoom, zoom);
gdk_threads_leave();
return cr;
}
@ -658,6 +660,7 @@ static gboolean gtk_xournal_expose(GtkWidget * widget, GdkEventExpose * event) {
GtkXournal * xournal = GTK_XOURNAL(widget);
gdk_threads_enter();
cairo_t * cr = gdk_cairo_create(GTK_WIDGET(widget)->window);
ArrayIterator<PageView *> it = xournal->view->pageViewIterator();
@ -744,6 +747,7 @@ static gboolean gtk_xournal_expose(GtkWidget * widget, GdkEventExpose * event) {
}
cairo_destroy(cr);
gdk_threads_leave();
return true;
}

@ -261,6 +261,7 @@ void DocumentView::paintBackgroundImage() {
cairo_matrix_t matrix = { 0 };
cairo_get_matrix(cr, &matrix);
gdk_threads_enter();
int width = gdk_pixbuf_get_width(pixbuff);
int height = gdk_pixbuf_get_height(pixbuff);
@ -273,6 +274,7 @@ void DocumentView::paintBackgroundImage() {
cairo_paint(cr);
cairo_set_matrix(cr, &matrix);
gdk_threads_leave();
}
}

Loading…
Cancel
Save