Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r--source/blender/windowmanager/intern/wm_window.c71
1 files changed, 64 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 0664c5ab8bb..6d01620dae8 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1,5 +1,5 @@
/**
- * $Id: wm_window.c
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -729,7 +729,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
CTX_wm_window_set(C, win);
WM_operator_properties_create(&props_ptr, "WM_OT_open_mainfile");
- RNA_string_set(&props_ptr, "path", path);
+ RNA_string_set(&props_ptr, "filepath", path);
WM_operator_name_call(C, "WM_OT_open_mainfile", WM_OP_EXEC_DEFAULT, &props_ptr);
WM_operator_properties_free(&props_ptr);
@@ -739,21 +739,64 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
}
case GHOST_kEventDraggingDropDone:
{
- wmEvent event= *(win->eventstate); /* copy last state, like mouse coords */
+ wmEvent event;
+ GHOST_TEventDragnDropData *ddd= GHOST_GetEventData(evt);
+ int cx, cy, wx, wy;
+
+
+ /* entering window, update mouse pos */
+ GHOST_GetCursorPosition(g_system, &wx, &wy);
+
+ GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy);
+ win->eventstate->x= cx;
+
+#if defined(__APPLE__) && defined(GHOST_COCOA)
+ //Cocoa already uses coordinates with y=0 at bottom
+ win->eventstate->y= cy;
+#else
+ win->eventstate->y= (win->sizey-1) - cy;
+#endif
+
+ event= *(win->eventstate); /* copy last state, like mouse coords */
+
+ // activate region
+ event.type= MOUSEMOVE;
+ event.prevx= event.x;
+ event.prevy= event.y;
+
+ wm->winactive= win; /* no context change! c->wm->windrawable is drawable, or for area queues */
+ win->active= 1;
+
+ wm_event_add(win, &event);
+
/* make blender drop event with custom data pointing to wm drags */
event.type= EVT_DROP;
+ event.val= KM_RELEASE;
event.custom= EVT_DATA_LISTBASE;
event.customdata= &wm->drags;
+ event.customdatafree= 1;
+
+ wm_event_add(win, &event);
- printf("Drop detected\n");
+ /* printf("Drop detected\n"); */
/* add drag data to wm for paths: */
/* need icon type, some dropboxes check for that... see filesel code for this */
- // WM_event_start_drag(C, icon, WM_DRAG_PATH, void *poin, 0.0);
- /* void poin should point to string, it makes a copy */
- wm_event_add(win, &event);
+ if(ddd->dataType == GHOST_kDragnDropTypeFilenames) {
+ GHOST_TStringArray *stra= ddd->data;
+ int a;
+
+ for(a=0; a<stra->count; a++) {
+ printf("drop file %s\n", stra->strings[a]);
+ WM_event_start_drag(C, 0, WM_DRAG_PATH, stra->strings[a], 0.0);
+ /* void poin should point to string, it makes a copy */
+ break; // only one drop element supported now
+ }
+ }
+
+
break;
}
@@ -975,6 +1018,18 @@ void WM_clipboard_text_set(char *buf, int selection)
#endif
}
+/* ******************* progress bar **************** */
+
+void WM_progress_set(wmWindow *win, float progress)
+{
+ GHOST_SetProgressBar(win->ghostwin, progress);
+}
+
+void WM_progress_clear(wmWindow *win)
+{
+ GHOST_EndProgressBar(win->ghostwin);
+}
+
/* ************************************ */
void wm_window_get_position(wmWindow *win, int *posx_r, int *posy_r)
@@ -1057,7 +1112,9 @@ void WM_cursor_warp(wmWindow *win, int x, int y)
if (win && win->ghostwin) {
int oldx=x, oldy=y;
+#if !defined(__APPLE__) || !defined(GHOST_COCOA)
y= win->sizey -y - 1;
+#endif
GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y);
GHOST_SetCursorPosition(g_system, x, y);