index 1c1171d35c0c474626f28ac626aada592f0ab71c..edd429f0d10b2a40cd4a2dc7aefef865172eaf68 100644 (file)
canvas->need_repick = TRUE;
+ // See comment at in sp-canvas.h.
+ canvas->gen_all_enter_events = false;
+
canvas->tiles=NULL;
canvas->tLeft=canvas->tTop=canvas->tRight=canvas->tBottom=0;
canvas->tileH=canvas->tileV=0;
static int
pick_current_item (SPCanvas *canvas, GdkEvent *event)
{
+ int button_down = 0;
double x, y;
int retval = FALSE;
+ if (canvas->gen_all_enter_events == false) {
+ // If a button is down, we'll perform enter and leave events on the
+ // current item, but not enter on any other item. This is more or
+ // less like X pointer grabbing for canvas items.
+ //
+ button_down = canvas->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK |
+ GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK);
+
+ if (!button_down) canvas->left_grabbed_item = FALSE;
+ }
+
/* Save the event in the canvas. This is used to synthesize enter and
* leave events in case the current item changes. It is also used to
* re-pick the current item if the current one gets deleted. Also,
canvas->in_repick = FALSE;
}
+ if (canvas->gen_all_enter_events == false) {
+ // new_current_item may have been set to NULL during the call to
+ // emit_event() above
+ if ((canvas->new_current_item != canvas->current_item) && button_down) {
+ canvas->left_grabbed_item = TRUE;
+ return retval;
+ }
+ }
+
/* Handle the rest of cases */
canvas->left_grabbed_item = FALSE;
buf.rect.y0 = y0;
buf.rect.x1 = x1;
buf.rect.y1 = y1;
+ buf.visible_rect.x0 = draw_x1;
+ buf.visible_rect.y0 = draw_y1;
+ buf.visible_rect.x1 = draw_x2;
+ buf.visible_rect.y1 = draw_y2;
GdkColor *color = &widget->style->bg[GTK_STATE_NORMAL];
buf.bg_color = (((color->red & 0xff00) << 8)
| (color->green & 0xff00)