Fix [#21775] Double-clicking icons in the file browser doesn't open files

Complicated issue, but this should be correct, and testing goes fine. fingers crossed.
This commit is contained in:
Matt Ebb
2010-04-01 01:27:22 +00:00
parent ea0e0b3f15
commit 8f5438dcd4
2 changed files with 12 additions and 7 deletions

View File

@@ -2073,10 +2073,13 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
/* first handle click on icondrag type button */
if(event->type==LEFTMOUSE && but->dragpoin) {
if(ui_but_mouse_inside_icon(but, data->region, event)) {
/* tell the button to wait and keep checking further events to
* see if it should start dragging */
button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
data->dragstartx= event->x;
data->dragstarty= event->y;
return WM_UI_HANDLER_BREAK;
return WM_UI_HANDLER_CONTINUE;
}
}
@@ -2092,14 +2095,16 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
return WM_UI_HANDLER_BREAK;
}
/* pass on release as press for other keymaps XXX hack alert! */
/* If the mouse has been pressed and released, getting to
* this point without triggering a drag, then clear the
* drag state for this button and continue to pass on the event */
if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
event->val= KM_CLICK;
return WM_UI_HANDLER_CONTINUE;
}
/* while wait drag, always block other events to get handled */
/* while waiting for a drag to be triggered, always block
* other events from getting handled */
return WM_UI_HANDLER_BREAK;
}

View File

@@ -247,10 +247,10 @@ static void wm_drop_operator_draw(char *name, int x, int y)
{
int width= UI_GetStringWidth(name);
glColor4ub(0, 0, 0, 128);
glColor4ub(0, 0, 0, 50);
uiSetRoundBox(15);
uiRoundBox(x, y, x + width + 8, y + 15, 7);
uiSetRoundBox(15+16);
uiRoundBox(x, y, x + width + 8, y + 15, 4);
glColor4ub(255, 255, 255, 255);
UI_DrawString(x+4, y+4, name);