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')
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/WM_keymap.h6
-rw-r--r--source/blender/windowmanager/WM_types.h38
-rw-r--r--source/blender/windowmanager/intern/wm.c31
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c58
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c66
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c10
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c438
-rw-r--r--source/blender/windowmanager/intern/wm_files.c131
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c12
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c20
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c46
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c108
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c72
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c168
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c34
-rw-r--r--source/blender/windowmanager/intern/wm_window.c256
-rw-r--r--source/blender/windowmanager/wm.h4
-rw-r--r--source/blender/windowmanager/wm_cursors.h36
-rw-r--r--source/blender/windowmanager/wm_event_types.h2
20 files changed, 805 insertions, 733 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 21e050e8e14..267aa448dc3 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -142,7 +142,7 @@ enum {
struct wmWindow *WM_window_open(struct bContext *C, const struct rcti *rect);
struct wmWindow *WM_window_open_temp(struct bContext *C, int x, int y, int sizex, int sizey, int type);
void WM_window_set_dpi(wmWindow *win);
-
+
bool WM_stereo3d_enabled(struct wmWindow *win, bool only_fullscreen_test);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 04ea8611dcc..9390db400d2 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -58,9 +58,9 @@ void WM_keyconfig_update_operatortype(void);
void WM_keymap_init (struct bContext *C);
void WM_keymap_free (struct wmKeyMap *keymap);
-wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, const char *idname, int type,
+wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, const char *idname, int type,
int val, int modifier, int keymodifier);
-wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, int type,
+wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, int type,
int val, int modifier, int keymodifier);
wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, int type,
int val, int modifier, int keymodifier);
@@ -79,7 +79,7 @@ wmKeyMap *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap);
wmKeyMap *WM_keymap_guess_opname(const struct bContext *C, const char *opname);
bool WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap);
bool WM_keymap_poll(struct bContext *C, struct wmKeyMap *keymap);
-
+
wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id);
int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 81018348ca0..929617aab04 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -200,6 +200,7 @@ typedef enum eOperatorPropTags {
#define KM_RELEASE 2
#define KM_CLICK 3
#define KM_DBL_CLICK 4
+#define KM_CLICK_DRAG 5
/* ************** UI Handler ***************** */
@@ -211,14 +212,14 @@ typedef enum eOperatorPropTags {
typedef struct wmNotifier {
struct wmNotifier *next, *prev;
-
+
struct wmWindowManager *wm;
struct wmWindow *window;
-
+
unsigned int category, data, subtype, action;
-
+
void *reference;
-
+
} wmNotifier;
@@ -335,7 +336,7 @@ typedef struct wmNotifier {
/* NC_TEXT Text */
#define ND_CURSOR (50<<16)
#define ND_DISPLAY (51<<16)
-
+
/* NC_ANIMATION Animato */
#define ND_KEYFRAME (70<<16)
#define ND_KEYFRAME_PROP (71<<16)
@@ -433,7 +434,7 @@ typedef struct wmGesture {
uint is_active : 1;
/* Use for gestures that support both immediate or delayed activation. */
uint wait_for_input : 1;
-
+
void *customdata;
/* customdata for border is a recti */
/* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
@@ -451,7 +452,7 @@ typedef struct wmGesture {
/* event comes from eventmanager and from keymap */
typedef struct wmEvent {
struct wmEvent *next, *prev;
-
+
short type; /* event code itself (short, is also in keymap) */
short val; /* press, release, scrollvalue */
int x, y; /* mouse pointer position, screen coord */
@@ -468,13 +469,14 @@ typedef struct wmEvent {
int prevx, prevy;
double prevclicktime;
int prevclickx, prevclicky;
-
+
/* modifier states */
short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
short keymodifier; /* rawkey modifier */
-
+
/* set in case a KM_PRESS went by unhandled */
char check_click;
+ char check_drag;
char is_motion_absolute;
/* keymap item, set by handler (weak?) */
@@ -488,7 +490,7 @@ typedef struct wmEvent {
short customdatafree;
int pad2;
void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
-
+
} wmEvent;
/* ************** custom wmEvent data ************** */
@@ -527,17 +529,17 @@ typedef enum { /* Timer flags */
typedef struct wmTimer {
struct wmTimer *next, *prev;
-
+
struct wmWindow *win; /* window this timer is attached to (optional) */
double timestep; /* set by timer user */
int event_type; /* set by timer user, goes to event system */
wmTimerFlags flags; /* Various flags controlling timer options, see below. */
void *customdata; /* set by timer user, to allow custom values */
-
+
double duration; /* total running time in seconds */
double delta; /* time since previous step in seconds */
-
+
double ltime; /* internal, last time timer was activated */
double ntime; /* internal, next time we want to activate the timer */
double stime; /* internal, when the timer started */
@@ -653,16 +655,16 @@ typedef enum wmDragFlags {
typedef struct wmDrag {
struct wmDrag *next, *prev;
-
+
int icon, type; /* type, see WM_DRAG defines above */
void *poin;
char path[1024]; /* FILE_MAX */
double value;
-
+
struct ImBuf *imb; /* if no icon but imbuf should be drawn around cursor */
float scale;
int sx, sy;
-
+
char opname[200]; /* if set, draws operator name*/
unsigned int flags;
} wmDrag;
@@ -671,13 +673,13 @@ typedef struct wmDrag {
/* allocation and free is on startup and exit */
typedef struct wmDropBox {
struct wmDropBox *next, *prev;
-
+
/* test if the dropbox is active, then can print optype name */
int (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
/* before exec, this copies drag info to wmDrop properties */
void (*copy)(struct wmDrag *, struct wmDropBox *);
-
+
/* if poll survives, operator is called */
wmOperatorType *ot; /* not saved in file, so can be pointer */
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index b6a12acd57d..6a42bf26a97 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -106,7 +106,7 @@ void WM_operator_free(wmOperator *op)
WM_operator_free(opm);
}
}
-
+
MEM_freeN(op);
}
@@ -192,11 +192,11 @@ void wm_operator_register(bContext *C, wmOperator *op)
void WM_operator_stack_clear(wmWindowManager *wm)
{
wmOperator *op;
-
+
while ((op = BLI_pophead(&wm->operators))) {
WM_operator_free(op);
}
-
+
WM_main_add_notifier(NC_WM | ND_HISTORY, NULL);
}
@@ -372,7 +372,7 @@ void WM_keymap_init(bContext *C)
wm->addonconf = WM_keyconfig_new(wm, "Blender Addon");
if (!wm->userconf)
wm->userconf = WM_keyconfig_new(wm, "Blender User");
-
+
/* initialize only after python init is done, for keymaps that
* use python operators */
if (CTX_py_init_get(C) && (wm->initialized & WM_KEYMAP_IS_INITIALIZED) == 0) {
@@ -394,8 +394,9 @@ void WM_keymap_init(bContext *C)
void WM_check(bContext *C)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
-
+
/* wm context */
if (wm == NULL) {
wm = CTX_data_main(C)->wm.first;
@@ -424,7 +425,7 @@ void WM_check(bContext *C)
/* case: fileread */
/* note: this runs in bg mode to set the screen context cb */
if ((wm->initialized & WM_WINDOW_IS_INITIALIZED) == 0) {
- ED_screens_initialize(wm);
+ ED_screens_initialize(bmain, wm);
wm->initialized |= WM_WINDOW_IS_INITIALIZED;
}
}
@@ -433,7 +434,7 @@ void wm_clear_default_size(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
-
+
/* wm context */
if (wm == NULL) {
wm = CTX_data_main(C)->wm.first;
@@ -443,7 +444,7 @@ void wm_clear_default_size(bContext *C)
if (wm == NULL || BLI_listbase_is_empty(&wm->windows)) {
return;
}
-
+
for (win = wm->windows.first; win; win = win->next) {
win->sizex = 0;
win->sizey = 0;
@@ -489,7 +490,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
WM_window_set_active_workspace(win, NULL); /* prevent draw clear to use screen */
wm_window_free(C, wm, win);
}
-
+
while ((op = BLI_pophead(&wm->operators))) {
WM_operator_free(op);
}
@@ -507,7 +508,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
BLI_freelistN(&wm->paintcursors);
WM_drag_free_list(&wm->drags);
-
+
wm_reports_free(wm);
if (wm->undo_stack) {
@@ -537,16 +538,16 @@ void WM_main(bContext *C)
wm_event_do_refresh_wm_and_depsgraph(C);
while (1) {
-
+
/* get events from ghost, handle window events, add to window queues */
- wm_window_process_events(C);
-
+ wm_window_process_events(C);
+
/* per window, all events to the window, screen, area and region handlers */
wm_event_do_handlers(C);
-
+
/* events have left notes about changes, we handle and cache it */
wm_event_do_notifiers(C);
-
+
/* execute cached changes draw */
wm_draw_update(C);
}
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 67b04662154..f13dac9cb4c 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -41,7 +41,7 @@
#include "BLI_sys_types.h"
#include "DNA_listBase.h"
-#include "DNA_userdef_types.h"
+#include "DNA_userdef_types.h"
#include "DNA_workspace_types.h"
#include "BKE_context.h"
@@ -58,7 +58,7 @@
/* Some simple ghost <-> blender conversions */
-static GHOST_TStandardCursor convert_cursor(int curs)
+static GHOST_TStandardCursor convert_cursor(int curs)
{
switch (curs) {
default:
@@ -79,23 +79,23 @@ static GHOST_TStandardCursor convert_cursor(int curs)
}
}
-static void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2],
+static void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2],
unsigned char bitmap[16][2], int hotx, int hoty)
{
GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
}
-static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
+static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
{
if (useBig) {
- GHOST_SetCustomCursorShapeEx(win->ghostwin,
+ GHOST_SetCustomCursorShapeEx(win->ghostwin,
(GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask,
cursor->big_sizex, cursor->big_sizey,
cursor->big_hotx, cursor->big_hoty,
cursor->fg_color, cursor->bg_color);
}
else {
- GHOST_SetCustomCursorShapeEx(win->ghostwin,
+ GHOST_SetCustomCursorShapeEx(win->ghostwin,
(GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
cursor->small_sizex, cursor->small_sizey,
cursor->small_hotx, cursor->small_hoty,
@@ -132,12 +132,12 @@ void WM_cursor_set(wmWindow *win, int curs)
#endif
GHOST_SetCursorVisibility(win->ghostwin, 1);
-
+
if (curs == CURSOR_STD && win->modalcursor)
curs = win->modalcursor;
-
+
win->cursor = curs;
-
+
/* detect if we use system cursor or Blender cursor */
if (curs >= BC_GHOST_CURSORS) {
GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
@@ -196,7 +196,7 @@ void WM_cursor_wait(bool val)
if (!G.background) {
wmWindowManager *wm = G.main->wm.first;
wmWindow *win = wm ? wm->windows.first : NULL;
-
+
for (; win; win = win->next) {
if (val) {
WM_cursor_modal_set(win, BC_WAITCURSOR);
@@ -214,7 +214,7 @@ void WM_cursor_wait(bool val)
void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4])
{
/* Only grab cursor when not running debug.
- * It helps not to get a stuck WM when hitting a breakpoint
+ * It helps not to get a stuck WM when hitting a breakpoint
* */
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
@@ -222,7 +222,7 @@ void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4])
wm_cursor_position_to_ghost(win, &bounds[0], &bounds[1]);
wm_cursor_position_to_ghost(win, &bounds[2], &bounds[3]);
}
-
+
if (hide) {
mode = GHOST_kGrabHide;
}
@@ -311,12 +311,12 @@ void WM_cursor_time(wmWindow *win, int nr)
unsigned char mask[16][2];
unsigned char bitmap[16][2] = {{0}};
int i, idx;
-
+
if (win->lastcursor == 0)
win->lastcursor = win->cursor;
-
+
memset(&mask, 0xFF, sizeof(mask));
-
+
/* print number bottom right justified */
for (idx = 3; nr && idx >= 0; idx--) {
const char *digit = number_bitmaps[nr % 10];
@@ -327,7 +327,7 @@ void WM_cursor_time(wmWindow *win, int nr)
bitmap[i + y * 8][x] = digit[i];
nr /= 10;
}
-
+
window_set_custom_cursor(win, mask, bitmap, 7, 7);
}
@@ -441,7 +441,7 @@ BEGIN_CURSOR_BLOCK
};
BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
-
+
END_CURSOR_BLOCK
/********************** EW_ARROW Cursor *************************/
BEGIN_CURSOR_BLOCK
@@ -462,7 +462,7 @@ BEGIN_CURSOR_BLOCK
static BCursor EWArrowCursor = {
/*small*/
ew_sbm, ew_smsk,
- 16, 16,
+ 16, 16,
7, 6,
/*big*/
NULL, NULL,
@@ -532,7 +532,7 @@ BEGIN_CURSOR_BLOCK
static BCursor WaitCursor = {
/*small*/
wait_sbm, wait_smsk,
- 16, 16,
+ 16, 16,
7, 7,
/*big*/
wait_lbm, wait_lmsk,
@@ -601,7 +601,7 @@ BEGIN_CURSOR_BLOCK
static BCursor CrossCursor = {
/*small*/
cross_sbm, cross_smsk,
- 16, 16,
+ 16, 16,
7, 7,
/*big*/
cross_lbm, cross_lmsk,
@@ -633,7 +633,7 @@ BEGIN_CURSOR_BLOCK
static BCursor EditCrossCursor = {
/*small*/
editcross_sbm, editcross_smsk,
- 16, 16,
+ 16, 16,
9, 8,
/*big*/
NULL, NULL,
@@ -666,7 +666,7 @@ BEGIN_CURSOR_BLOCK
static BCursor BoxSelCursor = {
/*small*/
box_sbm, box_smsk,
- 16, 16,
+ 16, 16,
9, 8,
/*big*/
NULL, NULL,
@@ -738,7 +738,7 @@ BEGIN_CURSOR_BLOCK
static BCursor KnifeCursor = {
/*small*/
knife_sbm, knife_smsk,
- 16, 16,
+ 16, 16,
0, 15,
/*big*/
knife_lbm, knife_lmsk,
@@ -751,7 +751,7 @@ BEGIN_CURSOR_BLOCK
BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
END_CURSOR_BLOCK
-
+
/********************** Loop Select Cursor ***********************/
BEGIN_CURSOR_BLOCK
@@ -814,7 +814,7 @@ BEGIN_CURSOR_BLOCK
static BCursor VLoopCursor = {
/*small*/
vloop_sbm, vloop_smsk,
- 16, 16,
+ 16, 16,
0, 0,
/*big*/
vloop_lbm, vloop_lmsk,
@@ -827,7 +827,7 @@ BEGIN_CURSOR_BLOCK
BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
END_CURSOR_BLOCK
-
+
/********************** TextEdit Cursor ***********************/
BEGIN_CURSOR_BLOCK
@@ -848,7 +848,7 @@ BEGIN_CURSOR_BLOCK
static BCursor TextEditCursor = {
/*small*/
textedit_sbm, textedit_smsk,
- 16, 16,
+ 16, 16,
9, 8,
/*big*/
NULL, NULL,
@@ -887,7 +887,7 @@ BEGIN_CURSOR_BLOCK
static BCursor PaintBrushCursor = {
/*small*/
paintbrush_sbm, paintbrush_smsk,
- 16, 16,
+ 16, 16,
0, 15,
/*big*/
NULL, NULL,
@@ -1060,7 +1060,7 @@ BEGIN_CURSOR_BLOCK
0x7e, 0x00, 0x3f, 0x00, 0x0c, 0x00, 0x04, 0x00,
};
-
+
static BCursor EyedropperCursor = {
/*small*/
eyedropper_sbm, eyedropper_smsk,
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 319ce99f700..16ed51cbd80 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -69,29 +69,29 @@ static ListBase dropboxes = {NULL, NULL};
typedef struct wmDropBoxMap {
struct wmDropBoxMap *next, *prev;
-
+
ListBase dropboxes;
short spaceid, regionid;
char idname[KMAP_MAX_NAME];
-
+
} wmDropBoxMap;
/* spaceid/regionid is zero for window drop maps */
ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
{
wmDropBoxMap *dm;
-
+
for (dm = dropboxes.first; dm; dm = dm->next)
if (dm->spaceid == spaceid && dm->regionid == regionid)
if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME))
return &dm->dropboxes;
-
+
dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
dm->spaceid = spaceid;
dm->regionid = regionid;
BLI_addtail(&dropboxes, dm);
-
+
return &dm->dropboxes;
}
@@ -101,31 +101,31 @@ wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext
void (*copy)(wmDrag *, wmDropBox *))
{
wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
-
+
drop->poll = poll;
drop->copy = copy;
drop->ot = WM_operatortype_find(idname, 0);
drop->opcontext = WM_OP_INVOKE_DEFAULT;
-
+
if (drop->ot == NULL) {
MEM_freeN(drop);
printf("Error: dropbox with unknown operator: %s\n", idname);
return NULL;
}
WM_operator_properties_alloc(&(drop->ptr), &(drop->properties), idname);
-
+
BLI_addtail(lb, drop);
-
+
return drop;
}
void wm_dropbox_free(void)
{
wmDropBoxMap *dm;
-
+
for (dm = dropboxes.first; dm; dm = dm->next) {
wmDropBox *drop;
-
+
for (drop = dm->dropboxes.first; drop; drop = drop->next) {
if (drop->ptr) {
WM_operator_properties_free(drop->ptr);
@@ -134,7 +134,7 @@ void wm_dropbox_free(void)
}
BLI_freelistN(&dm->dropboxes);
}
-
+
BLI_freelistN(&dropboxes);
}
@@ -145,10 +145,10 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
{
wmWindowManager *wm = CTX_wm_manager(C);
wmDrag *drag = MEM_callocN(sizeof(struct wmDrag), "new drag");
-
+
/* keep track of future multitouch drag too, add a mousepointer id or so */
/* if multiple drags are added, they're drawn as list */
-
+
BLI_addtail(&wm->drags, drag);
drag->flags = flags;
drag->icon = icon;
@@ -158,7 +158,7 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
else
drag->poin = poin;
drag->value = value;
-
+
return drag;
}
@@ -211,13 +211,13 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
const char *name;
-
+
name = dropbox_active(C, &win->handlers, drag, event);
if (name) return name;
-
+
name = dropbox_active(C, &sa->handlers, drag, event);
if (name) return name;
-
+
name = dropbox_active(C, &ar->handlers, drag, event);
if (name) return name;
@@ -234,16 +234,16 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e
/* for multiwin drags, we only do this if mouse inside */
if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y)
return;
-
+
drag->opname[0] = 0;
-
+
/* check buttons (XXX todo rna and value) */
if (UI_but_active_drop_name(C)) {
BLI_strncpy(drag->opname, IFACE_("Paste name"), sizeof(drag->opname));
}
else {
const char *opname = wm_dropbox_active(C, drag, event);
-
+
if (opname) {
BLI_strncpy(drag->opname, opname, sizeof(drag->opname));
// WM_cursor_modal_set(win, CURSOR_COPY);
@@ -259,7 +259,7 @@ void wm_drags_check_ops(bContext *C, const wmEvent *event)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmDrag *drag;
-
+
for (drag = wm->drags.first; drag; drag = drag->next) {
wm_drop_operator_options(C, drag, event);
}
@@ -312,25 +312,25 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
wmDrag *drag;
const int winsize_y = WM_window_pixels_y(win);
int cursorx, cursory, x, y;
-
+
cursorx = win->eventstate->x;
cursory = win->eventstate->y;
if (rect) {
rect->xmin = rect->xmax = cursorx;
rect->ymin = rect->ymax = cursory;
}
-
+
/* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */
glEnable(GL_BLEND);
for (drag = wm->drags.first; drag; drag = drag->next) {
int iconsize = UI_DPI_ICON_SIZE;
int padding = 4 * UI_DPI_FAC;
-
+
/* image or icon */
if (drag->imb) {
x = cursorx - drag->sx / 2;
y = cursory - drag->sy / 2;
-
+
if (rect)
drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy);
else {
@@ -343,13 +343,13 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
else {
x = cursorx - 2 * padding;
y = cursory - 2 * UI_DPI_FAC;
-
+
if (rect)
drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
else
UI_icon_draw_aspect(x, y, drag->icon, 1.0f / UI_DPI_FAC, 0.8);
}
-
+
/* item name */
if (drag->imb) {
x = cursorx - drag->sx / 2;
@@ -359,7 +359,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
x = cursorx + 10 * UI_DPI_FAC;
y = cursory + 1 * UI_DPI_FAC;
}
-
+
if (rect) {
int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
@@ -368,7 +368,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
const unsigned char col[] = {255, 255, 255, 255};
UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), col);
}
-
+
/* operator name with roundbox */
if (drag->opname[0]) {
if (drag->imb) {
@@ -389,14 +389,14 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
y = (cursory - iconsize) - padding;
}
}
-
+
if (rect) {
int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
}
- else
+ else
wm_drop_operator_draw(drag->opname, x, y);
-
+
}
}
glDisable(GL_BLEND);
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 3ce64926a95..df958f35e91 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -755,7 +755,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
if (do_draw)
return true;
-
+
if (screen->do_refresh)
return true;
if (screen->do_draw)
@@ -766,7 +766,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
return true;
if (screen->do_draw_drag)
return true;
-
+
return false;
}
@@ -788,7 +788,7 @@ void wm_draw_update(bContext *C)
#endif
GPU_free_unused_buffers();
-
+
for (win = wm->windows.first; win; win = win->next) {
#ifdef WIN32
GHOST_TWindowState state = GHOST_GetWindowState(win->ghostwin);
@@ -806,7 +806,7 @@ void wm_draw_update(bContext *C)
bScreen *screen = WM_window_get_active_screen(win);
CTX_wm_window_set(C, win);
-
+
/* sets context window+screen */
wm_window_make_drawable(wm, win);
@@ -818,7 +818,7 @@ void wm_draw_update(bContext *C)
screen->do_draw_gesture = false;
screen->do_draw_paintcursor = false;
screen->do_draw_drag = false;
-
+
wm_window_swap_buffers(win);
CTX_wm_window_set(C, NULL);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 31b51fce858..1e3a08bdcbc 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -105,7 +105,7 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
wmEvent *wm_event_add_ex(wmWindow *win, const wmEvent *event_to_add, const wmEvent *event_to_add_after)
{
wmEvent *event = MEM_mallocN(sizeof(wmEvent), "wmEvent");
-
+
*event = *event_to_add;
update_tablet_data(win, event);
@@ -157,7 +157,7 @@ void wm_event_free(wmEvent *event)
void wm_event_free_all(wmWindow *win)
{
wmEvent *event;
-
+
while ((event = BLI_pophead(&win->queue))) {
wm_event_free(event);
}
@@ -180,7 +180,7 @@ static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, v
for (note = wm->queue.first; note; note = note->next)
if ((note->category | note->data | note->subtype | note->action) == type && note->reference == reference)
return 1;
-
+
return 0;
}
@@ -194,17 +194,17 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
return;
note = MEM_callocN(sizeof(wmNotifier), "notifier");
-
+
note->wm = wm;
BLI_addtail(&note->wm->queue, note);
-
+
note->window = CTX_wm_window(C);
-
+
note->category = type & NOTE_CATEGORY;
note->data = type & NOTE_DATA;
note->subtype = type & NOTE_SUBTYPE;
note->action = type & NOTE_ACTION;
-
+
note->reference = reference;
}
@@ -218,15 +218,15 @@ void WM_main_add_notifier(unsigned int type, void *reference)
return;
note = MEM_callocN(sizeof(wmNotifier), "notifier");
-
+
note->wm = wm;
BLI_addtail(&note->wm->queue, note);
-
+
note->category = type & NOTE_CATEGORY;
note->data = type & NOTE_DATA;
note->subtype = type & NOTE_SUBTYPE;
note->action = type & NOTE_ACTION;
-
+
note->reference = reference;
}
@@ -353,7 +353,7 @@ void wm_event_do_notifiers(bContext *C)
wmWindowManager *wm = CTX_wm_manager(C);
wmNotifier *note, *next;
wmWindow *win;
-
+
if (wm == NULL)
return;
@@ -363,9 +363,9 @@ void wm_event_do_notifiers(bContext *C)
for (win = wm->windows.first; win; win = win->next) {
Scene *scene = WM_window_get_active_scene(win);
bool do_anim = false;
-
+
CTX_wm_window_set(C, win);
-
+
for (note = wm->queue.first; note; note = next) {
next = note->next;
@@ -443,7 +443,7 @@ void wm_event_do_notifiers(bContext *C)
}
}
}
-
+
/* the notifiers are sent without context, to keep it clean */
while ((note = BLI_pophead(&wm->queue))) {
for (win = wm->windows.first; win; win = win->next) {
@@ -484,7 +484,7 @@ void wm_event_do_notifiers(bContext *C)
}
}
}
-
+
MEM_freeN(note);
}
#endif /* if 1 (postpone disabling for in favor of message-bus), eventually. */
@@ -517,8 +517,8 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
static bool do_wheel_ui = true;
const bool is_wheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN);
int retval;
-
- /* UI code doesn't handle return values - it just always returns break.
+
+ /* UI code doesn't handle return values - it just always returns break.
* to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
if (((handler->flag & WM_HANDLER_ACCEPT_DBL_CLICK) == 0) &&
(event->type != LEFTMOUSE) &&
@@ -526,7 +526,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
{
return WM_HANDLER_CONTINUE;
}
-
+
/* UI is quite aggressive with swallowing events, like scrollwheel */
/* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
if (do_wheel_ui == false) {
@@ -535,7 +535,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
else if (wm_event_always_pass(event) == 0)
do_wheel_ui = true;
}
-
+
/* we set context to where ui handler came from */
if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
@@ -555,14 +555,14 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
CTX_wm_region_set(C, NULL);
CTX_wm_menu_set(C, NULL);
}
-
+
if (retval == WM_UI_HANDLER_BREAK)
return WM_HANDLER_BREAK;
-
+
/* event not handled in UI, if wheel then we temporarily disable it */
if (is_wheel)
do_wheel_ui = false;
-
+
return WM_HANDLER_CONTINUE;
}
@@ -593,14 +593,14 @@ static void wm_handler_ui_cancel(bContext *C)
int WM_operator_poll(bContext *C, wmOperatorType *ot)
{
wmOperatorTypeMacro *otmacro;
-
+
for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
wmOperatorType *ot_macro = WM_operatortype_find(otmacro->idname, 0);
-
+
if (0 == WM_operator_poll(C, ot_macro))
return 0;
}
-
+
/* python needs operator type, so we added exception for it */
if (ot->pyop_poll)
return ot->pyop_poll(C, ot);
@@ -807,7 +807,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, bool ca
CTX_wm_region_set(C, ar_prev);
}
}
-
+
if (retval & OPERATOR_FINISHED) {
CLOG_STR_INFO_N(WM_LOG_OPERATORS, 1, WM_operator_pystring(C, op, false, true));
@@ -885,15 +885,15 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons
{
wmWindowManager *wm = CTX_wm_manager(C);
int retval = OPERATOR_CANCELLED;
-
+
CTX_wm_operator_poll_msg_set(C, NULL);
-
+
if (op == NULL || op->type == NULL)
return retval;
-
+
if (0 == WM_operator_poll(C, op->type))
return retval;
-
+
if (op->type->exec) {
if (op->type->flag & OPTYPE_UNDO) {
wm->op_undo_depth++;
@@ -912,13 +912,13 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons
wm->op_undo_depth--;
}
}
-
+
/* XXX Disabled the repeat check to address part 2 of #31840.
* Carefully checked all calls to wm_operator_exec and WM_operator_repeat, don't see any reason
* why this was needed, but worth to note it in case something turns bad. (mont29) */
if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) /* && repeat == 0 */)
wm_operator_reports(C, op, retval, false);
-
+
if (retval & OPERATOR_FINISHED) {
wm_operator_finished(C, op, repeat, store && wm->op_undo_depth == 0);
}
@@ -928,9 +928,9 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons
WM_operator_free(op);
}
}
-
+
return retval | OPERATOR_HANDLED;
-
+
}
/* simply calls exec with basic checks */
@@ -1033,11 +1033,11 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
{
/* XXX operatortype names are static still. for debug */
wmOperator *op = MEM_callocN(sizeof(wmOperator), ot->idname);
-
+
/* XXX adding new operator could be function, only happens here now */
op->type = ot;
BLI_strncpy(op->idname, ot->idname, OP_MAX_TYPENAME);
-
+
/* initialize properties, either copy or create */
op->ptr = MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
if (properties && properties->data) {
@@ -1057,20 +1057,20 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
op->reports = MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
BKE_reports_init(op->reports, RPT_STORE | RPT_FREE);
}
-
+
/* recursive filling of operator macro list */
if (ot->macro.first) {
static wmOperator *motherop = NULL;
wmOperatorTypeMacro *otmacro;
int root = 0;
-
+
/* ensure all ops are in execution order in 1 list */
if (motherop == NULL) {
motherop = op;
root = 1;
}
-
+
/* if properties exist, it will contain everything needed */
if (properties) {
otmacro = ot->macro.first;
@@ -1106,11 +1106,11 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot,
opm->opm = motherop; /* pointer to mom, for modal() */
}
}
-
+
if (root)
motherop = NULL;
}
-
+
WM_operator_properties_sanitize(op->ptr, 0);
return op;
@@ -1250,7 +1250,7 @@ static int wm_operator_invoke(
wmWindowManager *wm = CTX_wm_manager(C);
wmOperator *op = wm_operator_create(wm, ot, properties, reports); /* if reports == NULL, they'll be initialized */
const bool is_nested_call = (wm->op_undo_depth != 0);
-
+
if (event != NULL) {
op->flag |= OP_IS_INVOKE;
}
@@ -1388,7 +1388,7 @@ static int wm_operator_call_internal(
const short context, const bool poll_only)
{
wmEvent *event;
-
+
int retval;
CTX_wm_operator_poll_msg_set(C, NULL);
@@ -1421,39 +1421,39 @@ static int wm_operator_call_internal(
}
switch (context) {
-
+
case WM_OP_EXEC_REGION_WIN:
- case WM_OP_INVOKE_REGION_WIN:
+ case WM_OP_INVOKE_REGION_WIN:
case WM_OP_EXEC_REGION_CHANNELS:
case WM_OP_INVOKE_REGION_CHANNELS:
case WM_OP_EXEC_REGION_PREVIEW:
case WM_OP_INVOKE_REGION_PREVIEW:
{
/* forces operator to go to the region window/channels/preview, for header menus
- * but we stay in the same region if we are already in one
+ * but we stay in the same region if we are already in one
*/
ARegion *ar = CTX_wm_region(C);
ScrArea *area = CTX_wm_area(C);
int type = RGN_TYPE_WINDOW;
-
+
switch (context) {
case WM_OP_EXEC_REGION_CHANNELS:
case WM_OP_INVOKE_REGION_CHANNELS:
type = RGN_TYPE_CHANNELS;
break;
-
+
case WM_OP_EXEC_REGION_PREVIEW:
case WM_OP_INVOKE_REGION_PREVIEW:
type = RGN_TYPE_PREVIEW;
break;
-
+
case WM_OP_EXEC_REGION_WIN:
- case WM_OP_INVOKE_REGION_WIN:
+ case WM_OP_INVOKE_REGION_WIN:
default:
type = RGN_TYPE_WINDOW;
break;
}
-
+
if (!(ar && ar->regiontype == type) && area) {
ARegion *ar1;
if (type == RGN_TYPE_WINDOW) {
@@ -1466,12 +1466,12 @@ static int wm_operator_call_internal(
if (ar1)
CTX_wm_region_set(C, ar1);
}
-
+
retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
-
+
/* set region back */
CTX_wm_region_set(C, ar);
-
+
return retval;
}
case WM_OP_EXEC_AREA:
@@ -1506,7 +1506,7 @@ static int wm_operator_call_internal(
return wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
}
}
-
+
return 0;
}
@@ -1582,7 +1582,7 @@ int WM_operator_call_py(
if (!is_undo && wm) wm->op_undo_depth++;
retval = wm_operator_call_internal(C, ot, properties, reports, context, false);
-
+
if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
return retval;
@@ -1602,7 +1602,7 @@ static void wm_handler_op_context(bContext *C, wmEventHandler *handler, const wm
{
wmWindow *win = CTX_wm_window(C);
bScreen *screen = CTX_wm_screen(C);
-
+
if (screen && handler->op) {
if (handler->op_area == NULL)
CTX_wm_area_set(C, NULL);
@@ -1659,7 +1659,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
{
wmEventHandler *handler;
wmWindowManager *wm = CTX_wm_manager(C);
-
+
/* C is zero on freeing database, modal handlers then already were freed */
while ((handler = BLI_pophead(handlers))) {
if (handler->op) {
@@ -1667,7 +1667,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
if (handler->op->type->cancel) {
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
-
+
wm_handler_op_context(C, handler, win->eventstate);
if (handler->op->type->flag & OPTYPE_UNDO)
@@ -1689,7 +1689,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
ARegion *menu = CTX_wm_menu(C);
-
+
if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
if (handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
@@ -1722,7 +1722,7 @@ int WM_userdef_event_map(int kmitype)
case WHEELINMOUSE:
return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
}
-
+
return kmitype;
}
@@ -1768,13 +1768,13 @@ static int wm_eventmatch(const wmEvent *winevent, wmKeyMapItem *kmi)
if (winevent->val == KM_PRESS) { /* prevent double clicks */
/* NOT using ISTEXTINPUT anymore because (at least on Windows) some key codes above 255
* could have printable ascii keys - BUG [#30479] */
- if (ISKEYBOARD(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
+ if (ISKEYBOARD(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
}
if (kmitype != KM_ANY) {
if (ELEM(kmitype, TABLET_STYLUS, TABLET_ERASER)) {
const wmTabletData *wmtab = winevent->tablet_data;
-
+
if (wmtab == NULL)
return 0;
else if (winevent->type != LEFTMOUSE) /* tablet events can occur on hover + keypress */
@@ -1789,10 +1789,10 @@ static int wm_eventmatch(const wmEvent *winevent, wmKeyMapItem *kmi)
return 0;
}
}
-
+
if (kmi->val != KM_ANY)
if (winevent->val != kmi->val) return 0;
-
+
/* modifiers also check bits, so it allows modifier order */
if (kmi->shift != KM_ANY)
if (winevent->shift != kmi->shift && !(winevent->shift & kmi->shift)) return 0;
@@ -1802,12 +1802,12 @@ static int wm_eventmatch(const wmEvent *winevent, wmKeyMapItem *kmi)
if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0;
if (kmi->oskey != KM_ANY)
if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0;
-
+
/* only keymap entry with keymodifier is checked, means all keys without modifier get handled too. */
/* that is currently needed to make overlapping events work (when you press A - G fast or so). */
if (kmi->keymodifier)
if (winevent->keymodifier != kmi->keymodifier) return 0;
-
+
return 1;
}
@@ -1825,12 +1825,12 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (wm_eventmatch(event, kmi)) {
-
+
event->prevtype = event->type;
event->prevval = event->val;
event->type = EVT_MODAL_MAP;
event->val = kmi->propvalue;
-
+
break;
}
}
@@ -1883,7 +1883,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
wmEvent *event, PointerRNA *properties)
{
int retval = OPERATOR_PASS_THROUGH;
-
+
/* derived, modal or blocking operator */
if (handler->op) {
wmOperator *op = handler->op;
@@ -1911,7 +1911,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
/* warning, after this call all context data and 'event' may be freed. see check below */
retval = ot->modal(C, op, event);
OPERATOR_RETVAL_CHECK(retval);
-
+
/* when this is _not_ the case the modal modifier may have loaded
* a new blend file (demo mode does this), so we have to assume
* the event, operator etc have all been freed. - campbell */
@@ -1979,7 +1979,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
bool use_last_properties = true;
PointerRNA tool_properties = {{0}};
bool use_tool_properties = (handler->keymap_tool != NULL);
-
+
if (use_tool_properties) {
WM_toolsystem_ref_properties_init_for_keymap(handler->keymap_tool, &tool_properties, properties, ot);
properties = &tool_properties;
@@ -2058,11 +2058,11 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
sfile->op = handler->op;
ED_fileselect_set_params(sfile);
-
+
action = WM_HANDLER_BREAK;
break;
}
-
+
case EVT_FILESELECT_EXEC:
case EVT_FILESELECT_CANCEL:
case EVT_FILESELECT_EXTERNAL_CANCEL:
@@ -2150,11 +2150,11 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
wm->op_undo_depth++;
handler->op->type->cancel(C, handler->op);
-
+
if (handler->op->type->flag & OPTYPE_UNDO)
wm->op_undo_depth--;
}
-
+
WM_operator_free(handler->op);
}
@@ -2166,19 +2166,19 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
break;
}
}
-
+
return action;
}
static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHandler *handler, const wmEvent *event)
{
int action = WM_HANDLER_CONTINUE;
-
+
if (event->type != EVT_FILESELECT)
return action;
if (handler->op != (wmOperator *)event->customdata)
return action;
-
+
return wm_handler_fileselect_do(C, handlers, handler, event->val);
}
@@ -2239,7 +2239,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
for (handler = handlers->first; handler && handlers->first; handler = nexthandler) {
nexthandler = handler->next;
-
+
/* during this loop, ui handlers for nested menus can tag multiple handlers free */
if (handler->flag & WM_HANDLER_DO_FREE) {
/* pass */
@@ -2247,7 +2247,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
else if (handler_boundbox_test(handler, event)) { /* optional boundbox */
/* in advance to avoid access to freed event on window close */
always_pass = wm_event_always_pass(event);
-
+
/* modal+blocking handler */
if (handler->flag & WM_HANDLER_BLOCKING)
action |= WM_HANDLER_BREAK;
@@ -2272,7 +2272,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
event->keymap_idname = kmi->idname;
action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
-
+
if (action & WM_HANDLER_BREAK) {
/* not always_pass here, it denotes removed handler */
CLOG_INFO(WM_LOG_HANDLERS, 2, "handled! '%s'", kmi->idname);
@@ -2315,24 +2315,24 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
if (event->custom == EVT_DATA_DRAGDROP) {
ListBase *lb = (ListBase *)event->customdata;
wmDrag *drag;
-
+
for (drag = lb->first; drag; drag = drag->next) {
if (drop->poll(C, drag, event)) {
drop->copy(drag, drop);
-
+
/* free the drags before calling operator */
WM_drag_free_list(lb);
event->customdata = NULL;
event->custom = 0;
-
+
WM_operator_name_call_ptr(C, drop->ot, drop->opcontext, drop->ptr);
action |= WM_HANDLER_BREAK;
-
+
/* XXX fileread case */
if (CTX_wm_window(C) == NULL)
return action;
-
+
/* escape from drag loop, got freed */
break;
}
@@ -2491,7 +2491,7 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
break;
}
}
-
+
/* XXX fileread case, if the wm is freed then the handler's
* will have been too so the code below need not run. */
if (CTX_wm_window(C) == NULL) {
@@ -2499,8 +2499,8 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
}
/* XXX code this for all modal ops, and ensure free only happens here */
-
- /* modal ui handler can be tagged to be freed */
+
+ /* modal ui handler can be tagged to be freed */
if (BLI_findindex(handlers, handler) != -1) { /* could be freed already by regular modal ops */
if (handler->flag & WM_HANDLER_DO_FREE) {
BLI_remlink(handlers, handler);
@@ -2521,26 +2521,56 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
{
int action = wm_handlers_do_intern(C, event, handlers);
-
+
/* fileread case */
if (CTX_wm_window(C) == NULL)
return action;
- if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE, EVENT_NONE) && !ISTIMER(event->type)) {
+ if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
+ if (event->check_drag) {
+ wmWindow *win = CTX_wm_window(C);
+ if ((abs(event->x - win->eventstate->prevclickx)) >= U.tweak_threshold ||
+ (abs(event->y - win->eventstate->prevclicky)) >= U.tweak_threshold)
+ {
+ short val = event->val;
+ short type = event->type;
+ event->val = KM_CLICK_DRAG;
+ event->type = win->eventstate->type;
+
+ CLOG_INFO(WM_LOG_HANDLERS, 1, "handling PRESS_DRAG");
+
+ action |= wm_handlers_do_intern(C, event, handlers);
+
+ event->val = val;
+ event->type = type;
+
+ win->eventstate->check_click = 0;
+ win->eventstate->check_drag = 0;
+ }
+ }
+ }
+ else if (ISMOUSE(event->type) || ISKEYBOARD(event->type)) {
+ /* All events that don't set wmEvent.prevtype must be ignored. */
/* test for CLICK events */
if (wm_action_not_handled(action)) {
wmWindow *win = CTX_wm_window(C);
-
- /* eventstate stores if previous event was a KM_PRESS, in case that
+
+ /* eventstate stores if previous event was a KM_PRESS, in case that
* wasn't handled, the KM_RELEASE will become a KM_CLICK */
-
- if (win && event->val == KM_PRESS) {
- win->eventstate->check_click = true;
+
+ if (win != NULL) {
+ if (event->val == KM_PRESS) {
+ win->eventstate->check_click = true;
+ win->eventstate->check_drag = true;
+ }
+ else if (event->val == KM_RELEASE) {
+ win->eventstate->check_drag = false;
+ }
}
-
+
if (win && win->eventstate->prevtype == event->type) {
-
+
if ((event->val == KM_RELEASE) &&
(win->eventstate->prevval == KM_PRESS) &&
(win->eventstate->check_click == true))
@@ -2551,19 +2581,20 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
event->val = KM_CLICK;
CLOG_INFO(WM_LOG_HANDLERS, 1, "handling CLICK");
-
+
action |= wm_handlers_do_intern(C, event, handlers);
event->val = KM_RELEASE;
}
else {
win->eventstate->check_click = 0;
+ win->eventstate->check_drag = 0;
}
}
else if (event->val == KM_DBL_CLICK) {
event->val = KM_PRESS;
action |= wm_handlers_do_intern(C, event, handlers);
-
+
/* revert value if not handled */
if (wm_action_not_handled(action)) {
event->val = KM_DBL_CLICK;
@@ -2578,7 +2609,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
win->eventstate->check_click = 0;
}
}
-
+
return action;
}
@@ -2595,7 +2626,7 @@ static ScrArea *area_event_inside(bContext *C, const int xy[2])
{
wmWindow *win = CTX_wm_window(C);
bScreen *screen = CTX_wm_screen(C);
-
+
if (screen) {
ED_screen_areas_iter(win, screen, sa) {
if (BLI_rcti_isect_pt_v(&sa->totrct, xy))
@@ -2610,7 +2641,7 @@ static ARegion *region_event_inside(bContext *C, const int xy[2])
bScreen *screen = CTX_wm_screen(C);
ScrArea *area = CTX_wm_area(C);
ARegion *ar;
-
+
if (screen && area)
for (ar = area->regionbase.first; ar; ar = ar->next)
if (BLI_rcti_isect_pt_v(&ar->winrct, xy))
@@ -2635,22 +2666,22 @@ static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *ar)
static void wm_paintcursor_test(bContext *C, const wmEvent *event)
{
wmWindowManager *wm = CTX_wm_manager(C);
-
+
if (wm->paintcursors.first) {
ARegion *ar = CTX_wm_region(C);
-
+
if (ar)
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
-
+
/* if previous position was not in current region, we have to set a temp new context */
if (ar == NULL || !BLI_rcti_isect_pt_v(&ar->winrct, &event->prevx)) {
ScrArea *sa = CTX_wm_area(C);
-
+
CTX_wm_area_set(C, area_event_inside(C, &event->prevx));
CTX_wm_region_set(C, region_event_inside(C, &event->prevx));
wm_paintcursor_tag(C, wm->paintcursors.first, CTX_wm_region(C));
-
+
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
}
@@ -2664,7 +2695,7 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
if (BLI_listbase_is_empty(&wm->drags)) {
return;
}
-
+
if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type)) {
screen->do_draw_drag = true;
}
@@ -2675,20 +2706,20 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
}
else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
event->type = EVT_DROP;
-
+
/* create customdata, first free existing */
if (event->customdata) {
if (event->customdatafree)
MEM_freeN(event->customdata);
}
-
+
event->custom = EVT_DATA_DRAGDROP;
event->customdata = &wm->drags;
event->customdatafree = 1;
-
+
/* clear drop icon */
screen->do_draw_drag = true;
-
+
/* restore cursor (disabled, see wm_dragdrop.c) */
// WM_cursor_modal_restore(win);
}
@@ -2738,12 +2769,12 @@ void wm_event_do_handlers(bContext *C)
if (scene) {
int is_playing_sound = BKE_sound_scene_playing(scene);
-
+
if (is_playing_sound != -1) {
bool is_playing_screen;
CTX_wm_window_set(C, win);
CTX_data_scene_set(C, scene);
-
+
is_playing_screen = (ED_screen_animation_playing(wm) != NULL);
if (((is_playing_sound == 1) && (is_playing_screen == 0)) ||
@@ -2751,7 +2782,7 @@ void wm_event_do_handlers(bContext *C)
{
ED_screen_animation_play(C, -1, 1);
}
-
+
if (is_playing_sound == 0) {
const float time = BKE_sound_sync_scene(scene);
if (isfinite(time)) {
@@ -2764,14 +2795,14 @@ void wm_event_do_handlers(bContext *C)
}
}
}
-
+
CTX_data_scene_set(C, NULL);
CTX_wm_screen_set(C, NULL);
CTX_wm_window_set(C, NULL);
}
}
}
-
+
while ( (event = win->queue.first) ) {
int action = WM_HANDLER_CONTINUE;
@@ -2805,16 +2836,16 @@ void wm_event_do_handlers(bContext *C)
/* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
CTX_wm_area_set(C, area_event_inside(C, &event->x));
CTX_wm_region_set(C, region_event_inside(C, &event->x));
-
+
/* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
wm_window_make_drawable(wm, win);
-
+
wm_region_mouse_co(C, event);
/* first we do priority handlers, modal + some limited keymaps */
action |= wm_handlers_do(C, event, &win->modalhandlers);
-
+
/* fileread case */
if (CTX_wm_window(C) == NULL)
return;
@@ -2830,13 +2861,13 @@ void wm_event_do_handlers(bContext *C)
/* check dragging, creates new event or frees, adds draw tag */
wm_event_drag_test(wm, win, event);
-
+
/* builtin tweak, if action is break it removes tweak */
wm_tweakevent_test(C, event, action);
if ((action & WM_HANDLER_BREAK) == 0) {
ARegion *ar;
-
+
/* Note: setting subwin active should be done here, after modal handlers have been done */
if (event->type == MOUSEMOVE) {
/* state variables in screen, cursors. Also used in wm_draw.c, fails for modal handlers though */
@@ -2871,7 +2902,7 @@ void wm_event_do_handlers(bContext *C)
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (wm_event_inside_i(event, &ar->winrct)) {
CTX_wm_region_set(C, ar);
-
+
/* call even on non mouse events, since the */
wm_region_mouse_co(C, event);
@@ -2945,7 +2976,7 @@ void wm_event_do_handlers(bContext *C)
/* NOTE: do not escape on WM_HANDLER_BREAK, mousemove needs handled for previous area */
}
}
-
+
if ((action & WM_HANDLER_BREAK) == 0) {
/* also some non-modal handlers need active area/region */
CTX_wm_area_set(C, area_event_inside(C, &event->x));
@@ -2969,9 +3000,9 @@ void wm_event_do_handlers(bContext *C)
/* unlink and free here, blender-quit then frees all */
BLI_remlink(&win->queue, event);
wm_event_free(event);
-
+
}
-
+
/* only add mousemove when queue was read entirely */
if (win->addmousemove && win->eventstate) {
wmEvent tevent = *(win->eventstate);
@@ -2982,7 +3013,7 @@ void wm_event_do_handlers(bContext *C)
wm_event_add(win, &tevent);
win->addmousemove = 0;
}
-
+
CTX_wm_window_set(C, NULL);
}
@@ -2997,10 +3028,10 @@ void WM_event_fileselect_event(wmWindowManager *wm, void *ophandle, int eventval
{
/* add to all windows! */
wmWindow *win;
-
+
for (win = wm->windows.first; win; win = win->next) {
wmEvent event = *win->eventstate;
-
+
event.type = EVT_FILESELECT;
event.val = eventval;
event.customdata = ophandle; // only as void pointer type check
@@ -3027,7 +3058,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
/* only allow 1 file selector open per window */
for (handler = win->modalhandlers.first; handler; handler = handlernext) {
handlernext = handler->next;
-
+
if (handler->type == WM_HANDLER_FILESELECT) {
bScreen *screen = CTX_wm_screen(C);
bool cancel_handler = true;
@@ -3052,16 +3083,16 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
}
}
}
-
+
handler = MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
-
+
handler->type = WM_HANDLER_FILESELECT;
handler->op = op;
handler->op_area = CTX_wm_area(C);
handler->op_region = CTX_wm_region(C);
-
+
BLI_addhead(&win->modalhandlers, handler);
-
+
/* check props once before invoking if check is available
* ensures initial properties are valid */
if (op->type->check) {
@@ -3083,7 +3114,7 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
{
wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event modal handler");
wmWindow *win = CTX_wm_window(C);
-
+
/* operator was part of macro */
if (op->opm) {
/* give the mother macro to the handler */
@@ -3093,11 +3124,11 @@ wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
}
else
handler->op = op;
-
+
handler->op_area = CTX_wm_area(C); /* means frozen screen context for modal handlers! */
handler->op_region = CTX_wm_region(C);
handler->op_region_type = handler->op_region ? handler->op_region->regiontype : -1;
-
+
BLI_addhead(&win->modalhandlers, handler);
return handler;
@@ -3144,7 +3175,7 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap
for (handler = handlers->first; handler; handler = handler->next)
if (handler->keymap == keymap)
return handler;
-
+
handler = MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
BLI_addtail(handlers, handler);
handler->keymap = keymap;
@@ -3156,20 +3187,20 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap
wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority))
{
wmEventHandler *handler;
-
+
WM_event_remove_keymap_handler(handlers, keymap);
-
+
handler = MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
BLI_addhead(handlers, handler);
handler->keymap = keymap;
-
+
return handler;
}
wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *keymap, const rcti *bblocal, const rcti *bbwin)
{
wmEventHandler *handler = WM_event_add_keymap_handler(handlers, keymap);
-
+
if (handler) {
handler->bblocal = bblocal;
handler->bbwin = bbwin;
@@ -3180,7 +3211,7 @@ wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *key
void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
{
wmEventHandler *handler;
-
+
for (handler = handlers->first; handler; handler = handler->next) {
if (handler->keymap == keymap) {
BLI_remlink(handlers, handler);
@@ -3221,9 +3252,9 @@ wmEventHandler *WM_event_add_ui_handler(
BLI_assert((flag & WM_HANDLER_DO_FREE) == 0);
handler->flag = flag;
-
+
BLI_addhead(handlers, handler);
-
+
return handler;
}
@@ -3234,7 +3265,7 @@ void WM_event_remove_ui_handler(
void *userdata, const bool postpone)
{
wmEventHandler *handler;
-
+
for (handler = handlers->first; handler; handler = handler->next) {
if ((handler->ui_handle == ui_handle) &&
(handler->ui_remove == ui_remove) &&
@@ -3279,13 +3310,13 @@ wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropb
for (handler = handlers->first; handler; handler = handler->next)
if (handler->dropboxes == dropboxes)
return handler;
-
+
handler = MEM_callocN(sizeof(wmEventHandler), "dropbox handler");
-
+
/* dropbox stored static, no free or copy */
handler->dropboxes = dropboxes;
BLI_addhead(handlers, handler);
-
+
return handler;
}
@@ -3316,7 +3347,7 @@ static void WM_event_remove_handler(ListBase *handlers, wmEventHandler *handler)
void WM_event_add_mousemove(const bContext *C)
{
wmWindow *window = CTX_wm_window(C);
-
+
window->addmousemove = 1;
}
@@ -3324,7 +3355,7 @@ void WM_event_add_mousemove(const bContext *C)
/* for modal callbacks, check configuration for how to interpret exit with tweaks */
bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event)
{
- /* if the release-confirm userpref setting is enabled,
+ /* if the release-confirm userpref setting is enabled,
* tweak events can be canceled when mouse is released
*/
if (U.flag & USER_RELEASECONFIRM) {
@@ -3353,13 +3384,13 @@ bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event)
if (event->val != KM_RELEASE)
return 1;
}
-
+
return 0;
}
/* ********************* ghost stuff *************** */
-static int convert_key(GHOST_TKey key)
+static int convert_key(GHOST_TKey key)
{
if (key >= GHOST_kKeyA && key <= GHOST_kKeyZ) {
return (AKEY + ((int) key - GHOST_kKeyA));
@@ -3438,7 +3469,7 @@ static int convert_key(GHOST_TKey key)
case GHOST_kKeyMediaStop: return MEDIASTOP;
case GHOST_kKeyMediaFirst: return MEDIAFIRST;
case GHOST_kKeyMediaLast: return MEDIALAST;
-
+
default:
return UNKNOWNKEY; /* GHOST_kKeyUnknown */
}
@@ -3450,11 +3481,11 @@ static void wm_eventemulation(wmEvent *event)
/* Store last mmb/rmb event value to make emulation work when modifier keys
* are released first. This really should be in a data structure somewhere. */
static int emulating_event = EVENT_NONE;
-
+
/* middlemouse and rightmouse emulation */
if (U.flag & USER_TWOBUTTONMOUSE) {
if (event->type == LEFTMOUSE) {
-
+
if (event->val == KM_PRESS && event->alt) {
event->type = MIDDLEMOUSE;
event->alt = 0;
@@ -3480,9 +3511,9 @@ static void wm_eventemulation(wmEvent *event)
emulating_event = EVENT_NONE;
}
}
-
+
}
-
+
/* numpad emulation */
if (U.flag & USER_NONUMPAD) {
switch (event->type) {
@@ -3507,16 +3538,16 @@ static void wm_eventemulation(wmEvent *event)
static void update_tablet_data(wmWindow *win, wmEvent *event)
{
const GHOST_TabletData *td = GHOST_GetTabletData(win->ghostwin);
-
+
/* if there's tablet data from an active tablet device then add it */
if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
struct wmTabletData *wmtab = MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
-
+
wmtab->Active = (int)td->Active;
wmtab->Pressure = td->Pressure;
wmtab->Xtilt = td->Xtilt;
wmtab->Ytilt = td->Ytilt;
-
+
event->tablet_data = wmtab;
// printf("%s: using tablet %.5f\n", __func__, wmtab->Pressure);
}
@@ -3559,40 +3590,40 @@ static void attach_ndof_data(wmEvent *event, const GHOST_TEventNDOFMotionData *g
static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *win, wmEvent *event)
{
int mx = event->x, my = event->y;
-
+
if (wm->windows.first == wm->windows.last)
return NULL;
-
+
/* in order to use window size and mouse position (pixels), we have to use a WM function */
-
+
/* check if outside, include top window bar... */
if (mx < 0 || my < 0 || mx > WM_window_pixels_x(win) || my > WM_window_pixels_y(win) + 30) {
wmWindow *owin;
wmEventHandler *handler;
-
+
/* let's skip windows having modal handlers now */
/* potential XXX ugly... I wouldn't have added a modalhandlers list (introduced in rev 23331, ton) */
for (handler = win->modalhandlers.first; handler; handler = handler->next)
if (handler->ui_handle || handler->op)
return NULL;
-
+
/* to desktop space */
mx += (int) (U.pixelsize * win->posx);
my += (int) (U.pixelsize * win->posy);
-
+
/* check other windows to see if it has mouse inside */
for (owin = wm->windows.first; owin; owin = owin->next) {
-
+
if (owin != win) {
int posx = (int) (U.pixelsize * owin->posx);
int posy = (int) (U.pixelsize * owin->posy);
-
+
if (mx - posx >= 0 && owin->posy >= 0 &&
mx - posx <= WM_window_pixels_x(owin) && my - posy <= WM_window_pixels_y(owin))
{
event->x = mx - (int)(U.pixelsize * owin->posx);
event->y = my - (int)(U.pixelsize * owin->posy);
-
+
return owin;
}
}
@@ -3671,7 +3702,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
copy_v2_v2_int(&evt->x, &event_new->x);
evt->is_motion_absolute = event_new->is_motion_absolute;
}
-
+
/* also add to other window if event is there, this makes overdraws disappear nicely */
/* it remaps mousecoord to other window in event */
owin = wm_event_cursor_other_windows(wm, win, &event);
@@ -3688,7 +3719,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
oevt->is_motion_absolute = event_new->is_motion_absolute;
}
}
-
+
break;
}
case GHOST_kEventTrackpad:
@@ -3712,11 +3743,11 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.x = evt->x = pd->x;
event.y = evt->y = pd->y;
event.val = KM_NOTHING;
-
+
/* Use prevx/prevy so we can calculate the delta later */
event.prevx = event.x - pd->deltaX;
event.prevy = event.y - (-pd->deltaY);
-
+
wm_event_add(win, &event);
break;
}
@@ -3725,10 +3756,10 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
case GHOST_kEventButtonUp:
{
GHOST_TEventButtonData *bd = customdata;
-
+
/* get value and type from ghost */
event.val = (type == GHOST_kEventButtonDown) ? KM_PRESS : KM_RELEASE;
-
+
if (bd->button == GHOST_kButtonMaskLeft)
event.type = LEFTMOUSE;
else if (bd->button == GHOST_kButtonMaskRight)
@@ -3743,9 +3774,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.type = BUTTON7MOUSE;
else
event.type = MIDDLEMOUSE;
-
+
wm_eventemulation(&event);
-
+
/* copy previous state to prev event state (two old!) */
evt->prevval = evt->val;
evt->prevtype = evt->type;
@@ -3756,14 +3787,14 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
if (win->active == 0) {
int cx, cy;
-
+
/* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */
wm_get_cursor_position(win, &cx, &cy);
event.x = evt->x = cx;
event.y = evt->y = cy;
}
-
+
/* double click test */
if (wm_event_is_double_click(&event, evt)) {
CLOG_INFO(WM_LOG_HANDLERS, 1, "Send double click");
@@ -3774,23 +3805,23 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
evt->prevclickx = event.x;
evt->prevclicky = event.y;
}
-
+
/* add to other window if event is there (not to both!) */
owin = wm_event_cursor_other_windows(wm, win, &event);
if (owin) {
wmEvent oevent = *(owin->eventstate);
-
+
oevent.x = event.x;
oevent.y = event.y;
oevent.type = event.type;
oevent.val = event.val;
-
+
wm_event_add(owin, &oevent);
}
else {
wm_event_add(win, &event);
}
-
+
break;
}
/* keyboard */
@@ -3803,9 +3834,9 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.ascii = kd->ascii;
memcpy(event.utf8_buf, kd->utf8_buf, sizeof(event.utf8_buf)); /* might be not null terminated*/
event.val = (type == GHOST_kEventKeyDown) ? KM_PRESS : KM_RELEASE;
-
+
wm_eventemulation(&event);
-
+
/* copy previous state to prev event state (two old!) */
evt->prevval = evt->val;
evt->prevtype = evt->type;
@@ -3813,7 +3844,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* copy to event state */
evt->val = event.val;
evt->type = event.type;
-
+
/* exclude arrow keys, esc, etc from text input */
if (type == GHOST_kEventKeyUp) {
event.ascii = '\0';
@@ -3887,19 +3918,19 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
CLOG_INFO(WM_LOG_HANDLERS, 1, "Send double click");
evt->val = event.val = KM_DBL_CLICK;
}
-
+
/* this case happens on holding a key pressed, it should not generate
* press events events with the same key as modifier */
if (event.keymodifier == event.type)
event.keymodifier = 0;
-
+
/* this case happens with an external numpad, and also when using 'dead keys' (to compose complex latin
* characters e.g.), it's not really clear why.
* Since it's impossible to map a key modifier to an unknown key, it shouldn't harm to clear it. */
if (event.keymodifier == UNKNOWNKEY) {
evt->keymodifier = event.keymodifier = 0;
}
-
+
/* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */
if ((event.type == ESCKEY && event.val == KM_PRESS) &&
/* check other modifiers because ms-windows uses these to bring up the task manager */
@@ -3907,31 +3938,34 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
{
G.is_break = true;
}
-
+
/* double click test - only for press */
if (event.val == KM_PRESS) {
- evt->prevclicktime = PIL_check_seconds_timer();
- evt->prevclickx = event.x;
- evt->prevclicky = event.y;
+ /* Don't reset timer & location when holding the key generates repeat events. */
+ if ((evt->prevtype != event.type) || (evt->prevval != KM_PRESS)) {
+ evt->prevclicktime = PIL_check_seconds_timer();
+ evt->prevclickx = event.x;
+ evt->prevclicky = event.y;
+ }
}
-
+
wm_event_add(win, &event);
-
+
break;
}
-
+
case GHOST_kEventWheel:
{
GHOST_TEventWheelData *wheelData = customdata;
-
+
if (wheelData->z > 0)
event.type = WHEELUPMOUSE;
else
event.type = WHEELDOWNMOUSE;
-
+
event.val = KM_PRESS;
wm_event_add(win, &event);
-
+
break;
}
case GHOST_kEventTimer:
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 68be37ef709..3aaec875627 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -152,27 +152,27 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
{
wmWindowManager *wm;
wmWindow *win, *active_win;
-
+
*wmlist = G.main->wm;
BLI_listbase_clear(&G.main->wm);
-
+
active_win = CTX_wm_window(C);
/* first wrap up running stuff */
/* code copied from wm_init_exit.c */
for (wm = wmlist->first; wm; wm = wm->id.next) {
-
+
WM_jobs_kill_all(wm);
-
+
for (win = wm->windows.first; win; win = win->next) {
-
+
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
ED_screen_exit(C, win, WM_window_get_active_screen(win));
}
}
-
+
/* reset active window */
CTX_wm_window_set(C, active_win);
@@ -215,6 +215,7 @@ static void wm_window_match_keep_current_wm(
const bool load_ui,
ListBase *r_new_wm_list)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = current_wm_list->first;
bScreen *screen = NULL;
@@ -236,7 +237,7 @@ static void wm_window_match_keep_current_wm(
}
else {
WorkSpaceLayout *layout_old = WM_window_get_active_layout(win);
- WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(workspace, layout_old, win);
+ WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(bmain, workspace, layout_old, win);
WM_window_set_active_layout(win, workspace, layout_new);
}
@@ -339,8 +340,8 @@ static void wm_window_match_do(
static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
{
/* versioning is here */
- UI_init_userdef();
-
+ UI_init_userdef(bmain);
+
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
BKE_sound_init(bmain);
@@ -569,7 +570,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* it throws error box when file doesn't exist and returns -1 */
/* note; it should set some error message somewhere... (ton) */
retval = wm_read_exotic(filepath);
-
+
/* we didn't succeed, now try to read Blender file */
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
int G_f = G.f;
@@ -578,12 +579,16 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* put aside screens to match with persistent windows later */
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
-
+
/* confusing this global... */
G.relbase_valid = 1;
retval = BKE_blendfile_read(C, filepath, reports, 0);
+
+ /* BKE_file_read sets new Main into context. */
+ Main *bmain = CTX_data_main(C);
+
/* when loading startup.blend's, we can be left with a blank path */
- if (G.main->name[0]) {
+ if (BKE_main_blendfile_path(bmain)) {
G.save_over = 1;
}
else {
@@ -599,14 +604,14 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
}
/* match the read WM with current WM */
- wm_window_match_do(C, &wmbase, &G.main->wm, &G.main->wm);
+ wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm);
WM_check(C); /* opens window(s), checks keymaps */
if (retval == BKE_BLENDFILE_READ_OK_USERPREFS) {
/* in case a userdef is read from regular .blend */
- wm_init_userdef(G.main, false);
+ wm_init_userdef(bmain, false);
}
-
+
if (retval != BKE_BLENDFILE_READ_FAIL) {
if (do_history) {
wm_history_file_update();
@@ -672,6 +677,7 @@ int wm_homefile_read(
bool use_factory_settings, bool use_empty_data, bool use_userdef,
const char *filepath_startup_override, const char *app_template_override)
{
+ Main *bmain = G.main; /* Context does not always have valid main pointer here... */
ListBase wmbase;
bool success = false;
@@ -863,16 +869,18 @@ int wm_homefile_read(
* can remove this eventually, only in a 2.53 and older, now its not written */
G.fileflags &= ~G_FILE_RELATIVE_REMAP;
- if (use_userdef) {
+ bmain = CTX_data_main(C);
+
+ if (use_userdef) {
/* check userdef before open window, keymaps etc */
- wm_init_userdef(CTX_data_main(C), read_userdef_from_memory);
+ wm_init_userdef(bmain, read_userdef_from_memory);
}
-
+
/* match the read WM with current WM */
- wm_window_match_do(C, &wmbase, &G.main->wm, &G.main->wm);
+ wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm);
WM_check(C); /* opens window(s), checks keymaps */
- G.main->name[0] = '\0';
+ bmain->name[0] = '\0';
/* start with save preference untitled.blend */
G.save_over = 0;
@@ -913,7 +921,7 @@ void wm_history_file_read(void)
num++;
}
}
-
+
BLI_file_free_lines(lines);
}
@@ -969,16 +977,18 @@ static void wm_history_file_write(void)
static void wm_history_file_update(void)
{
RecentFile *recent;
+ const char *blendfile_name = BKE_main_blendfile_path_from_global();
/* no write history for recovered startup files */
- if (G.main->name[0] == 0)
+ if (blendfile_name[0] == '\0') {
return;
+ }
recent = G.recent_files.first;
/* refresh recent-files.txt of recent opened files, when current file was changed */
- if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name) != 0)) {
+ if (!(recent) || (BLI_path_cmp(recent->filepath, blendfile_name) != 0)) {
- recent = wm_file_history_find(G.main->name);
+ recent = wm_file_history_find(blendfile_name);
if (recent) {
BLI_remlink(&G.recent_files, recent);
}
@@ -988,7 +998,7 @@ static void wm_history_file_update(void)
recent_next = recent->next;
wm_history_file_free(recent);
}
- recent = wm_history_file_new(G.main->name);
+ recent = wm_history_file_new(blendfile_name);
}
/* add current file to the beginning of list */
@@ -998,7 +1008,7 @@ static void wm_history_file_update(void)
wm_history_file_write();
/* also update most recent files on System */
- GHOST_addToSystemRecentFiles(G.main->name);
+ GHOST_addToSystemRecentFiles(blendfile_name);
}
}
@@ -1066,7 +1076,7 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
/* add pretty overlay */
IMB_thumb_overlay_blend(ibuf->rect, ibuf->x, ibuf->y, aspect);
-
+
thumb = BKE_main_thumbnail_from_imbuf(NULL, ibuf);
}
else {
@@ -1074,10 +1084,10 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
fprintf(stderr, "blend_file_thumb failed to create thumbnail: %s\n", err_out);
thumb = NULL;
}
-
+
/* must be freed by caller */
*thumb_pt = thumb;
-
+
return ibuf;
}
@@ -1087,7 +1097,7 @@ bool write_crash_blend(void)
char path[FILE_MAX];
int fileflags = G.fileflags & ~(G_FILE_HISTORY); /* don't do file history on crash file */
- BLI_strncpy(path, G.main->name, sizeof(path));
+ BLI_strncpy(path, BKE_main_blendfile_path_from_global(), sizeof(path));
BLI_replace_extension(path, sizeof(path), "_crash.blend");
if (BLO_write_file(G.main, path, fileflags, NULL, NULL)) {
printf("written: %s\n", path);
@@ -1104,6 +1114,7 @@ bool write_crash_blend(void)
*/
static int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *reports)
{
+ Main *bmain = CTX_data_main(C);
Library *li;
int len;
int ret = -1;
@@ -1111,7 +1122,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
ImBuf *ibuf_thumb = NULL;
len = strlen(filepath);
-
+
if (len == 0) {
BKE_report(reports, RPT_ERROR, "Path is empty, cannot save");
return ret;
@@ -1121,7 +1132,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
BKE_report(reports, RPT_ERROR, "Path too long, cannot save");
return ret;
}
-
+
/* Check if file write permission is ok */
if (BLI_exists(filepath) && !BLI_file_is_writable(filepath)) {
BKE_reportf(reports, RPT_ERROR, "Cannot save blend file, path '%s' is not writable", filepath);
@@ -1131,9 +1142,9 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
/* note: used to replace the file extension (to ensure '.blend'),
* no need to now because the operator ensures,
* its handy for scripts to save to a predefined name without blender editing it */
-
+
/* send the OnSave event */
- for (li = G.main->library.first; li; li = li->id.next) {
+ for (li = bmain->library.first; li; li = li->id.next) {
if (BLI_path_cmp(li->filepath, filepath) == 0) {
BKE_reportf(reports, RPT_ERROR, "Cannot overwrite used library '%.240s'", filepath);
return ret;
@@ -1141,12 +1152,12 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
}
/* Call pre-save callbacks befores writing preview, that way you can generate custom file thumbnail... */
- BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE);
+ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_PRE);
/* blend file thumbnail */
/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
/* Main now can store a .blend thumbnail, usefull for background mode or thumbnail customization. */
- main_thumb = thumb = CTX_data_main(C)->blen_thumb;
+ main_thumb = thumb = bmain->blen_thumb;
if ((U.flag & USER_SAVE_PREVIEWS) && BLI_thread_is_main()) {
ibuf_thumb = blend_file_thumb(C, CTX_data_scene(C), CTX_wm_screen(C), &thumb);
}
@@ -1154,32 +1165,32 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
/* operator now handles overwrite checks */
if (G.fileflags & G_AUTOPACK) {
- packAll(G.main, reports, false);
+ packAll(bmain, reports, false);
}
/* don't forget not to return without! */
WM_cursor_wait(1);
-
+
ED_editors_flush_edits(C, false);
fileflags |= G_FILE_HISTORY; /* write file history */
/* first time saving */
/* XXX temp solution to solve bug, real fix coming (ton) */
- if ((G.main->name[0] == '\0') && !(fileflags & G_FILE_SAVE_COPY)) {
- BLI_strncpy(G.main->name, filepath, sizeof(G.main->name));
+ if ((BKE_main_blendfile_path(bmain)[0] == '\0') && !(fileflags & G_FILE_SAVE_COPY)) {
+ BLI_strncpy(bmain->name, filepath, sizeof(bmain->name));
}
/* XXX temp solution to solve bug, real fix coming (ton) */
- G.main->recovered = 0;
-
+ bmain->recovered = 0;
+
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0);
if (!(fileflags & G_FILE_SAVE_COPY)) {
G.relbase_valid = 1;
- BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
-
+ BLI_strncpy(bmain->name, filepath, sizeof(bmain->name)); /* is guaranteed current file */
+
G.save_over = 1; /* disable untitled.blend convention */
}
@@ -1190,7 +1201,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
wm_history_file_update();
}
- BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_POST);
+ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_SAVE_POST);
/* run this function after because the file cant be written before the blend is */
if (ibuf_thumb) {
@@ -1224,7 +1235,7 @@ void wm_autosave_location(char *filepath)
#endif
if (G.main && G.relbase_valid) {
- const char *basename = BLI_path_basename(G.main->name);
+ const char *basename = BLI_path_basename(BKE_main_blendfile_path_from_global());
int len = strlen(basename) - 6;
BLI_snprintf(path, sizeof(path), "%.*s.blend", len, basename);
}
@@ -1264,7 +1275,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
wmWindow *win;
wmEventHandler *handler;
char filepath[FILE_MAX];
-
+
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
/* if a modal operator is running, don't autosave, but try again in 10 seconds */
@@ -1313,7 +1324,7 @@ void wm_autosave_timer_ended(wmWindowManager *wm)
void wm_autosave_delete(void)
{
char filename[FILE_MAX];
-
+
wm_autosave_location(filename);
if (BLI_exists(filename)) {
@@ -1754,7 +1765,8 @@ struct FileRuntime {
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- const char *openname = G.main->name;
+ Main *bmain = CTX_data_main(C);
+ const char *openname = BKE_main_blendfile_path(bmain);
if (CTX_wm_window(C) == NULL) {
/* in rare cases this could happen, when trying to invoke in background
@@ -1893,6 +1905,7 @@ void WM_OT_open_mainfile(wmOperatorType *ot)
static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
bool success;
char filepath[FILE_MAX];
@@ -1903,7 +1916,7 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
else
G.f &= ~G_SCRIPT_AUTOEXEC;
- BLI_strncpy(filepath, G.main->name, sizeof(filepath));
+ BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
success = wm_file_read_opwrap(C, filepath, op->reports, !(G.f & G_SCRIPT_AUTOEXEC));
if (success) {
@@ -1941,6 +1954,7 @@ void WM_OT_revert_mainfile(wmOperatorType *ot)
void WM_recover_last_session(bContext *C, ReportList *reports)
{
+ Main *bmain = CTX_data_main(C);
char filepath[FILE_MAX];
BLI_make_file_string("/", filepath, BKE_tempdir_base(), BLENDER_QUIT_FILE);
@@ -1953,8 +1967,9 @@ void WM_recover_last_session(bContext *C, ReportList *reports)
G.fileflags &= ~G_FILE_RECOVER;
/* XXX bad global... fixme */
- if (G.main->name[0])
+ if (BKE_main_blendfile_path(bmain)[0] != '\0') {
G.file_loaded = 1; /* prevents splash to show */
+ }
else {
G.relbase_valid = 0;
G.save_over = 0; /* start with save preference untitled.blend */
@@ -2053,20 +2068,21 @@ static void save_set_compress(wmOperator *op)
}
}
-static void save_set_filepath(wmOperator *op)
+static void save_set_filepath(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
PropertyRNA *prop;
char name[FILE_MAX];
prop = RNA_struct_find_property(op->ptr, "filepath");
if (!RNA_property_is_set(op->ptr, prop)) {
/* if not saved before, get the name of the most recently used .blend file */
- if (G.main->name[0] == 0 && G.recent_files.first) {
+ if (BKE_main_blendfile_path(bmain)[0] == '\0' && G.recent_files.first) {
struct RecentFile *recent = G.recent_files.first;
BLI_strncpy(name, recent->filepath, FILE_MAX);
}
else {
- BLI_strncpy(name, G.main->name, FILE_MAX);
+ BLI_strncpy(name, bmain->name, FILE_MAX);
}
wm_filepath_default(name);
@@ -2078,7 +2094,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent
{
save_set_compress(op);
- save_set_filepath(op);
+ save_set_filepath(C, op);
WM_event_add_fileselect(C, op);
@@ -2088,6 +2104,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent
/* function used for WM_OT_save_mainfile too */
static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
char path[FILE_MAX];
int fileflags;
@@ -2097,7 +2114,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
}
else {
- BLI_strncpy(path, G.main->name, FILE_MAX);
+ BLI_strncpy(path, BKE_main_blendfile_path(bmain), FILE_MAX);
wm_filepath_default(path);
}
@@ -2193,7 +2210,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U
return OPERATOR_CANCELLED;
save_set_compress(op);
- save_set_filepath(op);
+ save_set_filepath(C, op);
/* if we're saving for the first time and prefer relative paths - any existing paths will be absolute,
* enable the option to remap paths to avoid confusion [#37240] */
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 0f2da2e8f36..c7d55b290f5 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -115,7 +115,7 @@ static int wm_link_append_invoke(bContext *C, wmOperator *op, const wmEvent *UNU
}
else if (G.relbase_valid) {
char path[FILE_MAX];
- BLI_strncpy(path, G.main->name, sizeof(G.main->name));
+ BLI_strncpy(path, BKE_main_blendfile_path_from_global(), sizeof(path));
BLI_parent_dir(path);
RNA_string_set(op->ptr, "filepath", path);
}
@@ -333,7 +333,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
BKE_reportf(op->reports, RPT_ERROR, "'%s': nothing indicated", path);
return OPERATOR_CANCELLED;
}
- else if (BLI_path_cmp(bmain->name, libname) == 0) {
+ else if (BLI_path_cmp(BKE_main_blendfile_path(bmain), libname) == 0) {
BKE_reportf(op->reports, RPT_ERROR, "'%s': cannot use current file as library", path);
return OPERATOR_CANCELLED;
}
@@ -372,7 +372,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
if (view_layer && RNA_boolean_get(op->ptr, "autoselect")) {
BKE_view_layer_base_deselect_all(view_layer);
}
-
+
/* tag everything, all untagged data can be made local
* its also generally useful to know what is new
*
@@ -531,18 +531,18 @@ void WM_OT_link(wmOperatorType *ot)
ot->name = "Link from Library";
ot->idname = "WM_OT_link";
ot->description = "Link from a Library .blend file";
-
+
ot->invoke = wm_link_append_invoke;
ot->exec = wm_link_append_exec;
ot->poll = wm_link_append_poll;
-
+
ot->flag |= OPTYPE_UNDO;
WM_operator_properties_filesel(
ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER | FILE_TYPE_BLENDERLIB, FILE_LOADLIB, FILE_OPENFILE,
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
-
+
wm_link_append_properties_common(ot, true);
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 2c3583a9f02..144bb38ae76 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -63,20 +63,20 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
wmGesture *gesture = MEM_callocN(sizeof(wmGesture), "new gesture");
wmWindow *window = CTX_wm_window(C);
ARegion *ar = CTX_wm_region(C);
-
+
BLI_addtail(&window->gesture, gesture);
-
+
gesture->type = type;
gesture->event_type = event->type;
gesture->winrct = ar->winrct;
gesture->userdata_free = true; /* Free if userdata is set. */
gesture->modal_state = GESTURE_MODAL_NOP;
-
+
if (ELEM(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE))
{
rcti *rect = MEM_callocN(sizeof(rcti), "gesture rect new");
-
+
gesture->customdata = rect;
rect->xmin = event->x - gesture->winrct.xmin;
rect->ymin = event->y - gesture->winrct.ymin;
@@ -96,14 +96,14 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
lasso[1] = event->y - gesture->winrct.ymin;
gesture->points = 1;
}
-
+
return gesture;
}
void WM_gesture_end(bContext *C, wmGesture *gesture)
{
wmWindow *win = CTX_wm_window(C);
-
+
if (win->tweak == gesture)
win->tweak = NULL;
BLI_remlink(&win->gesture, gesture);
@@ -117,7 +117,7 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
void WM_gestures_remove(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
-
+
while (win->gesture.first)
WM_gesture_end(C, win->gesture.first);
}
@@ -141,7 +141,7 @@ int wm_gesture_evaluate(wmGesture *gesture)
else if (theta == -1) val = EVT_GESTURE_SE;
else if (theta == -2) val = EVT_GESTURE_S;
else if (theta == -3) val = EVT_GESTURE_SW;
-
+
#if 0
/* debug */
if (val == 1) printf("tweak north\n");
@@ -421,7 +421,7 @@ void wm_gesture_draw(wmWindow *win)
for (; gt; gt = gt->next) {
/* all in subwindow space */
wmViewport(&gt->winrct);
-
+
if (gt->type == WM_GESTURE_RECT)
wm_gesture_draw_rect(gt);
// else if (gt->type == WM_GESTURE_TWEAK)
@@ -448,7 +448,7 @@ void wm_gesture_draw(wmWindow *win)
void wm_gesture_tag_redraw(bContext *C)
{
bScreen *screen = CTX_wm_screen(C);
-
+
if (screen)
screen->do_draw_gesture = true;
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 480287ce6b1..c5a57147dd6 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -186,6 +186,8 @@ void WM_init_opengl(void)
GPU_set_anisotropic(U.anisotropic_filter);
GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
+ GPU_pass_cache_init();
+
#ifdef WITH_OPENSUBDIV
BKE_subsurf_osd_init();
#endif
@@ -195,7 +197,7 @@ void WM_init_opengl(void)
/* only called once, for startup */
void WM_init(bContext *C, int argc, const char **argv)
{
-
+
if (!G.background) {
wm_ghost_init(C); /* note: it assigns C to ghost! */
wm_init_cursor_data();
@@ -222,12 +224,12 @@ void WM_init(bContext *C, int argc, const char **argv)
BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
DEG_editors_set_update_cb(ED_render_id_flush_update,
ED_render_scene_update);
-
+
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
-
+
ED_file_init(); /* for fsmenu */
ED_node_init_butfuncs();
-
+
BLF_init();
BLT_lang_init();
@@ -293,11 +295,11 @@ void WM_init(bContext *C, int argc, const char **argv)
/* allow a path of "", this is what happens when making a new file */
#if 0
- if (G.main->name[0] == 0)
+ if (BKE_main_blendfile_path_from_global()[0] == '\0')
BLI_make_file_string("/", G.main->name, BKE_appdir_folder_default(), "untitled.blend");
#endif
- BLI_strncpy(G.lib, G.main->name, FILE_MAX);
+ BLI_strncpy(G.lib, BKE_main_blendfile_path_from_global(), sizeof(G.lib));
#ifdef WITH_COMPOSITOR
if (1) {
@@ -305,7 +307,7 @@ void WM_init(bContext *C, int argc, const char **argv)
COM_linker_hack = COM_execute;
}
#endif
-
+
/* load last session, uses regular file reading so it has to be in end (after init py etc) */
if (U.uiflag2 & USER_KEEP_SESSION) {
/* calling WM_recover_last_session(C, NULL) has been moved to creator.c */
@@ -338,7 +340,7 @@ void WM_init_splash(bContext *C)
if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *prevwin = CTX_wm_window(C);
-
+
if (wm->windows.first) {
CTX_wm_window_set(C, wm->windows.first);
WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
@@ -351,10 +353,10 @@ void WM_init_splash(bContext *C)
static void free_openrecent(void)
{
struct RecentFile *recent;
-
+
for (recent = G.recent_files.first; recent; recent = recent->next)
MEM_freeN(recent->filepath);
-
+
BLI_freelistN(&(G.recent_files));
}
@@ -437,11 +439,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
}
}
}
-
+
WM_jobs_kill_all(wm);
for (win = wm->windows.first; win; win = win->next) {
-
+
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
@@ -462,13 +464,13 @@ void WM_exit_ext(bContext *C, const bool do_python)
ED_undosys_type_free();
free_openrecent();
-
+
BKE_mball_cubeTable_free();
-
+
/* render code might still access databases */
RE_FreeAllRender();
RE_engines_exit();
-
+
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
if (C && wm)
@@ -478,7 +480,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
BKE_tracking_clipboard_free();
BKE_mask_clipboard_free();
BKE_vfont_clipboard_free();
-
+
#ifdef WITH_COMPOSITOR
COM_deinitialize();
#endif
@@ -492,7 +494,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
GPU_exit();
}
-
+
BKE_blender_free(); /* blender.c, does entire library and spacetypes */
// free_matcopybuf();
ANIM_fcurves_copybuf_free();
@@ -521,11 +523,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
BLF_free_unifont_mono();
BLT_lang_free();
#endif
-
+
ANIM_keyingset_infos_exit();
-
+
// free_txt_data();
-
+
#ifdef WITH_PYTHON
/* option not to close python so we can use 'atexit' */
@@ -549,11 +551,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
BKE_blender_userdef_data_free(&U, false);
RNA_exit(); /* should be after BPY_python_end so struct python slots are cleared */
-
+
wm_ghost_exit();
CTX_free(C);
-
+
GHOST_DisposeSystemPaths();
DNA_sdna_current_free();
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 28f978909f7..3a4195ae1ae 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -78,10 +78,10 @@
struct wmJob {
struct wmJob *next, *prev;
-
+
/* job originating from, keep track of this when deleting windows */
wmWindow *win;
-
+
/* should store entire own context, for start, update, free */
void *customdata;
/* to prevent cpu overhead, use this one which only gets called when job really starts, not in thread */
@@ -95,14 +95,14 @@ struct wmJob {
void (*free)(void *);
/* gets called when job is stopped, not in thread */
void (*endjob)(void *);
-
+
/* running jobs each have own timer */
double timestep;
wmTimer *wt;
/* the notifier event timers should send */
unsigned int note, endnote;
-
-
+
+
/* internal */
void *owner;
int flag;
@@ -115,7 +115,7 @@ struct wmJob {
/* once running, we store this separately */
void *run_customdata;
void (*run_free)(void *);
-
+
/* we use BLI_threads api, but per job only 1 thread runs */
ListBase threads;
@@ -152,7 +152,7 @@ static void wm_job_main_thread_yield(wmJob *wm_job)
static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
{
wmJob *wm_job;
-
+
if (owner && job_type) {
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
if (wm_job->owner == owner && wm_job->job_type == job_type)
@@ -168,7 +168,7 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
if (wm_job->job_type == job_type)
return wm_job;
}
-
+
return NULL;
}
@@ -183,7 +183,7 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
{
wmJob *wm_job = wm_job_find(wm, owner, job_type);
-
+
if (wm_job == NULL) {
wm_job = MEM_callocN(sizeof(wmJob), "new job");
@@ -198,7 +198,7 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
WM_job_main_thread_lock_acquire(wm_job);
}
/* else: a running job, be careful */
-
+
/* prevent creating a job with an invalid type */
BLI_assert(wm_job->job_type != WM_JOB_TYPE_ANY);
@@ -209,7 +209,7 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
{
wmJob *wm_job;
-
+
/* job can be running or about to run (suspended) */
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
if (wm_job->owner == owner) {
@@ -227,10 +227,10 @@ bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
float WM_jobs_progress(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
-
+
if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
return wm_job->progress;
-
+
return 0.0;
}
@@ -248,30 +248,30 @@ double WM_jobs_starttime(wmWindowManager *wm, void *owner)
char *WM_jobs_name(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
-
+
if (wm_job)
return wm_job->name;
-
+
return NULL;
}
void *WM_jobs_customdata(wmWindowManager *wm, void *owner)
{
wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
-
+
if (wm_job)
return WM_jobs_customdata_get(wm_job);
-
+
return NULL;
}
void *WM_jobs_customdata_from_type(wmWindowManager *wm, int job_type)
{
wmJob *wm_job = wm_job_find(wm, NULL, job_type);
-
+
if (wm_job)
return WM_jobs_customdata_get(wm_job);
-
+
return NULL;
}
@@ -301,7 +301,7 @@ void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void (*free)(void *
/* pending job? just free */
if (wm_job->customdata)
wm_job->free(wm_job->customdata);
-
+
wm_job->customdata = customdata;
wm_job->free = free;
@@ -333,10 +333,10 @@ void WM_jobs_callbacks(wmJob *wm_job,
static void *do_job_thread(void *job_v)
{
wmJob *wm_job = job_v;
-
+
wm_job->startjob(wm_job->run_customdata, &wm_job->stop, &wm_job->do_update, &wm_job->progress);
wm_job->ready = true;
-
+
return NULL;
}
@@ -345,7 +345,7 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
{
wmJob *wm_job;
bool suspend = false;
-
+
/* job added with suspend flag, we wait 1 timer step before activating it */
if (test->flag & WM_JOB_SUSPEND) {
suspend = true;
@@ -358,12 +358,12 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
if (wm_job == test || !wm_job->running) {
continue;
}
-
+
/* if new job is not render, then check for same startjob */
if (0 == (test->flag & WM_JOB_EXCL_RENDER))
if (wm_job->startjob != test->startjob)
continue;
-
+
/* if new job is render, any render job should be stopped */
if (test->flag & WM_JOB_EXCL_RENDER)
if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER))
@@ -378,7 +378,7 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
}
}
}
-
+
/* Possible suspend ourselves, waiting for other jobs, or de-suspend. */
test->suspended = suspend;
// if (suspend) printf("job suspended: %s\n", test->name);
@@ -396,11 +396,11 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
// printf("job started a running job, ending... %s\n", wm_job->name);
}
else {
-
+
if (wm_job->customdata && wm_job->startjob) {
-
+
wm_jobs_test_suspend_stop(wm, wm_job);
-
+
if (wm_job->suspended == false) {
/* copy to ensure proper free in end */
wm_job->run_customdata = wm_job->customdata;
@@ -408,20 +408,20 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
wm_job->free = NULL;
wm_job->customdata = NULL;
wm_job->running = true;
-
+
if (wm_job->initjob)
wm_job->initjob(wm_job->run_customdata);
-
+
wm_job->stop = false;
wm_job->ready = false;
wm_job->progress = 0.0;
// printf("job started: %s\n", wm_job->name);
-
+
BLI_threadpool_init(&wm_job->threads, do_job_thread, 1);
BLI_threadpool_insert(&wm_job->threads, wm_job);
}
-
+
/* restarted job has timer already */
if (wm_job->wt == NULL)
wm_job->wt = WM_event_add_timer(wm, wm_job->win, TIMERJOBS, wm_job->timestep);
@@ -456,14 +456,14 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
if (wm_job->endjob)
wm_job->endjob(wm_job->run_customdata);
}
-
+
if (wm_job->wt)
WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
if (wm_job->customdata)
wm_job->free(wm_job->customdata);
if (wm_job->run_customdata)
wm_job->run_free(wm_job->run_customdata);
-
+
/* remove wm_job */
wm_job_free(wm, wm_job);
}
@@ -472,17 +472,17 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
void WM_jobs_kill_all(wmWindowManager *wm)
{
wmJob *wm_job;
-
+
while ((wm_job = wm->jobs.first))
wm_jobs_kill_job(wm, wm_job);
-
+
}
/* wait until every job ended, except for one owner (used in undo to keep screen job alive) */
void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
{
wmJob *wm_job, *next_job;
-
+
for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
next_job = wm_job->next;
@@ -495,7 +495,7 @@ void WM_jobs_kill_all_except(wmWindowManager *wm, void *owner)
void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
{
wmJob *wm_job, *next_job;
-
+
for (wm_job = wm->jobs.first; wm_job; wm_job = next_job) {
next_job = wm_job->next;
@@ -509,7 +509,7 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
{
wmJob *wm_job;
-
+
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
if (wm_job->owner == owner || wm_job->startjob == startjob) {
if (wm_job->running) {
@@ -523,7 +523,7 @@ void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, short int *, short int *, float *))
{
wmJob *wm_job;
-
+
wm_job = wm->jobs.first;
while (wm_job) {
if (wm_job->owner == owner || wm_job->startjob == startjob) {
@@ -542,7 +542,7 @@ void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, sho
void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
{
wmJob *wm_job;
-
+
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
if (wm_job->wt == wt) {
wm_jobs_kill_job(wm, wm_job);
@@ -557,18 +557,18 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
wmJob *wm_job, *wm_jobnext;
float total_progress = 0.f;
float jobs_progress = 0;
-
+
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_jobnext) {
wm_jobnext = wm_job->next;
-
+
if (wm_job->wt == wt) {
-
+
/* running threads */
if (wm_job->threads.first) {
/* let threads get temporary lock over main thread if needed */
wm_job_main_thread_yield(wm_job);
-
+
/* always call note and update when ready */
if (wm_job->do_update || wm_job->ready) {
if (wm_job->update)
@@ -580,7 +580,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
wm_job->do_update = false;
}
-
+
if (wm_job->ready) {
if (wm_job->endjob)
wm_job->endjob(wm_job->run_customdata);
@@ -589,7 +589,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
wm_job->run_free(wm_job->run_customdata);
wm_job->run_customdata = NULL;
wm_job->run_free = NULL;
-
+
// if (wm_job->stop) printf("job ready but stopped %s\n", wm_job->name);
// else printf("job finished %s\n", wm_job->name);
@@ -603,10 +603,10 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
WM_job_main_thread_lock_release(wm_job);
BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
-
+
if (wm_job->endnote)
WM_event_add_notifier(C, wm_job->endnote, NULL);
-
+
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
/* new job added for wm_job? */
@@ -617,7 +617,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
else {
WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
wm_job->wt = NULL;
-
+
/* remove wm_job */
wm_job_free(wm, wm_job);
}
@@ -640,8 +640,8 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
}
}
}
-
-
+
+
/* if there are running jobs, set the global progress indicator */
if (jobs_progress > 0) {
wmWindow *win;
@@ -656,7 +656,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
for (win = wm->windows.first; win; win = win->next)
WM_progress_clear(win);
}
-
+
}
bool WM_jobs_has_running(wmWindowManager *wm)
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 1fcfcee0a4c..67493454e8f 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -238,7 +238,7 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
if (kmdi->remove_item)
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
-
+
return kmdin;
}
@@ -261,7 +261,7 @@ static void wm_keymap_diff_item_free(wmKeyMapDiffItem *kmdi)
wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname)
{
wmKeyConfig *keyconf;
-
+
keyconf = MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
BLI_strncpy(keyconf->idname, idname, sizeof(keyconf->idname));
BLI_addtail(&wm->keyconfigs, keyconf);
@@ -316,7 +316,7 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
keyconf = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
if (keyconf)
return keyconf;
-
+
/* otherwise use default */
return wm->defaultconf;
}
@@ -457,16 +457,16 @@ static void keymap_item_set_id(wmKeyMap *keymap, wmKeyMapItem *kmi)
wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
{
wmKeyMapItem *kmi;
-
+
for (kmi = keymap->items.first; kmi; kmi = kmi->next)
if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME))
break;
if (kmi == NULL) {
kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
-
+
BLI_addtail(&keymap->items, kmi);
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
-
+
keymap_item_set_id(keymap, kmi);
keymap_event_set(kmi, type, val, modifier, keymodifier);
@@ -479,7 +479,7 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
{
wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
-
+
BLI_addtail(&keymap->items, kmi);
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
@@ -557,7 +557,7 @@ static wmKeyMapItem *wm_keymap_find_item_equals(wmKeyMap *km, wmKeyMapItem *need
for (kmi = km->items.first; kmi; kmi = kmi->next)
if (wm_keymap_item_equals(kmi, needle))
return kmi;
-
+
return NULL;
}
@@ -568,7 +568,7 @@ static wmKeyMapItem *wm_keymap_find_item_equals_result(wmKeyMap *km, wmKeyMapIte
for (kmi = km->items.first; kmi; kmi = kmi->next)
if (wm_keymap_item_equals_result(kmi, needle))
return kmi;
-
+
return NULL;
}
@@ -731,7 +731,7 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
/* add to list */
BLI_addtail(lb, km);
-
+
return km;
}
@@ -779,7 +779,7 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
/* ****************** storage in WM ************ */
-/* name id's are for storing general or multiple keymaps,
+/* name id's are for storing general or multiple keymaps,
* space/region ids are same as DNA_space_types.h */
/* gets freed in wm.c */
@@ -791,21 +791,21 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
if (km->spaceid == spaceid && km->regionid == regionid)
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
return km;
-
+
return NULL;
}
wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
{
wmKeyMap *km = WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
-
+
if (km == NULL) {
km = wm_keymap_new(idname, spaceid, regionid);
BLI_addtail(&keyconf->keymaps, km);
WM_keyconfig_update_tag(km, NULL);
}
-
+
return km;
}
@@ -838,19 +838,19 @@ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, const Enu
}
}
}
-
+
return km;
}
wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
{
wmKeyMap *km;
-
+
for (km = keyconf->keymaps.first; km; km = km->next)
if (km->flag & KEYMAP_MODAL)
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
break;
-
+
return km;
}
@@ -858,10 +858,10 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
wmKeyMapItem *WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value)
{
wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
-
+
BLI_addtail(&km->items, kmi);
kmi->propvalue = value;
-
+
keymap_event_set(kmi, type, val, modifier, keymodifier);
keymap_item_set_id(km, kmi);
@@ -1129,7 +1129,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
/* skip disabled keymap items [T38447] */
if (kmi->flag & KMI_INACTIVE)
continue;
-
+
if (STREQ(kmi->idname, opname) && WM_key_event_string(kmi->type, false)[0]) {
if (is_hotkey) {
if (!ISHOTKEY(kmi->type))
@@ -1197,7 +1197,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
}
}
}
-
+
/* ensure un-initialized keymap is never used */
if (r_keymap) *r_keymap = NULL;
return NULL;
@@ -1231,7 +1231,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(
if (sa) {
if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-
+
if (ar)
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, is_hotkey, r_keymap);
}
@@ -1447,7 +1447,7 @@ static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
{
wmKeyMapItem *kmi;
int update;
-
+
update = (km->flag & KEYMAP_UPDATE);
km->flag &= ~KEYMAP_UPDATE;
@@ -1455,7 +1455,7 @@ static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
update = update || (kmi->flag & KMI_UPDATE);
kmi->flag &= ~KMI_UPDATE;
}
-
+
return (update != 0);
}
@@ -1513,7 +1513,7 @@ void WM_keyconfig_update(wmWindowManager *wm)
if (wm_keymap_update_flag == 0)
return;
-
+
/* update operator properties for non-modal user keymaps */
for (km = U.user_keymaps.first; km; km = km->next) {
if ((km->flag & KEYMAP_MODAL) == 0) {
@@ -1586,7 +1586,7 @@ wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
if (!keymap)
return NULL;
-
+
/* first user defined keymaps */
km = WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
@@ -1678,13 +1678,13 @@ void WM_keymap_restore_to_default(wmKeyMap *keymap, bContext *C)
wmKeyMapItem *WM_keymap_item_find_id(wmKeyMap *keymap, int id)
{
wmKeyMapItem *kmi;
-
+
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
if (kmi->id == id) {
return kmi;
}
}
-
+
return NULL;
}
@@ -1708,7 +1708,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
wmKeyMap *km = NULL;
SpaceLink *sl = CTX_wm_space_data(C);
-
+
/* Window */
if (STRPREFIX(opname, "WM_OT")) {
km = WM_keymap_find_all(C, "Window", 0, 0);
@@ -1735,8 +1735,8 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
{
km = WM_keymap_find_all(C, "Window", 0, 0);
}
-
-
+
+
/* 3D View */
else if (STRPREFIX(opname, "VIEW3D_OT")) {
km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
@@ -1756,11 +1756,11 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
{
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
-
+
/* Editing Modes */
else if (STRPREFIX(opname, "MESH_OT")) {
km = WM_keymap_find_all(C, "Mesh", 0, 0);
-
+
/* some mesh operators are active in object mode too, like add-prim */
if (km && !WM_keymap_poll((bContext *)C, km)) {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
@@ -1770,7 +1770,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
STRPREFIX(opname, "SURFACE_OT"))
{
km = WM_keymap_find_all(C, "Curve", 0, 0);
-
+
/* some curve operators are active in object mode too, like add-prim */
if (km && !WM_keymap_poll((bContext *)C, km)) {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
@@ -1798,7 +1798,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
}
else if (STRPREFIX(opname, "MBALL_OT")) {
km = WM_keymap_find_all(C, "Metaball", 0, 0);
-
+
/* some mball operators are active in object mode too, like add-prim */
if (km && !WM_keymap_poll((bContext *)C, km)) {
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
@@ -1939,7 +1939,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
break;
}
}
-
+
return km;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 965c3115199..926e87cc3b4 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -252,15 +252,15 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
{
wmOperator *opm;
int retval = OPERATOR_FINISHED;
-
+
wm_macro_start(op);
for (opm = op->macro.first; opm; opm = opm->next) {
-
+
if (opm->type->exec) {
retval = opm->type->exec(C, opm);
OPERATOR_RETVAL_CHECK(retval);
-
+
if (retval & OPERATOR_FINISHED) {
MacroData *md = op->customdata;
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
@@ -273,7 +273,7 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
CLOG_WARN(WM_LOG_OPERATORS, "'%s' cant exec macro", opm->type->idname);
}
}
-
+
return wm_macro_end(op, retval);
}
@@ -291,7 +291,7 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, const wmEvent *
OPERATOR_RETVAL_CHECK(retval);
BLI_movelisttolist(&op->reports->list, &opm->reports->list);
-
+
if (retval & OPERATOR_FINISHED) {
MacroData *md = op->customdata;
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
@@ -314,7 +314,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
wmOperator *opm = op->opm;
int retval = OPERATOR_FINISHED;
-
+
if (opm == NULL) {
CLOG_ERROR(WM_LOG_OPERATORS, "macro error, calling NULL modal()");
}
@@ -389,20 +389,20 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
{
wmOperatorType *ot;
const char *i18n_context;
-
+
if (WM_operatortype_find(idname, true)) {
CLOG_ERROR(WM_LOG_OPERATORS, "operator %s exists, cannot create macro", idname);
return NULL;
}
-
+
ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties);
-
+
ot->idname = idname;
ot->name = name;
ot->description = description;
ot->flag = OPTYPE_MACRO | flag;
-
+
ot->exec = wm_macro_exec;
ot->invoke = wm_macro_invoke;
ot->modal = wm_macro_modal;
@@ -411,7 +411,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
if (!ot->description) /* XXX All ops should have a description but for now allow them not to. */
ot->description = UNDOCUMENTED_OPERATOR_TIP;
-
+
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
/* Use i18n context from ext.srna if possible (py operators). */
@@ -479,7 +479,7 @@ wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char
static void wm_operatortype_free_macro(wmOperatorType *ot)
{
wmOperatorTypeMacro *otmacro;
-
+
for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
if (otmacro->ptr) {
WM_operator_properties_free(otmacro->ptr);
@@ -598,7 +598,7 @@ void WM_operator_py_idname(char *to, const char *from)
const char *sep = strstr(from, "_OT_");
if (sep) {
int ofs = (sep - from);
-
+
/* note, we use ascii tolower instead of system tolower, because the
* latter depends on the locale, and can lead to idname mismatch */
memcpy(to, from, sizeof(char) * ofs);
@@ -1317,7 +1317,7 @@ int WM_operator_confirm_message_ex(bContext *C, wmOperator *op,
layout = UI_popup_menu_layout(pup);
uiItemFullO_ptr(layout, op->type, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0, NULL);
UI_popup_menu_end(C, pup);
-
+
return OPERATOR_INTERFACE;
}
@@ -1437,7 +1437,7 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i
if (is_relative_path ) {
if (exists == false) {
if (idcode == ID_IM) {
- BLI_path_rel(((Image *)id)->name, bmain->name);
+ BLI_path_rel(((Image *)id)->name, BKE_main_blendfile_path(bmain));
}
else {
BLI_assert(0);
@@ -1522,7 +1522,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
}
-
+
UI_block_bounds_set_popup(block, 4, 0, 0);
return block;
@@ -1588,10 +1588,10 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NUMSELECT);
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
-
+
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
-
+
/* clear so the OK button is left alone */
UI_block_func_set(block, NULL, NULL, NULL);
@@ -1663,7 +1663,7 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
if (op && retval > 0)
WM_operator_call_ex(C, op, true);
-
+
MEM_freeN(data);
}
@@ -1739,7 +1739,7 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
{
wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
-
+
data->op = op;
data->width = width;
data->height = height;
@@ -1763,7 +1763,7 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op)
BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s': wrong context", op->type->idname);
return OPERATOR_CANCELLED;
}
-
+
UI_popup_block_invoke(C, wm_block_create_redo, op);
return OPERATOR_CANCELLED;
@@ -1791,11 +1791,11 @@ static void WM_OT_debug_menu(wmOperatorType *ot)
ot->name = "Debug Menu";
ot->idname = "WM_OT_debug_menu";
ot->description = "Open a popup to set the debug level";
-
+
ot->invoke = wm_debug_menu_invoke;
ot->exec = wm_debug_menu_exec;
ot->poll = WM_operator_winactive;
-
+
RNA_def_int(ot->srna, "debug_value", 0, SHRT_MIN, SHRT_MAX, "Debug Value", "", -10000, 10000);
}
@@ -1898,7 +1898,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
/* Builds made from tag only shows tag sha */
BLI_snprintf(hash_buf, sizeof(hash_buf), "Hash: %s", build_hash);
BLI_snprintf(date_buf, sizeof(date_buf), "Date: %s %s", build_commit_date, build_commit_time);
-
+
BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.pixelsize * U.dpi);
hash_width = (int)BLF_width(style->widgetlabel.uifont_id, hash_buf, sizeof(hash_buf)) + U.widget_unit;
date_width = (int)BLF_width(style->widgetlabel.uifont_id, date_buf, sizeof(date_buf)) + U.widget_unit;
@@ -2011,9 +2011,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
UI_but_flag_enable(but, 1);
}
#endif /* WITH_BUILDINFO */
-
+
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style);
-
+
UI_block_emboss_set(block, UI_EMBOSS);
/* show the splash menu (containing interaction presets), using python */
if (mt) {
@@ -2022,10 +2022,10 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
// wmWindowManager *wm = CTX_wm_manager(C);
// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NONE);
}
-
+
UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN);
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
-
+
split = uiLayoutSplit(layout, 0.0f, false);
col = uiLayoutColumn(split, false);
uiItemL(col, IFACE_("Links"), ICON_NONE);
@@ -2071,21 +2071,21 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemS(col);
uiItemO(col, NULL, ICON_RECOVER_LAST, "WM_OT_recover_last_session");
uiItemL(col, "", ICON_NONE);
-
+
mt = WM_menutype_find("USERPREF_MT_splash_footer", false);
if (mt) {
UI_menutype_draw(C, mt, uiLayoutColumn(layout, false));
}
UI_block_bounds_set_centered(block, 0);
-
+
return block;
}
static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
UI_popup_block_invoke(C, wm_block_create_splash, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -2094,7 +2094,7 @@ static void WM_OT_splash(wmOperatorType *ot)
ot->name = "Splash Screen";
ot->idname = "WM_OT_splash";
ot->description = "Open the splash screen with release info";
-
+
ot->invoke = wm_splash_invoke;
ot->poll = WM_operator_winactive;
}
@@ -2114,26 +2114,26 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *userdata)
wmWindow *win = CTX_wm_window(C);
uiBlock *block;
uiBut *but;
-
+
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
-
+
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, init_data->size[0], UI_UNIT_Y, 0, 0, "");
UI_but_func_operator_search(but);
-
+
/* fake button, it holds space for search items */
uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 10 - init_data->size[1],
init_data->size[0], init_data->size[1], NULL, 0, 0, 0, 0, NULL);
-
+
UI_block_bounds_set_popup(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
-
+
wm_event_init_from_window(win, &event);
event.type = EVT_BUT_OPEN;
event.val = KM_PRESS;
event.customdata = but;
event.customdatafree = false;
wm_event_add(win, &event);
-
+
return block;
}
@@ -2152,7 +2152,7 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
};
UI_popup_block_invoke(C, wm_block_search_menu, &data);
-
+
return OPERATOR_INTERFACE;
}
@@ -2181,7 +2181,7 @@ static void WM_OT_search_menu(wmOperatorType *ot)
ot->name = "Search Menu";
ot->idname = "WM_OT_search_menu";
ot->description = "Pop-up a search menu over all available operators in current context";
-
+
ot->invoke = wm_search_menu_invoke;
ot->exec = wm_search_menu_exec;
ot->poll = wm_search_menu_poll;
@@ -2246,8 +2246,9 @@ static int wm_call_panel_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "name", idname);
const int space_type = RNA_enum_get(op->ptr, "space_type");
const int region_type = RNA_enum_get(op->ptr, "region_type");
+ const bool keep_open = RNA_boolean_get(op->ptr, "keep_open");
- return UI_popover_panel_invoke(C, space_type, region_type, idname, true, op->reports);
+ return UI_popover_panel_invoke(C, space_type, region_type, idname, keep_open, op->reports);
}
static void WM_OT_call_panel(wmOperatorType *ot)
@@ -2261,9 +2262,16 @@ static void WM_OT_call_panel(wmOperatorType *ot)
ot->flag = OPTYPE_INTERNAL;
- RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the menu");
- RNA_def_enum(ot->srna, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(ot->srna, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ PropertyRNA *prop;
+
+ prop = RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the menu");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_enum(ot->srna, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_enum(ot->srna, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "keep_open", true, "Keep Open", "");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ************ window / screen operator definitions ************** */
@@ -2364,7 +2372,7 @@ static void WM_OT_console_toggle(wmOperatorType *ot)
ot->name = CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Toggle System Console");
ot->idname = "WM_OT_console_toggle";
ot->description = N_("Toggle System Console");
-
+
ot->exec = wm_console_toggle_exec;
ot->poll = WM_operator_winactive;
}
@@ -2382,20 +2390,20 @@ void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C),
wmPaintCursorDraw draw, void *customdata)
{
wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
-
+
BLI_addtail(&wm->paintcursors, pc);
-
+
pc->customdata = customdata;
pc->poll = poll;
pc->draw = draw;
-
+
return pc;
}
void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
{
wmPaintCursor *pc;
-
+
for (pc = wm->paintcursors.first; pc; pc = pc->next) {
if (pc == (wmPaintCursor *)handle) {
BLI_remlink(&wm->paintcursors, pc);
@@ -2438,7 +2446,7 @@ static void radial_control_update_header(wmOperator *op, bContext *C)
char msg[UI_MAX_DRAW_STR];
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
-
+
if (sa) {
if (hasNumInput(&rc->num_input)) {
char num_str[NUM_STR_REP_LEN];
@@ -2555,7 +2563,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
RNA_property_float_get_array(fill_ptr, fill_prop, col);
}
-
+
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -2592,10 +2600,10 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
immAttrib2f(texCoord, 1, 0);
immVertex2f(pos, radius, -radius);
-
+
immAttrib2f(texCoord, 1, 1);
immVertex2f(pos, radius, radius);
-
+
immAttrib2f(texCoord, 0, 1);
immVertex2f(pos, -radius, radius);
@@ -2611,7 +2619,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
immUniformColor3fvAlpha(col, alpha);
imm_draw_circle_fill_2d(pos, 0.0f, 0.0f, radius, 40);
}
-
+
immUnbindProgram();
}
@@ -2626,7 +2634,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
short strdrawlen = 0;
float strwidth, strheight;
float r1 = 0.0f, r2 = 0.0f, rmin = 0.0, tex_radius, alpha;
- float zoom[2], col[3] = {1, 1, 1};
+ float zoom[2], col[3] = {1, 1, 1};
switch (rc->subtype) {
case PROP_NONE:
@@ -2800,7 +2808,7 @@ static int radial_control_get_path(
return 0;
}
}
-
+
/* check property's array length */
if (*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
MEM_freeN(str);
@@ -2849,7 +2857,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
/* data path is required */
if (!rc->prop)
return 0;
-
+
if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
return 0;
if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
@@ -2884,7 +2892,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
{
return 0;
}
-
+
if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
return 0;
else if (rc->image_id_ptr.data) {
@@ -3007,7 +3015,7 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
if (sa) {
ED_area_headerprint(sa, NULL);
}
-
+
WM_paint_cursor_end(wm, rc->cursor);
/* restore original paint cursors */
@@ -3048,10 +3056,10 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
if (numValue < 0.0f)
numValue += 2.0f * (float)M_PI;
}
-
+
CLAMP(numValue, rc->min_value, rc->max_value);
new_value = numValue;
-
+
radial_control_set_value(rc, new_value);
rc->current_value = new_value;
radial_control_update_header(op, C);
@@ -3202,9 +3210,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
CLAMP(numValue, rc->min_value, rc->max_value);
new_value = numValue;
-
+
radial_control_set_value(rc, new_value);
-
+
rc->current_value = new_value;
radial_control_update_header(op, C);
return OPERATOR_RUNNING_MODAL;
@@ -3408,7 +3416,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
a = 0;
}
}
-
+
time_delta = (PIL_check_seconds_timer() - time_start) * 1000;
RNA_enum_description(redraw_timer_type_items, type, &infostr);
@@ -3418,7 +3426,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
BKE_reportf(op->reports, RPT_WARNING,
"%d x %s: %.4f ms, average: %.8f ms",
iter_steps, infostr, time_delta, time_delta / iter_steps);
-
+
return OPERATOR_FINISHED;
}
@@ -3452,7 +3460,7 @@ static void WM_OT_memory_statistics(wmOperatorType *ot)
ot->name = "Memory Statistics";
ot->idname = "WM_OT_memory_statistics";
ot->description = "Print memory statistics to the console";
-
+
ot->exec = memory_statistics_exec;
}
@@ -3817,21 +3825,21 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
{0, NULL, 0, NULL, NULL}
};
-
+
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
-
+
/* this function is called for each spacetype, only needs to add map once */
if (keymap && keymap->modal_items) return;
-
+
keymap = WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
-
+
/* items for modal map */
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
-
+
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
-
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "IMAGE_OT_sample_line");
WM_modalkeymap_assign(keymap, "PAINT_OT_weight_gradient");
@@ -3859,7 +3867,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
/* items for modal map */
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
-
+
/* Note: cancel only on press otherwise you cannot map this to RMB-gesture */
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
@@ -3871,10 +3879,10 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
/* any unhandled leftclick release handles select */
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
-
+
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_DESELECT);
-
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "ACTION_OT_select_border");
WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_border");
@@ -3928,7 +3936,7 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
- WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_IN);
+ WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_IN);
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_OUT);
@@ -3944,7 +3952,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
wmKeyMapItem *kmi;
-
+
/* note, this doesn't replace existing keymap items */
WM_keymap_verify_item(keymap, "WM_OT_window_new", WKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
#ifdef __APPLE__
@@ -3956,7 +3964,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
@@ -3981,7 +3989,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
/* menus that can be accessed anywhere in blender */
- WM_keymap_verify_item(keymap, "WM_OT_search_menu", TABKEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "WM_OT_search_menu", ACCENTGRAVEKEY, KM_RELEASE, 0, 0);
#ifdef WITH_INPUT_NDOF
WM_keymap_add_menu(keymap, "USERPREF_MT_ndof_settings", NDOF_BUTTON_MENU, KM_PRESS, 0, 0);
@@ -4029,7 +4037,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F12KEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "area.type");
RNA_string_set(kmi->ptr, "value", "DOPESHEET_EDITOR");
-
+
#ifdef WITH_INPUT_NDOF
/* ndof speed */
const char *data_path = "user_preferences.inputs.ndof_sensitivity";
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index d6a1eb81981..d93d51df105 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -101,7 +101,7 @@ typedef struct PlayState {
/* window and viewport size */
int win_x, win_y;
-
+
/* current zoom level */
float zoom;
@@ -122,7 +122,7 @@ typedef struct PlayState {
bool loading;
/* x/y image flip */
bool draw_flip[2];
-
+
int fstep;
/* current picture */
@@ -134,7 +134,7 @@ typedef struct PlayState {
/* saves passing args */
struct ImBuf *curframe_ibuf;
-
+
/* restarts player for file drop */
char dropped_file[FILE_MAX];
} PlayState;
@@ -946,13 +946,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
{
GHOST_TEventButtonData *bd = GHOST_GetEventData(evt);
int cx, cy, sizex, sizey, inside_window;
-
+
GHOST_GetCursorPosition(g_WS.ghost_system, &cx, &cy);
GHOST_ScreenToClient(g_WS.ghost_window, cx, cy, &cx, &cy);
playanim_window_get_size(&sizex, &sizey);
inside_window = (cx >= 0 && cx < sizex && cy >= 0 && cy <= sizey);
-
+
if (bd->button == GHOST_kButtonMaskLeft) {
if (type == GHOST_kEventButtonDown) {
if (inside_window) {
@@ -1016,23 +1016,23 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kEventWindowMove:
{
float zoomx, zoomy;
-
+
playanim_window_get_size(&ps->win_x, &ps->win_y);
GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
zoomx = (float) ps->win_x / ps->ibufx;
zoomy = (float) ps->win_y / ps->ibufy;
-
+
/* zoom always show entire image */
ps->zoom = MIN2(zoomx, zoomy);
-
+
/* zoom steps of 2 for speed */
ps->zoom = floor(ps->zoom + 0.5f);
if (ps->zoom < 1.0f) ps->zoom = 1.0f;
-
+
glViewport(0, 0, ps->win_x, ps->win_y);
glScissor(0, 0, ps->win_x, ps->win_y);
-
+
playanim_gl_matrix();
ptottime = 0.0;
@@ -1049,11 +1049,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kEventDraggingDropDone:
{
GHOST_TEventDragnDropData *ddd = GHOST_GetEventData(evt);
-
+
if (ddd->dataType == GHOST_kDragnDropTypeFilenames) {
GHOST_TStringArray *stra = ddd->data;
int a;
-
+
for (a = 0; a < stra->count; a++) {
BLI_strncpy(ps->dropped_file, (char *)stra->strings[a], sizeof(ps->dropped_file));
ps->go = false;
@@ -1120,7 +1120,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
int sfra = -1;
int efra = -1;
int totblock;
-
+
PlayState ps = {0};
/* ps.doubleb = true;*/ /* UNUSED */
@@ -1271,14 +1271,14 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
ps.ibufx = ibuf->x;
ps.ibufy = ibuf->y;
-
+
ps.win_x = ps.ibufx;
ps.win_y = ps.ibufy;
if (maxwinx % ibuf->x) maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
if (maxwiny % ibuf->y) maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
-
+
glClearColor(0.1, 0.1, 0.1, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -1547,7 +1547,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
BLI_strncpy(filepath, ps.dropped_file, sizeof(filepath));
return filepath;
}
-
+
IMB_exit();
BKE_images_exit();
DEG_free_node_types();
@@ -1560,7 +1560,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
MEM_printmemlist();
#endif
}
-
+
return NULL;
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 28fb4f2e011..e1528551c12 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -35,7 +35,7 @@
#include <stdio.h>
#include <string.h>
-#include "DNA_listBase.h"
+#include "DNA_listBase.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
@@ -85,6 +85,8 @@
#include "GPU_framebuffer.h"
#include "GPU_init_exit.h"
#include "GPU_immediate.h"
+#include "GPU_material.h"
+#include "GPU_texture.h"
#include "BLF_api.h"
#include "UI_resources.h"
@@ -112,7 +114,7 @@ static struct WMInitStruct {
int windowstate;
WinOverrideFlag override_flag;
-
+
bool native_pixels;
} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true};
@@ -124,7 +126,7 @@ void wm_get_screensize(int *r_width, int *r_height)
{
unsigned int uiwidth;
unsigned int uiheight;
-
+
GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
*r_width = uiwidth;
*r_height = uiheight;
@@ -146,9 +148,9 @@ void wm_get_desktopsize(int *r_width, int *r_height)
static void wm_window_check_position(rcti *rect)
{
int width, height, d;
-
+
wm_get_screensize(&width, &height);
-
+
if (rect->xmin < 0) {
rect->xmax -= rect->xmin;
rect->xmin = 0;
@@ -167,7 +169,7 @@ static void wm_window_check_position(rcti *rect)
rect->ymax -= d;
rect->ymin -= d;
}
-
+
if (rect->xmin < 0) rect->xmin = 0;
if (rect->ymin < 0) rect->ymin = 0;
}
@@ -193,12 +195,12 @@ static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win)
}
}
-/* including window itself, C can be NULL.
+/* including window itself, C can be NULL.
* ED_screen_exit should have been called */
void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
{
wmTimer *wt, *wtnext;
-
+
/* update context */
if (C) {
WM_event_remove_handlers(C, &win->handlers);
@@ -216,7 +218,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
if (wt->win == win && wt->event_type == TIMERJOBS)
wm_jobs_timer_ended(wm, wt);
}
-
+
/* timer removing, need to call this api function */
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next;
@@ -225,7 +227,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
}
if (win->eventstate) MEM_freeN(win->eventstate);
-
+
wm_event_free_all(win);
wm_ghostwindow_destroy(wm, win);
@@ -240,11 +242,11 @@ static int find_free_winid(wmWindowManager *wm)
{
wmWindow *win;
int id = 1;
-
+
for (win = wm->windows.first; win; win = win->next)
if (id <= win->winid)
id = win->winid + 1;
-
+
return id;
}
@@ -287,6 +289,7 @@ static wmWindow *wm_window_new_test(bContext *C)
/* part of wm_window.c api */
wmWindow *wm_window_copy(bContext *C, wmWindow *win_src, const bool duplicate_layout)
{
+ Main *bmain = CTX_data_main(C);
wmWindow *win_dst = wm_window_new(C);
WorkSpace *workspace = WM_window_get_active_workspace(win_src);
WorkSpaceLayout *layout_old = WM_window_get_active_layout(win_src);
@@ -300,7 +303,7 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *win_src, const bool duplicate_la
win_dst->scene = scene;
WM_window_set_active_workspace(win_dst, workspace);
- layout_new = duplicate_layout ? ED_workspace_layout_duplicate(workspace, layout_old, win_dst) : layout_old;
+ layout_new = duplicate_layout ? ED_workspace_layout_duplicate(bmain, workspace, layout_old, win_dst) : layout_old;
WM_window_set_active_layout(win_dst, workspace, layout_new);
*win_dst->stereo3d_format = *win_src->stereo3d_format;
@@ -373,6 +376,7 @@ static void wm_block_confirm_quit_save(bContext *C, void *arg_block, void *UNUSE
/* Build the confirm dialog UI */
static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar, void *UNUSED(arg1))
{
+ Main *bmain = CTX_data_main(C);
uiStyle *style = UI_style_get();
uiBlock *block = UI_block_begin(C, ar, "confirm_quit_popup", UI_EMBOSS);
@@ -386,11 +390,11 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar
/* Text and some vertical space */
{
char *message;
- if (G.main->name[0] == '\0') {
+ if (BKE_main_blendfile_path(bmain)[0] == '\0') {
message = BLI_strdup(IFACE_("This file has not been saved yet. Save before closing?"));
}
else {
- const char *basename = BLI_path_basename(G.main->name);
+ const char *basename = BLI_path_basename(BKE_main_blendfile_path(bmain));
message = BLI_sprintfN(IFACE_("Save changes to \"%s\" before closing?"), basename);
}
uiItemL(layout, message, ICON_ERROR);
@@ -483,7 +487,7 @@ void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win)
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
{
wmWindow *tmpwin;
-
+
/* first check if we have to quit (there are non-temp remaining windows) */
for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) {
if (tmpwin == win)
@@ -501,7 +505,7 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
WorkSpaceLayout *layout = BKE_workspace_active_layout_get(win->workspace_hook);
BLI_remlink(&wm->windows, win);
-
+
CTX_wm_window_set(C, win); /* needed by handlers */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
@@ -545,9 +549,10 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
}
else if (win->ghostwin) {
/* this is set to 1 if you don't have startup.blend open */
- if (G.save_over && G.main->name[0]) {
- char str[sizeof(G.main->name) + 24];
- BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*", G.main->name,
+ if (G.save_over && BKE_main_blendfile_path_from_global()[0]) {
+ char str[sizeof(((Main *)NULL)->name) + 24];
+ BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*",
+ BKE_main_blendfile_path_from_global(),
G.main->recovered ? " (Recovered)" : "");
GHOST_SetTitle(win->ghostwin, str);
}
@@ -558,7 +563,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
* and to give hint of unsaved changes for a user warning mechanism
* in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */
GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8) !wm->file_saved);
-
+
}
}
@@ -624,7 +629,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
GHOST_WindowHandle ghostwin;
GHOST_GLSettings glSettings = {0};
int scr_w, scr_h, posy;
-
+
/* a new window is created when pageflip mode is required for a window */
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
glSettings.flags |= GHOST_glStereoVisual;
@@ -635,7 +640,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
wm_get_screensize(&scr_w, &scr_h);
posy = (scr_h - win->posy - win->sizey);
-
+
ghostwin = GHOST_CreateWindow(g_system, title,
win->posx, posy, win->sizex, win->sizey,
(GHOST_TWindowState)win->windowstate,
@@ -651,16 +656,16 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
gpu_batch_presets_reset();
win->gwnctx = GWN_context_create();
-
+
/* the new window has already been made drawable upon creation */
wm->windrawable = win;
/* needed so we can detect the graphics card below */
GPU_init();
-
+
win->ghostwin = ghostwin;
GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
-
+
wm_window_ensure_eventstate(win);
/* store actual window size in blender window */
@@ -672,7 +677,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
win->sizey = GHOST_GetHeightRectangle(bounds);
}
GHOST_DisposeRectangle(bounds);
-
+
#ifndef __APPLE__
/* set the state here, so minimized state comes up correct on windows */
GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
@@ -683,14 +688,14 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
glClear(GL_COLOR_BUFFER_BIT);
}
-
+
/* needed here, because it's used before it reads userdef */
WM_window_set_dpi(win);
-
+
wm_window_swap_buffers(win);
-
+
//GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified);
-
+
/* standard state vars for window */
GPU_state_init();
}
@@ -713,7 +718,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
{
wmKeyMap *keymap;
wmWindow *win;
-
+
BLI_assert(G.background == false);
/* no commandline prefsize? then we set this.
@@ -722,7 +727,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
*/
if (wm_init_state.size_x == 0) {
wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
-
+
/* note!, this isnt quite correct, active screen maybe offset 1000s if PX,
* we'd need a wm_get_screensize like function that gives offset,
* in practice the window manager will likely move to the correct monitor */
@@ -740,7 +745,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
wm_init_state.size_y -= WM_WIN_INIT_PAD * 2;
#endif
}
-
+
for (win = wm->windows.first; win; win = win->next) {
if (win->ghostwin == NULL) {
if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) {
@@ -771,13 +776,13 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
/* add keymap handlers (1 handler for all keys in map!) */
keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0);
WM_event_add_keymap_handler(&win->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
WM_event_add_keymap_handler(&win->handlers, keymap);
keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
WM_event_add_keymap_handler(&win->modalhandlers, keymap);
-
+
/* add drop boxes */
{
ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
@@ -820,7 +825,7 @@ wmWindow *WM_window_open(bContext *C, const rcti *rect)
{
wmWindow *win_prev = CTX_wm_window(C);
wmWindow *win = wm_window_new(C);
-
+
win->posx = rect->xmin;
win->posy = rect->ymin;
win->sizex = BLI_rcti_size_x(rect);
@@ -871,16 +876,16 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
/* changes rect to fit within desktop */
wm_window_check_position(&rect);
-
+
/* test if we have a temp screen already */
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
if (WM_window_is_temp_screen(win))
break;
-
+
/* add new window? */
if (win == NULL) {
win = wm_window_new(C);
-
+
win->posx = rect.xmin;
win->posy = rect.ymin;
}
@@ -903,7 +908,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
if (screen == NULL) {
/* add new screen layout */
WorkSpace *workspace = WM_window_get_active_workspace(win);
- WorkSpaceLayout *layout = ED_workspace_layout_add(workspace, win, "temp");
+ WorkSpaceLayout *layout = ED_workspace_layout_add(bmain, workspace, win, "temp");
screen = BKE_workspace_layout_screen_get(layout);
WM_window_set_active_layout(win, workspace, layout);
@@ -932,7 +937,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
/* ensure it shows the right spacetype editor */
sa = screen->areabase.first;
CTX_wm_area_set(C, sa);
-
+
if (type == WM_WINDOW_RENDER) {
ED_area_newspace(C, sa, SPACE_IMAGE, false);
}
@@ -942,26 +947,26 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
else {
ED_area_newspace(C, sa, SPACE_USERPREF, false);
}
-
+
ED_screen_change(C, screen);
ED_screen_refresh(CTX_wm_manager(C), win); /* test scale */
-
+
/* do additional setup for specific editor type */
if (type == WM_WINDOW_DRIVERS) {
/* Configure editor - mode, tabs, framing */
SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
sipo->mode = SIPO_MODE_DRIVERS;
-
+
ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar_props) {
UI_panel_category_active_set(ar_props, "Drivers");
-
+
ar_props->flag &= ~RGN_FLAG_HIDDEN;
/* XXX: Adjust width of this too? */
-
+
ED_region_visibility_change_update(C, ar_props);
}
-
+
ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
if (ar_main) {
/* XXX: Ideally we recenter based on the range instead... */
@@ -969,11 +974,11 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
ar_main->v2d.tot.ymin = -2.0f;
ar_main->v2d.tot.xmax = 2.0f;
ar_main->v2d.tot.ymax = 2.0f;
-
+
ar_main->v2d.cur = ar_main->v2d.tot;
}
}
-
+
if (sa->spacetype == SPACE_IMAGE)
title = IFACE_("Blender Render");
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
@@ -1028,6 +1033,7 @@ static WorkSpaceLayout *wm_window_new_find_layout(wmOperator *op, WorkSpace *wor
/* new window operator callback */
int wm_window_new_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
wmWindow *win_src = CTX_wm_window(C);
WorkSpace *workspace = WM_window_get_active_workspace(win_src);
WorkSpaceLayout *layout_new = wm_window_new_find_layout(op, workspace);
@@ -1037,7 +1043,7 @@ int wm_window_new_exec(bContext *C, wmOperator *op)
if ((win_dst = wm_window_new_test(C))) {
if (screen_new->winid) {
/* layout/screen is already used, duplicate it */
- layout_new = ED_workspace_layout_duplicate(workspace, layout_new, win_dst);
+ layout_new = ED_workspace_layout_duplicate(bmain, workspace, layout_new, win_dst);
screen_new = BKE_workspace_layout_screen_get(layout_new);
}
/* New window with a different screen but same workspace */
@@ -1128,7 +1134,7 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
return OPERATOR_FINISHED;
-
+
}
@@ -1137,10 +1143,10 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
void wm_cursor_position_from_ghost(wmWindow *win, int *x, int *y)
{
float fac = GHOST_GetNativePixelSize(win->ghostwin);
-
+
GHOST_ScreenToClient(win->ghostwin, *x, *y, x, y);
*x *= fac;
-
+
*y = (win->sizey - 1) - *y;
*y *= fac;
}
@@ -1170,11 +1176,11 @@ typedef enum {
} modifierKeyType;
/* check if specified modifier key type is pressed */
-static int query_qual(modifierKeyType qual)
+static int query_qual(modifierKeyType qual)
{
GHOST_TModifierKeyMask left, right;
int val = 0;
-
+
switch (qual) {
case SHIFT:
left = GHOST_kModifierKeyLeftShift;
@@ -1193,15 +1199,15 @@ static int query_qual(modifierKeyType qual)
right = GHOST_kModifierKeyRightAlt;
break;
}
-
+
GHOST_GetModifierKeyState(g_system, left, &val);
if (!val)
GHOST_GetModifierKeyState(g_system, right, &val);
-
+
return val;
}
-void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
+void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
{
BLI_assert(GPU_framebuffer_current_get() == 0);
@@ -1255,7 +1261,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
wmWindowManager *wm = CTX_wm_manager(C);
GHOST_TEventType type = GHOST_GetEventType(evt);
int time = GHOST_GetEventTime(evt);
-
+
if (type == GHOST_kEventQuit) {
WM_exit(C);
}
@@ -1263,7 +1269,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
GHOST_TEventDataPtr data = GHOST_GetEventData(evt);
wmWindow *win;
-
+
/* Ghost now can call this function for life resizes, but it should return if WM didn't initialize yet.
* Can happen on file read (especially full size window) */
if ((wm->initialized & WM_WINDOW_IS_INITIALIZED) == 0) {
@@ -1284,12 +1290,12 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
else {
win = GHOST_GetWindowUserData(ghostwin);
}
-
+
switch (type) {
case GHOST_kEventWindowDeactivate:
wm_event_add_ghostevent(wm, win, type, time, data);
win->active = 0; /* XXX */
-
+
/* clear modifiers for inactive windows */
win->eventstate->alt = 0;
win->eventstate->ctrl = 0;
@@ -1298,7 +1304,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
win->eventstate->keymodifier = 0;
break;
- case GHOST_kEventWindowActivate:
+ case GHOST_kEventWindowActivate:
{
GHOST_TEventKeyData kdata;
wmEvent event;
@@ -1314,10 +1320,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
#endif
wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
-
+
win->active = 1;
// window_handle(win, INPUTCHANGE, win->active);
-
+
/* bad ghost support for modifier keys... so on activate we set the modifiers again */
/* TODO: This is not correct since a modifier may be held when a window is activated...
@@ -1386,15 +1392,15 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
/* keymodifier zero, it hangs on hotkeys that open windows otherwise */
win->eventstate->keymodifier = 0;
-
+
/* entering window, update mouse pos. but no event */
wm_get_cursor_position(win, &wx, &wy);
win->eventstate->x = wx;
win->eventstate->y = wy;
-
+
win->addmousemove = 1; /* enables highlighted buttons */
-
+
wm_window_make_drawable(wm, win);
/* window might be focused by mouse click in configuration of window manager
@@ -1425,7 +1431,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
if (G.debug & G_DEBUG_EVENTS) {
printf("%s: ghost redraw %d\n", __func__, win->winid);
}
-
+
wm_window_make_drawable(wm, win);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -1444,18 +1450,18 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
}
WM_window_set_dpi(win);
-
+
/* win32: gives undefined window size when minimized */
if (state != GHOST_kWindowStateMinimized) {
GHOST_RectangleHandle client_rect;
int l, t, r, b, scr_w, scr_h;
int sizex, sizey, posx, posy;
-
+
client_rect = GHOST_GetClientBounds(win->ghostwin);
GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
-
+
GHOST_DisposeRectangle(client_rect);
-
+
wm_get_desktopsize(&scr_w, &scr_h);
sizex = r - l;
sizey = b - t;
@@ -1466,8 +1472,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
* Ghost sometimes send size or move events when the window hasn't changed.
* One case of this is using compiz on linux. To alleviate the problem
* we ignore all such event here.
- *
- * It might be good to eventually do that at Ghost level, but that is for
+ *
+ * It might be good to eventually do that at Ghost level, but that is for
* another time.
*/
if (win->sizex != sizex ||
@@ -1510,12 +1516,12 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
win->posx, win->posy, win->sizex, win->sizey);
}
}
-
+
wm_window_make_drawable(wm, win);
BKE_icon_changed(screen->id.icon_id);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
-
+
#if defined(__APPLE__) || defined(WIN32)
/* OSX and Win32 don't return to the mainloop while resize */
wm_event_do_notifiers(C);
@@ -1546,19 +1552,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
PointerRNA props_ptr;
wmWindow *oldWindow;
const char *path = GHOST_GetEventData(evt);
-
+
if (path) {
wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
/* operator needs a valid window in context, ensures
* it is correctly set */
oldWindow = CTX_wm_window(C);
CTX_wm_window_set(C, win);
-
+
WM_operator_properties_create_ptr(&props_ptr, ot);
RNA_string_set(&props_ptr, "filepath", path);
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
WM_operator_properties_free(&props_ptr);
-
+
CTX_wm_window_set(C, oldWindow);
}
break;
@@ -1568,53 +1574,53 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
wmEvent event;
GHOST_TEventDragnDropData *ddd = GHOST_GetEventData(evt);
int wx, wy;
-
+
/* entering window, update mouse pos */
wm_get_cursor_position(win, &wx, &wy);
win->eventstate->x = wx;
win->eventstate->y = wy;
-
+
wm_event_init_from_window(win, &event); /* 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_DRAGDROP;
event.customdata = &wm->drags;
event.customdatafree = 1;
-
+
wm_event_add(win, &event);
-
+
/* printf("Drop detected\n"); */
-
+
/* add drag data to wm for paths: */
-
+
if (ddd->dataType == GHOST_kDragnDropTypeFilenames) {
GHOST_TStringArray *stra = ddd->data;
int a, icon;
-
+
for (a = 0; a < stra->count; a++) {
printf("drop file %s\n", stra->strings[a]);
/* try to get icon type from extension */
icon = ED_file_extension_icon((char *)stra->strings[a]);
-
+
WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0, WM_DRAG_NOP);
/* void poin should point to string, it makes a copy */
break; /* only one drop element supported now */
}
}
-
+
break;
}
case GHOST_kEventNativeResolutionChange:
@@ -1644,7 +1650,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
case GHOST_kEventTrackpad:
{
GHOST_TEventTrackpadData *pd = data;
-
+
wm_cursor_position_from_ghost(win, &pd->x, &pd->y);
wm_event_add_ghostevent(wm, win, type, time, data);
break;
@@ -1652,7 +1658,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
case GHOST_kEventCursorMove:
{
GHOST_TEventCursorData *cd = data;
-
+
wm_cursor_position_from_ghost(win, &cd->x, &cd->y);
wm_event_add_ghostevent(wm, win, type, time, data);
break;
@@ -1680,7 +1686,7 @@ static int wm_window_timer(const bContext *C)
wmWindow *win;
double time = PIL_check_seconds_timer();
int retval = 0;
-
+
for (wt = wm->timers.first; wt; wt = wtnext) {
wtnext = wt->next; /* in case timer gets removed */
win = wt->win;
@@ -1701,7 +1707,7 @@ static int wm_window_timer(const bContext *C)
else if (win) {
wmEvent event;
wm_event_init_from_window(win, &event);
-
+
event.type = wt->event_type;
event.val = KM_NOTHING;
event.keymodifier = 0;
@@ -1717,7 +1723,7 @@ static int wm_window_timer(const bContext *C)
return retval;
}
-void wm_window_process_events(const bContext *C)
+void wm_window_process_events(const bContext *C)
{
int hasevent;
@@ -1727,7 +1733,7 @@ void wm_window_process_events(const bContext *C)
if (hasevent)
GHOST_DispatchEvents(g_system);
-
+
hasevent |= wm_window_timer(C);
/* no event, we sleep 5 milliseconds */
@@ -1735,7 +1741,7 @@ void wm_window_process_events(const bContext *C)
PIL_sleep_ms(5);
}
-void wm_window_process_events_nosleep(void)
+void wm_window_process_events_nosleep(void)
{
if (GHOST_ProcessEvents(g_system, 0))
GHOST_DispatchEvents(g_system);
@@ -1754,10 +1760,10 @@ void wm_window_testbreak(void)
*/
if ((curtime - ltime) > 0.05) {
int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
-
+
if (hasevent)
GHOST_DispatchEvents(g_system);
-
+
ltime = curtime;
}
}
@@ -1774,13 +1780,13 @@ void wm_ghost_init(bContext *C)
if (C != NULL) {
consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
}
-
+
g_system = GHOST_CreateSystem();
if (C != NULL) {
GHOST_AddEventConsumer(g_system, consumer);
}
-
+
if (wm_init_state.native_pixels) {
GHOST_UseNativePixels();
}
@@ -1801,7 +1807,7 @@ void wm_ghost_exit(void)
void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, bool do_sleep)
{
wmTimer *wt;
-
+
for (wt = wm->timers.first; wt; wt = wt->next)
if (wt == timer)
break;
@@ -1820,9 +1826,9 @@ wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type,
wt->stime = wt->ltime;
wt->timestep = timestep;
wt->win = win;
-
+
BLI_addtail(&wm->timers, wt);
-
+
return wt;
}
@@ -1847,23 +1853,23 @@ wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigne
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
{
wmTimer *wt;
-
+
/* extra security check */
for (wt = wm->timers.first; wt; wt = wt->next)
if (wt == timer)
break;
if (wt) {
wmWindow *win;
-
+
if (wm->reports.reporttimer == wt)
wm->reports.reporttimer = NULL;
-
+
BLI_remlink(&wm->timers, wt);
if (wt->customdata != NULL && (wt->flags & WM_TIMER_NO_FREE_CUSTOM_DATA) == 0) {
MEM_freeN(wt->customdata);
}
MEM_freeN(wt);
-
+
/* there might be events in queue with this timer as customdata */
for (win = wm->windows.first; win; win = win->next) {
wmEvent *event;
@@ -1900,7 +1906,7 @@ static char *wm_clipboard_text_get_ex(bool selection, int *r_len,
*r_len = 0;
return NULL;
}
-
+
/* always convert from \r\n to \n */
p2 = newbuf = MEM_mallocN(strlen(buf) + 1, __func__);
@@ -1926,7 +1932,7 @@ static char *wm_clipboard_text_get_ex(bool selection, int *r_len,
*p2 = '\0';
free(buf); /* ghost uses regular malloc */
-
+
*r_len = (p2 - newbuf);
return newbuf;
@@ -1958,16 +1964,16 @@ void WM_clipboard_text_set(const char *buf, bool selection)
const char *p;
char *p2, *newbuf;
int newlen = 0;
-
+
for (p = buf; *p; p++) {
if (*p == '\n')
newlen += 2;
else
newlen++;
}
-
+
newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set");
-
+
for (p = buf, p2 = newbuf; *p; p++, p2++) {
if (*p == '\n') {
*(p2++) = '\r'; *p2 = '\n';
@@ -1977,7 +1983,7 @@ void WM_clipboard_text_set(const char *buf, bool selection)
}
}
*p2 = '\0';
-
+
GHOST_putClipboard((GHOST_TInt8 *)newbuf, selection);
MEM_freeN(newbuf);
#else
@@ -2006,23 +2012,25 @@ void wm_window_get_position(wmWindow *win, int *r_pos_x, int *r_pos_y)
*r_pos_y = win->posy;
}
-void wm_window_set_size(wmWindow *win, int width, int height)
+void wm_window_set_size(wmWindow *win, int width, int height)
{
GHOST_SetClientSize(win->ghostwin, width, height);
}
-void wm_window_lower(wmWindow *win)
+void wm_window_lower(wmWindow *win)
{
GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderBottom);
}
-void wm_window_raise(wmWindow *win)
+void wm_window_raise(wmWindow *win)
{
GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderTop);
}
void wm_window_swap_buffers(wmWindow *win)
{
+ GPU_texture_orphans_delete(); /* XXX should be done elsewhere. */
+ GPU_material_orphans_delete(); /* XXX Amen to that. */
GHOST_SwapWindowBuffers(win->ghostwin);
}
@@ -2117,13 +2125,13 @@ float WM_cursor_pressure(const struct wmWindow *win)
int WM_window_pixels_x(const wmWindow *win)
{
float f = GHOST_GetNativePixelSize(win->ghostwin);
-
+
return (int)(f * (float)win->sizex);
}
int WM_window_pixels_y(const wmWindow *win)
{
float f = GHOST_GetNativePixelSize(win->ghostwin);
-
+
return (int)(f * (float)win->sizey);
}
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 33ca415b664..c92691eb65e 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -41,7 +41,7 @@ typedef struct wmPaintCursor {
struct wmPaintCursor *next, *prev;
void *customdata;
-
+
int (*poll)(struct bContext *C);
void (*draw)(bContext *C, int, int, void *customdata);
} wmPaintCursor;
@@ -54,7 +54,7 @@ extern void wm_close_and_free_all(bContext *C, ListBase *);
extern void wm_add_default(struct Main *bmain, bContext *C);
extern void wm_clear_default_size(bContext *C);
-
+
/* register to windowmanager for redo or macro */
void wm_operator_register(bContext *C, wmOperator *op);
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index c695a12f52c..939409f9511 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -39,12 +39,12 @@ void wm_init_cursor_data(void);
/* old cursors */
enum {
CURSOR_FACESEL = BC_GHOST_CURSORS,
- CURSOR_WAIT,
- CURSOR_EDIT,
- CURSOR_X_MOVE,
- CURSOR_Y_MOVE,
- CURSOR_HELP,
- CURSOR_STD,
+ CURSOR_WAIT,
+ CURSOR_EDIT,
+ CURSOR_X_MOVE,
+ CURSOR_Y_MOVE,
+ CURSOR_HELP,
+ CURSOR_STD,
CURSOR_NONE,
CURSOR_PENCIL,
CURSOR_COPY
@@ -57,21 +57,21 @@ typedef struct BCursor {
char *small_bm;
char *small_mask;
- char small_sizex;
- char small_sizey;
- char small_hotx;
- char small_hoty;
+ char small_sizex;
+ char small_sizey;
+ char small_hotx;
+ char small_hoty;
- char *big_bm;
+ char *big_bm;
char *big_mask;
- char big_sizex;
- char big_sizey;
- char big_hotx;
- char big_hoty;
+ char big_sizex;
+ char big_sizey;
+ char big_hotx;
+ char big_hoty;
- char fg_color;
- char bg_color;
+ char fg_color;
+ char bg_color;
} BCursor;
@@ -101,7 +101,7 @@ enum {
enum {
BC_BLACK = 0,
- BC_WHITE,
+ BC_WHITE,
BC_RED,
BC_BLUE,
BC_GREEN,
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 5edd4a76127..db2fd5ce7f2 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -92,7 +92,7 @@ enum {
WM_IME_COMPOSITE_EVENT = 0x0015,
/* IME event, GHOST_kEventImeCompositionEnd in ghost */
WM_IME_COMPOSITE_END = 0x0016,
-
+
/* Tablet/Pen Specific Events */
TABLET_STYLUS = 0x001a,
TABLET_ERASER = 0x001b,