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:
-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.h36
-rw-r--r--source/blender/windowmanager/intern/wm.c36
-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.c28
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c414
-rw-r--r--source/blender/windowmanager/intern/wm_files.c68
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c10
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c46
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c44
-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.c146
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c40
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c34
-rw-r--r--source/blender/windowmanager/intern/wm_window.c258
-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
21 files changed, 757 insertions, 757 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 7ebd7bb3204..75b2cfffd03 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -104,7 +104,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);
-
+
/* returns true if draw method is triple buffer */
bool WM_is_draw_triple(struct wmWindow *win);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index ef431049bb1..c95284143b4 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);
@@ -77,7 +77,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 b7ad7b622e2..298c5184ced 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -199,15 +199,15 @@ enum {
typedef struct wmNotifier {
struct wmNotifier *next, *prev;
-
+
struct wmWindowManager *wm;
struct wmWindow *window;
-
+
int swinid; /* can't rely on this, notifiers can be added without context, swinid of 0 */
unsigned int category, data, subtype, action;
-
+
void *reference;
-
+
} wmNotifier;
@@ -322,7 +322,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)
@@ -420,7 +420,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 */
@@ -438,7 +438,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 */
@@ -455,11 +455,11 @@ 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 is_motion_absolute;
@@ -475,7 +475,7 @@ typedef struct wmEvent {
short customdatafree;
int pad2;
void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
-
+
} wmEvent;
/* ************** custom wmEvent data ************** */
@@ -514,17 +514,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 */
@@ -640,16 +640,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;
@@ -658,13 +658,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 a425eadfe21..98d9edb9f94 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -104,7 +104,7 @@ void WM_operator_free(wmOperator *op)
WM_operator_free(opm);
}
}
-
+
MEM_freeN(op);
}
@@ -187,11 +187,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);
}
@@ -359,7 +359,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_INIT_KEYMAP) == 0) {
@@ -383,7 +383,7 @@ 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;
@@ -417,7 +417,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;
@@ -427,7 +427,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;
@@ -443,16 +443,16 @@ void wm_add_default(bContext *C)
wmWindowManager *wm = BKE_libblock_alloc(CTX_data_main(C), ID_WM, "WinMan", 0);
wmWindow *win;
bScreen *screen = CTX_wm_screen(C); /* XXX from file read hrmf */
-
+
CTX_wm_manager_set(C, wm);
win = wm_window_new(C);
win->screen = screen;
screen->winid = win->winid;
BLI_strncpy(win->screenname, screen->id.name + 2, sizeof(win->screenname));
-
+
wm->winactive = win;
wm->file_saved = 1;
- wm_window_make_drawable(wm, win);
+ wm_window_make_drawable(wm, win);
}
@@ -471,7 +471,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
wm_draw_window_clear(win);
wm_window_free(C, wm, win);
}
-
+
while ((op = BLI_pophead(&wm->operators))) {
WM_operator_free(op);
}
@@ -481,11 +481,11 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
}
BLI_freelistN(&wm->queue);
-
+
BLI_freelistN(&wm->paintcursors);
WM_drag_free_list(&wm->drags);
-
+
wm_reports_free(wm);
if (wm->undo_stack) {
@@ -515,16 +515,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 c3e1e14f38d..6aef38a320b 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 "BKE_context.h"
#include "BKE_global.h"
@@ -57,7 +57,7 @@
/* Some simple ghost <-> blender conversions */
-static GHOST_TStandardCursor convert_cursor(int curs)
+static GHOST_TStandardCursor convert_cursor(int curs)
{
switch (curs) {
default:
@@ -78,23 +78,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,
@@ -131,12 +131,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));
@@ -178,7 +178,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);
@@ -196,7 +196,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;
@@ -204,7 +204,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;
}
@@ -293,12 +293,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];
@@ -309,7 +309,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);
}
@@ -423,7 +423,7 @@ BEGIN_CURSOR_BLOCK
};
BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
-
+
END_CURSOR_BLOCK
/********************** EW_ARROW Cursor *************************/
BEGIN_CURSOR_BLOCK
@@ -444,7 +444,7 @@ BEGIN_CURSOR_BLOCK
static BCursor EWArrowCursor = {
/*small*/
ew_sbm, ew_smsk,
- 16, 16,
+ 16, 16,
7, 6,
/*big*/
NULL, NULL,
@@ -514,7 +514,7 @@ BEGIN_CURSOR_BLOCK
static BCursor WaitCursor = {
/*small*/
wait_sbm, wait_smsk,
- 16, 16,
+ 16, 16,
7, 7,
/*big*/
wait_lbm, wait_lmsk,
@@ -583,7 +583,7 @@ BEGIN_CURSOR_BLOCK
static BCursor CrossCursor = {
/*small*/
cross_sbm, cross_smsk,
- 16, 16,
+ 16, 16,
7, 7,
/*big*/
cross_lbm, cross_lmsk,
@@ -615,7 +615,7 @@ BEGIN_CURSOR_BLOCK
static BCursor EditCrossCursor = {
/*small*/
editcross_sbm, editcross_smsk,
- 16, 16,
+ 16, 16,
9, 8,
/*big*/
NULL, NULL,
@@ -648,7 +648,7 @@ BEGIN_CURSOR_BLOCK
static BCursor BoxSelCursor = {
/*small*/
box_sbm, box_smsk,
- 16, 16,
+ 16, 16,
9, 8,
/*big*/
NULL, NULL,
@@ -720,7 +720,7 @@ BEGIN_CURSOR_BLOCK
static BCursor KnifeCursor = {
/*small*/
knife_sbm, knife_smsk,
- 16, 16,
+ 16, 16,
0, 15,
/*big*/
knife_lbm, knife_lmsk,
@@ -733,7 +733,7 @@ BEGIN_CURSOR_BLOCK
BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
END_CURSOR_BLOCK
-
+
/********************** Loop Select Cursor ***********************/
BEGIN_CURSOR_BLOCK
@@ -796,7 +796,7 @@ BEGIN_CURSOR_BLOCK
static BCursor VLoopCursor = {
/*small*/
vloop_sbm, vloop_smsk,
- 16, 16,
+ 16, 16,
0, 0,
/*big*/
vloop_lbm, vloop_lmsk,
@@ -809,7 +809,7 @@ BEGIN_CURSOR_BLOCK
BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
END_CURSOR_BLOCK
-
+
/********************** TextEdit Cursor ***********************/
BEGIN_CURSOR_BLOCK
@@ -830,7 +830,7 @@ BEGIN_CURSOR_BLOCK
static BCursor TextEditCursor = {
/*small*/
textedit_sbm, textedit_smsk,
- 16, 16,
+ 16, 16,
9, 8,
/*big*/
NULL, NULL,
@@ -869,7 +869,7 @@ BEGIN_CURSOR_BLOCK
static BCursor PaintBrushCursor = {
/*small*/
paintbrush_sbm, paintbrush_smsk,
- 16, 16,
+ 16, 16,
0, 15,
/*big*/
NULL, NULL,
@@ -1042,7 +1042,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 2bacfdb18c0..7a5e3e90166 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -67,29 +67,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;
}
@@ -99,31 +99,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);
@@ -132,7 +132,7 @@ void wm_dropbox_free(void)
}
BLI_freelistN(&dm->dropboxes);
}
-
+
BLI_freelistN(&dropboxes);
}
@@ -143,10 +143,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;
@@ -156,7 +156,7 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
else
drag->poin = poin;
drag->value = value;
-
+
return drag;
}
@@ -209,13 +209,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;
@@ -232,16 +232,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);
@@ -257,7 +257,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);
}
@@ -310,25 +310,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 {
@@ -339,13 +339,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;
@@ -355,7 +355,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);
@@ -364,7 +364,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
glColor4ub(255, 255, 255, 255);
UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag));
}
-
+
/* operator name with roundbox */
if (drag->opname[0]) {
if (drag->imb) {
@@ -385,14 +385,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 a335588c4d5..b9f44a00df7 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -85,7 +85,7 @@
static void wm_paintcursor_draw(bContext *C, ARegion *ar)
{
wmWindowManager *wm = CTX_wm_manager(C);
-
+
if (wm->paintcursors.first) {
wmWindow *win = CTX_wm_window(C);
bScreen *screen = win->screen;
@@ -216,7 +216,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
CTX_wm_region_set(C, NULL);
}
}
-
+
wm_area_mark_invalid_backbuf(sa);
CTX_wm_area_set(C, NULL);
}
@@ -266,7 +266,7 @@ static void wm_flush_regions_down(bScreen *screen, rcti *dirty)
static void wm_flush_regions_up(bScreen *screen, rcti *dirty)
{
ARegion *ar;
-
+
for (ar = screen->regionbase.first; ar; ar = ar->next) {
if (BLI_rcti_isect(dirty, &ar->winrct, NULL)) {
ar->do_draw = RGN_DRAW;
@@ -297,12 +297,12 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
for (ar = sa->regionbase.first; ar; ar = ar->next)
if (ar->swinid && ar->do_draw)
wm_flush_regions_up(screen, &ar->winrct);
-
+
/* flush between overlapping regions */
for (ar = screen->regionbase.last; ar; ar = ar->prev)
if (ar->swinid && ar->do_draw)
wm_flush_regions_up(screen, &ar->winrct);
-
+
/* flush redraws of overlapping regions down to area regions */
for (ar = screen->regionbase.last; ar; ar = ar->prev)
if (ar->swinid && ar->do_draw)
@@ -318,7 +318,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
/* doesnt draw, fills rect with boundbox */
wm_drags_draw(C, win, &rect);
}
-
+
/* draw marked area regions */
for (sa = screen->areabase.first; sa; sa = sa->next) {
CTX_wm_area_set(C, sa);
@@ -391,7 +391,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
if (screen->do_draw_gesture)
wm_gesture_draw(win);
-
+
/* needs pixel coords in screen */
if (wm->drags.first) {
wm_drags_draw(C, win, NULL);
@@ -543,7 +543,7 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
static void wm_draw_region_blend(wmWindow *win, ARegion *ar, wmDrawTriple *triple)
{
float fac = ED_region_blend_factor(ar);
-
+
/* region blend always is 1, except when blend timer is running */
if (fac < 1.0f) {
wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct, true);
@@ -894,7 +894,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)
@@ -905,7 +905,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
return true;
if (screen->do_draw_drag)
return true;
-
+
return false;
}
@@ -954,7 +954,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);
@@ -976,7 +976,7 @@ void wm_draw_update(bContext *C)
bScreen *screen = win->screen;
CTX_wm_window_set(C, win);
-
+
/* sets context window+screen */
wm_window_make_drawable(wm, win);
@@ -1008,7 +1008,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);
@@ -1039,7 +1039,7 @@ void wm_draw_window_clear(wmWindow *win)
for (sa = screen->areabase.first; sa; sa = sa->next)
for (ar = sa->regionbase.first; ar; ar = ar->next)
ar->swap = WIN_NONE_OK;
-
+
screen->swap = WIN_NONE_OK;
}
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index af53da05a6e..7c81f836bc1 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -100,7 +100,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);
@@ -152,7 +152,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);
}
@@ -175,7 +175,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;
}
@@ -190,21 +190,21 @@ 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);
-
+
ar = CTX_wm_region(C);
if (ar)
note->swinid = ar->swinid;
-
+
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;
}
@@ -327,16 +327,16 @@ void wm_event_do_notifiers(bContext *C)
wmWindowManager *wm = CTX_wm_manager(C);
wmNotifier *note, *next;
wmWindow *win;
-
+
if (wm == NULL)
return;
-
+
/* cache & catch WM level notifiers, such as frame change, scene/screen set */
for (win = wm->windows.first; win; win = win->next) {
bool do_anim = false;
-
+
CTX_wm_window_set(C, win);
-
+
for (note = wm->queue.first; note; note = next) {
next = note->next;
@@ -390,11 +390,11 @@ 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) {
-
+
/* filter out notifiers */
if (note->category == NC_SCREEN && note->reference && note->reference != win->screen) {
/* pass */
@@ -415,7 +415,7 @@ void wm_event_do_notifiers(bContext *C)
for (ar = win->screen->regionbase.first; ar; ar = ar->next) {
ED_region_do_listen(win->screen, NULL, ar, note);
}
-
+
for (sa = win->screen->areabase.first; sa; sa = sa->next) {
ED_area_do_listen(win->screen, sa, note);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
@@ -424,10 +424,10 @@ void wm_event_do_notifiers(bContext *C)
}
}
}
-
+
MEM_freeN(note);
}
-
+
wm_event_do_refresh_wm_and_depsgraph(C);
}
@@ -447,8 +447,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) &&
@@ -456,7 +456,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) {
@@ -465,7 +465,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);
@@ -485,14 +485,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;
}
@@ -523,14 +523,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);
@@ -782,15 +782,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++;
@@ -809,13 +809,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);
}
@@ -825,9 +825,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 */
@@ -923,11 +923,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) {
@@ -947,20 +947,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;
@@ -996,11 +996,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;
@@ -1139,7 +1139,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;
}
@@ -1277,7 +1277,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);
@@ -1310,39 +1310,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) {
@@ -1355,12 +1355,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);
-
+
/* set region back */
CTX_wm_region_set(C, ar);
-
+
return retval;
}
case WM_OP_EXEC_AREA:
@@ -1395,7 +1395,7 @@ static int wm_operator_call_internal(
return wm_operator_invoke(C, ot, event, properties, reports, poll_only);
}
}
-
+
return 0;
}
@@ -1471,7 +1471,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;
@@ -1490,13 +1490,13 @@ void wm_event_free_handler(wmEventHandler *handler)
static void wm_handler_op_context(bContext *C, wmEventHandler *handler, const wmEvent *event)
{
bScreen *screen = CTX_wm_screen(C);
-
+
if (screen && handler->op) {
if (handler->op_area == NULL)
CTX_wm_area_set(C, NULL);
else {
ScrArea *sa;
-
+
for (sa = screen->areabase.first; sa; sa = sa->next)
if (sa == handler->op_area)
break;
@@ -1543,7 +1543,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) {
@@ -1551,7 +1551,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)
@@ -1573,7 +1573,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);
@@ -1606,7 +1606,7 @@ int WM_userdef_event_map(int kmitype)
case WHEELINMOUSE:
return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
}
-
+
return kmitype;
}
@@ -1622,13 +1622,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 */
@@ -1643,10 +1643,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;
@@ -1656,12 +1656,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;
}
@@ -1679,12 +1679,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;
}
}
@@ -1737,7 +1737,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;
@@ -1758,14 +1758,14 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
wm_handler_op_context(C, handler, event);
wm_region_mouse_co(C, event);
wm_event_modalkeymap(C, op, event, &dbl_click_disabled);
-
+
if (ot->flag & OPTYPE_UNDO)
wm->op_undo_depth++;
/* 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 */
@@ -1856,10 +1856,10 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
int action = WM_HANDLER_CONTINUE;
switch (val) {
- case EVT_FILESELECT_FULL_OPEN:
+ case EVT_FILESELECT_FULL_OPEN:
{
ScrArea *sa;
-
+
/* sa can be null when window A is active, but mouse is over window B */
/* in this case, open file select in original window A */
if (handler->op_area == NULL) {
@@ -1896,11 +1896,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:
@@ -1988,11 +1988,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);
}
@@ -2004,19 +2004,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);
}
@@ -2077,7 +2077,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 */
@@ -2085,7 +2085,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;
@@ -2148,24 +2148,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;
}
@@ -2186,7 +2186,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) {
@@ -2194,8 +2194,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);
@@ -2216,7 +2216,7 @@ 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;
@@ -2226,16 +2226,16 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
/* 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 && win->eventstate->prevtype == event->type) {
-
+
if ((event->val == KM_RELEASE) &&
(win->eventstate->prevval == KM_PRESS) &&
(win->eventstate->check_click == true))
@@ -2246,7 +2246,7 @@ 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;
@@ -2258,7 +2258,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
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;
@@ -2273,7 +2273,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
win->eventstate->check_click = 0;
}
}
-
+
return action;
}
@@ -2290,7 +2290,7 @@ static ScrArea *area_event_inside(bContext *C, const int xy[2])
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa;
-
+
if (screen)
for (sa = screen->areabase.first; sa; sa = sa->next)
if (BLI_rcti_isect_pt_v(&sa->totrct, xy))
@@ -2303,7 +2303,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))
@@ -2328,22 +2328,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);
}
@@ -2355,7 +2355,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)) {
win->screen->do_draw_drag = true;
}
@@ -2366,29 +2366,29 @@ 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 */
win->screen->do_draw_drag = true;
-
+
/* restore cursor (disabled, see wm_dragdrop.c) */
// WM_cursor_modal_restore(win);
}
-
+
/* overlap fails otherwise */
if (win->screen->do_draw_drag)
if (win->drawmethod == USER_DRAW_OVERLAP)
win->screen->do_draw = true;
-
+
}
/* filter out all events of the pie that spawned the last pie unless it's a release event */
@@ -2420,21 +2420,21 @@ void wm_event_do_handlers(bContext *C)
for (win = wm->windows.first; win; win = win->next) {
wmEvent *event;
-
+
if (win->screen == NULL)
wm_event_free_all(win);
else {
Scene *scene = win->screen->scene;
-
+
if (scene) {
int is_playing_sound = BKE_sound_scene_playing(win->screen->scene);
-
+
if (is_playing_sound != -1) {
bool is_playing_screen;
CTX_wm_window_set(C, win);
CTX_wm_screen_set(C, win->screen);
CTX_data_scene_set(C, scene);
-
+
is_playing_screen = (ED_screen_animation_playing(wm) != NULL);
if (((is_playing_sound == 1) && (is_playing_screen == 0)) ||
@@ -2442,7 +2442,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)) {
@@ -2454,14 +2454,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;
@@ -2493,16 +2493,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;
@@ -2519,14 +2519,14 @@ 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) {
ScrArea *sa;
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 */
@@ -2561,7 +2561,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);
@@ -2572,7 +2572,7 @@ void wm_event_do_handlers(bContext *C)
wm_drags_check_ops(C, event);
}
}
-
+
action |= wm_handlers_do(C, event, &ar->handlers);
/* fileread case (python), [#29489] */
@@ -2596,7 +2596,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));
@@ -2620,9 +2620,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);
@@ -2633,7 +2633,7 @@ void wm_event_do_handlers(bContext *C)
wm_event_add(win, &tevent);
win->addmousemove = 0;
}
-
+
CTX_wm_window_set(C, NULL);
}
@@ -2649,10 +2649,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
@@ -2679,7 +2679,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);
ScrArea *sa;
@@ -2702,16 +2702,16 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
wm_handler_fileselect_do(C, &win->modalhandlers, handler, EVT_FILESELECT_EXTERNAL_CANCEL);
}
}
-
+
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) {
@@ -2733,7 +2733,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 */
@@ -2743,11 +2743,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;
@@ -2766,7 +2766,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;
@@ -2778,20 +2778,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;
@@ -2802,7 +2802,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);
@@ -2834,9 +2834,9 @@ wmEventHandler *WM_event_add_ui_handler(
BLI_assert((flag & WM_HANDLER_DO_FREE) == 0);
handler->flag = flag;
-
+
BLI_addhead(handlers, handler);
-
+
return handler;
}
@@ -2847,7 +2847,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) &&
@@ -2892,13 +2892,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;
}
@@ -2929,7 +2929,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;
}
@@ -2937,7 +2937,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) {
@@ -2966,13 +2966,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));
@@ -3051,7 +3051,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 */
}
@@ -3063,11 +3063,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;
@@ -3093,9 +3093,9 @@ static void wm_eventemulation(wmEvent *event)
emulating_event = EVENT_NONE;
}
}
-
+
}
-
+
/* numpad emulation */
if (U.flag & USER_NONUMPAD) {
switch (event->type) {
@@ -3120,16 +3120,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);
}
@@ -3172,40 +3172,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;
}
}
@@ -3284,7 +3284,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);
@@ -3301,7 +3301,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:
@@ -3325,11 +3325,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;
}
@@ -3338,10 +3338,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)
@@ -3356,9 +3356,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;
@@ -3369,14 +3369,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");
@@ -3387,23 +3387,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 */
@@ -3416,9 +3416,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;
@@ -3426,7 +3426,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';
@@ -3500,19 +3500,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 */
@@ -3520,31 +3520,31 @@ 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;
}
-
+
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 f1cc4539470..bd554c1f9fd 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -146,27 +146,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, win->screen);
}
}
-
+
/* reset active window */
CTX_wm_window_set(C, active_win);
@@ -183,7 +183,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
#if 0
if (wm == NULL) return;
if (G.fileflags & G_FILE_NO_UI) return;
-
+
/* we take apart the used screens from non-active window */
for (win = wm->windows.first; win; win = win->next) {
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
@@ -230,7 +230,7 @@ static void wm_window_match_do(Main *bmain, bContext *C, ListBase *oldwmlist)
{
wmWindowManager *oldwm, *wm;
wmWindow *oldwin, *win;
-
+
/* cases 1 and 2 */
if (BLI_listbase_is_empty(oldwmlist)) {
if (bmain->wm.first) {
@@ -242,7 +242,7 @@ static void wm_window_match_do(Main *bmain, bContext *C, ListBase *oldwmlist)
}
else {
/* cases 3 and 4 */
-
+
/* we've read file without wm..., keep current one entirely alive */
if (BLI_listbase_is_empty(&bmain->wm)) {
bScreen *screen = NULL;
@@ -252,22 +252,22 @@ static void wm_window_match_do(Main *bmain, bContext *C, ListBase *oldwmlist)
/* match oldwm to new dbase, only old files */
for (wm = oldwmlist->first; wm; wm = wm->id.next) {
-
+
for (win = wm->windows.first; win; win = win->next) {
/* all windows get active screen from file */
if (screen->winid == 0)
win->screen = screen;
- else
+ else
win->screen = ED_screen_duplicate(bmain, win, screen);
-
+
BLI_strncpy(win->screenname, win->screen->id.name + 2, sizeof(win->screenname));
win->screen->winid = win->winid;
}
}
}
-
+
bmain->wm = *oldwmlist;
-
+
/* screens were read from file! */
ED_screens_initialize(bmain, bmain->wm.first);
}
@@ -324,7 +324,7 @@ static void wm_init_userdef(Main *bmain, const bool read_userdef_from_memory)
{
/* versioning is here */
UI_init_userdef();
-
+
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
BKE_sound_init(bmain);
@@ -516,7 +516,7 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo
if (addons_loaded) {
wm_file_read_report(C);
}
-
+
if (!G.background) {
if (wm->undo_stack == NULL) {
wm->undo_stack = BKE_undosys_stack_create();
@@ -556,7 +556,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;
@@ -564,8 +564,8 @@ 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);
-
+ wm_window_match_init(C, &wmbase);
+
/* confusing this global... */
G.relbase_valid = 1;
retval = BKE_blendfile_read(C, filepath, reports, 0);
@@ -597,7 +597,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* in case a userdef is read from regular .blend */
wm_init_userdef(bmain, false);
}
-
+
if (retval != BKE_BLENDFILE_READ_FAIL) {
if (do_history) {
wm_history_file_update();
@@ -850,14 +850,14 @@ int wm_homefile_read(
/* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise
* can remove this eventually, only in a 2.53 and older, now its not written */
G.fileflags &= ~G_FILE_RELATIVE_REMAP;
-
+
bmain = CTX_data_main(C);
if (use_userdef) {
/* check userdef before open window, keymaps etc */
wm_init_userdef(bmain, read_userdef_from_memory);
}
-
+
/* match the read WM with current WM */
wm_window_match_do(bmain, C, &wmbase);
WM_check(C); /* opens window(s), checks keymaps */
@@ -912,7 +912,7 @@ void wm_history_file_read(void)
num++;
}
}
-
+
BLI_file_free_lines(lines);
}
@@ -1065,7 +1065,7 @@ static ImBuf *blend_file_thumb(Scene *scene, bScreen *screen, BlendThumbnail **t
/* add pretty overlay */
IMB_thumb_overlay_blend(ibuf->rect, ibuf->x, ibuf->y, aspect);
-
+
thumb = BKE_main_thumbnail_from_imbuf(NULL, ibuf);
}
else {
@@ -1073,10 +1073,10 @@ static ImBuf *blend_file_thumb(Scene *scene, bScreen *screen, BlendThumbnail **t
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;
}
@@ -1111,7 +1111,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 +1121,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,7 +1131,7 @@ 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 = bmain->library.first; li; li = li->id.next) {
if (BLI_path_cmp(li->filepath, filepath) == 0) {
@@ -1159,7 +1159,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
/* don't forget not to return without! */
WM_cursor_wait(1);
-
+
ED_editors_flush_edits(C, false);
fileflags |= G_FILE_HISTORY; /* write file history */
@@ -1172,14 +1172,14 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
/* XXX temp solution to solve bug, real fix coming (ton) */
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(bmain->name, filepath, sizeof(bmain->name)); /* is guaranteed current file */
-
+
G.save_over = 1; /* disable untitled.blend convention */
}
@@ -1265,7 +1265,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 */
@@ -1314,7 +1314,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)) {
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 5f0c905dfd4..5a92a345117 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -335,7 +335,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
if (scene && RNA_boolean_get(op->ptr, "autoselect")) {
BKE_scene_base_deselect_all(scene);
}
-
+
/* tag everything, all untagged data can be made local
* its also generally useful to know what is new
*
@@ -453,7 +453,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
if (scene) {
DAG_scene_relations_rebuild(bmain, scene);
}
-
+
/* free gpu materials, some materials depend on existing objects, such as lamps so freeing correctly refreshes */
GPU_materials_free();
@@ -490,18 +490,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 1a4381a1275..a0a38c5bc3f 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -65,22 +65,22 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
wmWindow *window = CTX_wm_window(C);
ARegion *ar = CTX_wm_region(C);
int sx, sy;
-
+
BLI_addtail(&window->gesture, gesture);
-
+
gesture->type = type;
gesture->event_type = event->type;
gesture->swinid = ar->swinid; /* means only in area-region context! */
gesture->userdata_free = true; /* Free if userdata is set. */
gesture->modal_state = GESTURE_MODAL_NOP;
-
+
wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy);
-
+
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 - sx;
rect->ymin = event->y - sy;
@@ -100,14 +100,14 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
lasso[1] = event->y - sy;
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);
@@ -121,7 +121,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);
}
@@ -145,7 +145,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");
@@ -169,7 +169,7 @@ int wm_gesture_evaluate(wmGesture *gesture)
static void wm_gesture_draw_rect(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
-
+
glEnable(GL_BLEND);
glColor4f(1.0, 1.0, 1.0, 0.05);
glBegin(GL_QUADS);
@@ -179,7 +179,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
glVertex2s(rect->xmin, rect->ymin);
glEnd();
glDisable(GL_BLEND);
-
+
GPU_basic_shader_bind(GPU_SHADER_LINE | GPU_SHADER_STIPPLE | GPU_SHADER_USE_COLOR);
glColor3ub(96, 96, 96);
GPU_basic_shader_line_stipple(1, 0xCCCC);
@@ -193,7 +193,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
static void wm_gesture_draw_line(wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
-
+
GPU_basic_shader_bind(GPU_SHADER_LINE | GPU_SHADER_STIPPLE);
glColor3ub(96, 96, 96);
GPU_basic_shader_line_stipple(1, 0xAAAA);
@@ -203,7 +203,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
sdrawline(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
-
+
}
static void wm_gesture_draw_circle(wmGesture *gt)
@@ -216,7 +216,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
glColor4f(1.0, 1.0, 1.0, 0.05);
glutil_draw_filled_arc(0.0, M_PI * 2.0, rect->xmax, 40);
glDisable(GL_BLEND);
-
+
// for USE_GLSL works bad because of no relation between lines
GPU_basic_shader_bind(GPU_SHADER_LINE | GPU_SHADER_STIPPLE | GPU_SHADER_USE_COLOR);
glColor3ub(96, 96, 96);
@@ -225,10 +225,10 @@ static void wm_gesture_draw_circle(wmGesture *gt)
glColor3ub(255, 255, 255);
GPU_basic_shader_line_stipple(1, 0x5555);
glutil_draw_lined_arc(0.0, M_PI * 2.0, rect->xmax, 40);
-
+
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
glTranslatef(-rect->xmin, -rect->ymin, 0.0f);
-
+
}
struct LassoFillData {
@@ -323,7 +323,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
if (gt->type == WM_GESTURE_LASSO)
glVertex2sv((short *)gt->customdata);
glEnd();
-
+
glColor3ub(255, 255, 255);
GPU_basic_shader_line_stipple(1, 0x5555);
glBegin(GL_LINE_STRIP);
@@ -333,9 +333,9 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
if (gt->type == WM_GESTURE_LASSO)
glVertex2sv((short *)gt->customdata);
glEnd();
-
+
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
-
+
}
static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
@@ -349,7 +349,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
GPU_basic_shader_line_stipple(1, 0xCCCC);
sdrawline(rect->xmin - winsize_x, rect->ymin, rect->xmin + winsize_x, rect->ymin);
sdrawline(rect->xmin, rect->ymin - winsize_y, rect->xmin, rect->ymin + winsize_y);
-
+
glColor3ub(255, 255, 255);
GPU_basic_shader_line_stipple(1, 0x3333);
sdrawline(rect->xmin - winsize_x, rect->ymin, rect->xmin + winsize_x, rect->ymin);
@@ -361,12 +361,12 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
void wm_gesture_draw(wmWindow *win)
{
wmGesture *gt = (wmGesture *)win->gesture.first;
-
+
GPU_basic_shader_line_width(1);
for (; gt; gt = gt->next) {
/* all in subwindow space */
wmSubWindowSet(win, gt->swinid);
-
+
if (gt->type == WM_GESTURE_RECT)
wm_gesture_draw_rect(gt);
// else if (gt->type == WM_GESTURE_TWEAK)
@@ -395,7 +395,7 @@ void wm_gesture_tag_redraw(bContext *C)
wmWindow *win = CTX_wm_window(C);
bScreen *screen = CTX_wm_screen(C);
ARegion *ar = CTX_wm_region(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 dd4a150305d..826c7b03713 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -156,7 +156,7 @@ bool wm_start_with_console = false; /* used in creator.c */
/* 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();
@@ -179,12 +179,12 @@ void WM_init(bContext *C, int argc, const char **argv)
DAG_editors_update_cb(ED_render_id_flush_update,
ED_render_scene_update,
ED_render_scene_update_pre); /* depsgraph.c */
-
+
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
-
+
ED_file_init(); /* for fsmenu */
ED_node_init_butfuncs();
-
+
BLF_init(); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */
BLT_lang_init();
@@ -194,7 +194,7 @@ void WM_init(bContext *C, int argc, const char **argv)
/* get the default database, plus a wm */
wm_homefile_read(C, NULL, G.factory_startup, false, true, NULL, NULL);
-
+
BLT_lang_set(NULL);
@@ -271,7 +271,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 */
@@ -304,7 +304,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);
@@ -407,10 +407,10 @@ bool WM_init_game(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));
}
@@ -493,11 +493,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);
@@ -517,19 +517,19 @@ void WM_exit_ext(bContext *C, const bool do_python)
ED_undosys_type_free();
-// XXX
+// XXX
// BIF_GlobalReebFree();
// BIF_freeRetarget();
BIF_freeTemplates(C);
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)
@@ -539,11 +539,11 @@ 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
-
+
BKE_blender_free(); /* blender.c, does entire library and spacetypes */
// free_matcopybuf();
ANIM_fcurves_copybuf_free();
@@ -561,11 +561,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' */
@@ -600,14 +600,14 @@ 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);
#ifdef WITH_GAMEENGINE
SYS_DeleteSystem(SYS_GetSystem());
#endif
-
+
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 5c663ff2610..a7edcbf73eb 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -236,7 +236,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;
}
@@ -259,7 +259,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);
@@ -314,7 +314,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;
}
@@ -441,16 +441,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);
@@ -463,7 +463,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);
@@ -533,7 +533,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;
}
@@ -544,7 +544,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;
}
@@ -707,7 +707,7 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
/* add to list */
BLI_addtail(lb, km);
-
+
return km;
}
@@ -755,7 +755,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 */
@@ -767,21 +767,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;
}
@@ -814,19 +814,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;
}
@@ -834,10 +834,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);
@@ -1105,7 +1105,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))
@@ -1173,7 +1173,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
}
}
}
-
+
/* ensure un-initialized keymap is never used */
if (r_keymap) *r_keymap = NULL;
return NULL;
@@ -1207,7 +1207,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);
}
@@ -1423,7 +1423,7 @@ static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
{
wmKeyMapItem *kmi;
int update;
-
+
update = (km->flag & KEYMAP_UPDATE);
km->flag &= ~KEYMAP_UPDATE;
@@ -1431,7 +1431,7 @@ static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
update = update || (kmi->flag & KMI_UPDATE);
kmi->flag &= ~KMI_UPDATE;
}
-
+
return (update != 0);
}
@@ -1489,7 +1489,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) {
@@ -1562,7 +1562,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);
@@ -1654,13 +1654,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;
}
@@ -1684,7 +1684,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);
@@ -1711,8 +1711,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);
@@ -1732,11 +1732,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);
@@ -1746,7 +1746,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);
@@ -1774,7 +1774,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);
@@ -1919,7 +1919,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 c0c6b1edcaf..fa3dddb9e30 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -163,7 +163,7 @@ void WM_operatortype_iter(GHashIterator *ghi)
void WM_operatortype_append(void (*opfunc)(wmOperatorType *))
{
wmOperatorType *ot;
-
+
ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties);
/* Set the default i18n context now, so that opfunc can redefine it if needed! */
@@ -238,15 +238,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 */
@@ -259,7 +259,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);
}
@@ -277,7 +277,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 */
@@ -300,7 +300,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()");
}
@@ -375,20 +375,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;
@@ -397,7 +397,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). */
@@ -465,7 +465,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);
@@ -535,7 +535,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);
@@ -1230,7 +1230,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;
}
@@ -1418,7 +1418,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
else {
uiTemplateOperatorPropertyButs(C, layout, op, NULL, 'H', UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
}
-
+
UI_block_bounds_set_popup(block, 4, 0, 0);
return block;
@@ -1484,9 +1484,9 @@ 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, 'H', UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
-
+
/* clear so the OK button is left alone */
UI_block_func_set(block, NULL, NULL, NULL);
@@ -1558,7 +1558,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);
}
@@ -1634,7 +1634,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;
@@ -1658,7 +1658,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;
@@ -1686,11 +1686,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);
}
@@ -1793,7 +1793,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;
@@ -1891,9 +1891,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiDefBut(block, UI_BTYPE_LABEL, 0, branch_buf, U.pixelsize * 494 - branch_width, U.pixelsize * (258 - label_delta), branch_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
}
#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) {
@@ -1902,10 +1902,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);
@@ -1951,21 +1951,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;
}
@@ -1974,7 +1974,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;
}
@@ -1994,26 +1994,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;
}
@@ -2032,7 +2032,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;
}
@@ -2061,7 +2061,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;
@@ -2150,7 +2150,7 @@ static void WM_OT_window_duplicate(wmOperatorType *ot)
ot->name = "Duplicate Window";
ot->idname = "WM_OT_window_duplicate";
ot->description = "Duplicate the current Blender window";
-
+
ot->exec = wm_window_duplicate_exec;
ot->poll = wm_operator_winactive_normal;
}
@@ -2207,7 +2207,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;
}
@@ -2225,20 +2225,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);
@@ -2281,7 +2281,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];
@@ -2448,7 +2448,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
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:
@@ -2606,7 +2606,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);
@@ -2655,7 +2655,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))
@@ -2690,7 +2690,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) {
@@ -2813,7 +2813,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 */
@@ -2854,10 +2854,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);
@@ -3008,9 +3008,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;
@@ -3211,7 +3211,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);
@@ -3221,7 +3221,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;
}
@@ -3255,7 +3255,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;
}
@@ -3277,7 +3277,7 @@ static void WM_OT_dependency_relations(wmOperatorType *ot)
ot->name = "Dependency Relations";
ot->idname = "WM_OT_dependency_relations";
ot->description = "Print dependency graph relations to the console";
-
+
ot->exec = dependency_relations_exec;
}
@@ -3637,21 +3637,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");
@@ -3679,7 +3679,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);
@@ -3691,10 +3691,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");
@@ -3748,7 +3748,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);
@@ -3764,7 +3764,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_duplicate", WKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
#ifdef __APPLE__
@@ -3776,7 +3776,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);
@@ -3849,7 +3849,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 77378cf8e0c..d9d5bf901ca 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -96,7 +96,7 @@ typedef struct PlayState {
/* window and viewport size */
int win_x, win_y;
-
+
/* current zoom level */
float zoom;
@@ -117,7 +117,7 @@ typedef struct PlayState {
bool loading;
/* x/y image flip */
bool draw_flip[2];
-
+
int fstep;
/* current picture */
@@ -129,7 +129,7 @@ typedef struct PlayState {
/* saves passing args */
struct ImBuf *curframe_ibuf;
-
+
/* restarts player for file drop */
char dropped_file[FILE_MAX];
} PlayState;
@@ -312,7 +312,7 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
glClearColor(0.1, 0.1, 0.1, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
-
+
/* checkerboard for case alpha */
if (ibuf->planes == 32) {
glEnable(GL_BLEND);
@@ -330,7 +330,7 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
glDrawPixels(ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
glDisable(GL_BLEND);
-
+
pupdate_time();
if (picture && (g_WS.qual & (WS_QUAL_SHIFT | WS_QUAL_LMOUSE)) && (fontid != -1)) {
@@ -940,13 +940,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) {
@@ -1010,23 +1010,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;
@@ -1043,11 +1043,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;
@@ -1114,7 +1114,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 */
@@ -1262,14 +1262,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);
@@ -1524,7 +1524,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
#endif
/* we still miss freeing a lot!,
* but many areas could skip initialization too for anim play */
-
+
BLF_exit();
GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window);
@@ -1534,7 +1534,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();
DAG_exit();
@@ -1547,7 +1547,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_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 238af7a7c46..0633122b8db 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -67,7 +67,7 @@
typedef struct wmSubWindow {
struct wmSubWindow *next, *prev;
-
+
rcti winrct;
int swinid;
} wmSubWindow;
@@ -84,10 +84,10 @@ static void wm_subwindow_free(wmSubWindow *UNUSED(swin))
void wm_subwindows_free(wmWindow *win)
{
wmSubWindow *swin;
-
+
for (swin = win->subwindows.first; swin; swin = swin->next)
wm_subwindow_free(swin);
-
+
BLI_freelistN(&win->subwindows);
}
@@ -102,7 +102,7 @@ int wm_subwindow_get_id(wmWindow *win)
static wmSubWindow *swin_from_swinid(wmWindow *win, int swinid)
{
wmSubWindow *swin;
-
+
for (swin = win->subwindows.first; swin; swin = swin->next)
if (swin->swinid == swinid)
break;
@@ -198,14 +198,14 @@ int wm_subwindow_open(wmWindow *win, const rcti *winrct, bool activate)
wmSubWindow *swin;
int width, height;
int freewinid = 1;
-
+
for (swin = win->subwindows.first; swin; swin = swin->next)
if (freewinid <= swin->swinid)
freewinid = swin->swinid + 1;
win->curswin = swin = MEM_callocN(sizeof(wmSubWindow), "swinopen");
BLI_addtail(&win->subwindows, swin);
-
+
swin->swinid = freewinid;
swin->winrct = *winrct;
@@ -242,15 +242,15 @@ void wm_subwindow_close(wmWindow *win, int swinid)
void wm_subwindow_position(wmWindow *win, int swinid, const rcti *winrct, bool activate)
{
wmSubWindow *swin = swin_from_swinid(win, swinid);
-
+
if (swin) {
const int winsize_x = WM_window_pixels_x(win);
const int winsize_y = WM_window_pixels_y(win);
int width, height;
-
+
swin->winrct = *winrct;
-
+
/* CRITICAL, this clamping ensures that
* the viewport never goes outside the screen
* edges (assuming the x, y coords aren't
@@ -263,12 +263,12 @@ void wm_subwindow_position(wmWindow *win, int swinid, const rcti *winrct, bool a
* scaling routine, and be damn sure you
* fixed it). - zr (2001!)
*/
-
+
if (swin->winrct.xmax > winsize_x)
swin->winrct.xmax = winsize_x;
if (swin->winrct.ymax > winsize_y)
swin->winrct.ymax = winsize_y;
-
+
if (activate) {
/* extra service */
wmSubWindowSet(win, swinid);
@@ -292,19 +292,19 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, const rcti *srct, bool src
{
int width, height;
_curswin = swin_from_swinid(win, swinid);
-
+
if (_curswin == NULL) {
printf("%s %d: doesn't exist\n", __func__, swinid);
return;
}
-
+
win->curswin = _curswin;
_curwindow = win;
-
+
width = BLI_rcti_size_x(&_curswin->winrct) + 1;
height = BLI_rcti_size_y(&_curswin->winrct) + 1;
glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
-
+
if (srct) {
int scissor_width = BLI_rcti_size_x(srct);
int scissor_height = BLI_rcti_size_y(srct);
@@ -320,10 +320,10 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, const rcti *srct, bool src
}
else
glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
-
+
wmOrtho2_pixelspace(width, height);
glLoadIdentity();
-
+
glFlush();
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index b28f845caf5..de3c48ceaa4 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"
@@ -101,7 +101,7 @@ static struct WMInitStruct {
int windowstate;
WinOverrideFlag override_flag;
-
+
bool native_pixels;
} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true};
@@ -113,7 +113,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;
@@ -135,9 +135,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;
@@ -156,13 +156,13 @@ 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;
}
-static void wm_ghostwindow_destroy(wmWindow *win)
+static void wm_ghostwindow_destroy(wmWindow *win)
{
if (win->ghostwin) {
GHOST_DisposeWindow(g_system, win->ghostwin);
@@ -171,12 +171,12 @@ static void wm_ghostwindow_destroy(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);
@@ -197,7 +197,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;
@@ -206,7 +206,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
}
if (win->eventstate) MEM_freeN(win->eventstate);
-
+
wm_event_free_all(win);
wm_subwindows_free(win);
@@ -223,11 +223,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;
}
@@ -236,7 +236,7 @@ wmWindow *wm_window_new(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = MEM_callocN(sizeof(wmWindow), "window");
-
+
BLI_addtail(&wm->windows, win);
win->winid = find_free_winid(wm);
@@ -251,12 +251,12 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *win_src)
{
Main *bmain = CTX_data_main(C);
wmWindow *win_dst = wm_window_new(C);
-
+
win_dst->posx = win_src->posx + 10;
win_dst->posy = win_src->posy;
win_dst->sizex = win_src->sizex;
win_dst->sizey = win_src->sizey;
-
+
/* duplicate assigns to window */
win_dst->screen = ED_screen_duplicate(bmain, win_dst, win_src->screen);
BLI_strncpy(win_dst->screenname, win_dst->screen->id.name + 2, sizeof(win_dst->screenname));
@@ -450,7 +450,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)
@@ -465,11 +465,11 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
else {
/* We're just closing a window */
bScreen *screen = win->screen;
-
+
BLI_remlink(&wm->windows, win);
-
+
wm_draw_window_clear(win);
-
+
CTX_wm_window_set(C, win); /* needed by handlers */
WM_event_remove_handlers(C, &win->handlers);
WM_event_remove_handlers(C, &win->modalhandlers);
@@ -479,15 +479,15 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
if (win->screen) {
ED_screen_exit(C, win, win->screen);
}
-
+
wm_window_free(C, wm, win);
-
+
/* if temp screen, delete it after window free (it stops jobs that can access it) */
if (screen && screen->temp) {
Main *bmain = CTX_data_main(C);
BKE_libblock_free(bmain, screen);
}
- }
+ }
}
void wm_window_title(wmWindowManager *wm, wmWindow *win)
@@ -512,7 +512,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);
-
+
}
}
@@ -568,8 +568,8 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
GHOST_GLSettings glSettings = {0};
static int multisamples = -1;
int scr_w, scr_h, posy;
-
- /* force setting multisamples only once, it requires restart - and you cannot
+
+ /* force setting multisamples only once, it requires restart - and you cannot
* mix it, either all windows have it, or none (tested in OSX opengl) */
if (multisamples == -1)
multisamples = U.ogl_multisamples;
@@ -586,31 +586,31 @@ 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,
GHOST_kDrawingContextTypeOpenGL,
glSettings);
-
+
if (ghostwin) {
GHOST_RectangleHandle bounds;
-
+
/* 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 */
-
+
if (win->eventstate == NULL)
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
/* store multisamples window was created with, in case user prefs change */
win->multisamples = multisamples;
-
+
/* store actual window size in blender window */
bounds = GHOST_GetClientBounds(win->ghostwin);
@@ -620,7 +620,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);
@@ -631,14 +631,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 */
glEnable(GL_SCISSOR_TEST);
GPU_state_init();
@@ -662,7 +662,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
{
wmKeyMap *keymap;
wmWindow *win;
-
+
BLI_assert(G.background == false);
/* no commandline prefsize? then we set this.
@@ -671,7 +671,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 */
@@ -689,7 +689,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)) {
@@ -721,13 +721,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);
@@ -765,7 +765,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);
@@ -817,16 +817,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 (win->screen->temp)
break;
-
+
/* add new window? */
if (win == NULL) {
win = wm_window_new(C);
-
+
win->posx = rect.xmin;
win->posy = rect.ymin;
}
@@ -838,7 +838,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
wm_window_set_size(win, win->sizex, win->sizey);
wm_window_raise(win);
}
-
+
if (win->screen == NULL) {
/* add new screen */
win->screen = ED_screen_add(bmain, win, scene, "temp");
@@ -849,8 +849,8 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
ED_screen_set_scene(C, win->screen, scene);
}
- win->screen->temp = 1;
-
+ win->screen->temp = 1;
+
/* make window active, and validate/resize */
CTX_wm_window_set(C, win);
WM_check(C);
@@ -864,17 +864,17 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
/* ensure it shows the right spacetype editor */
sa = win->screen->areabase.first;
CTX_wm_area_set(C, sa);
-
+
if (type == WM_WINDOW_RENDER) {
ED_area_newspace(C, sa, SPACE_IMAGE, false);
}
else {
ED_area_newspace(C, sa, SPACE_USERPREF, false);
}
-
+
ED_screen_set(C, win->screen);
ED_screen_refresh(CTX_wm_manager(C), win); /* test scale */
-
+
if (sa->spacetype == SPACE_IMAGE)
title = IFACE_("Blender Render");
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
@@ -936,7 +936,7 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
return OPERATOR_FINISHED;
-
+
}
@@ -945,10 +945,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;
}
@@ -978,11 +978,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;
@@ -1001,25 +1001,25 @@ 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)
{
if (win != wm->windrawable && win->ghostwin) {
// win->lmbut = 0; /* keeps hanging when mousepressed while other window opened */
-
+
wm->windrawable = win;
if (G.debug & G_DEBUG_EVENTS) {
printf("%s: set drawable %d\n", __func__, win->winid);
}
GHOST_ActivateWindowDrawingContext(win->ghostwin);
-
+
/* this can change per window */
WM_window_set_dpi(win);
}
@@ -1033,7 +1033,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);
}
@@ -1041,7 +1041,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_INIT_WINDOW) == 0) {
@@ -1062,12 +1062,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;
@@ -1076,7 +1076,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;
@@ -1092,10 +1092,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...
@@ -1164,15 +1164,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
@@ -1203,7 +1203,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);
@@ -1222,18 +1222,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;
@@ -1244,8 +1244,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 ||
@@ -1286,12 +1286,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);
wm_draw_window_clear(win);
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);
@@ -1322,19 +1322,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;
@@ -1344,53 +1344,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:
@@ -1419,7 +1419,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;
@@ -1427,7 +1427,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;
@@ -1455,7 +1455,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;
@@ -1476,7 +1476,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;
@@ -1492,7 +1492,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;
@@ -1502,7 +1502,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 */
@@ -1510,7 +1510,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);
@@ -1529,10 +1529,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;
}
}
@@ -1543,10 +1543,10 @@ void wm_ghost_init(bContext *C)
{
if (!g_system) {
GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
-
+
g_system = GHOST_CreateSystem();
GHOST_AddEventConsumer(g_system, consumer);
-
+
if (wm_init_state.native_pixels) {
GHOST_UseNativePixels();
}
@@ -1567,7 +1567,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;
@@ -1586,9 +1586,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;
}
@@ -1613,23 +1613,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;
@@ -1666,7 +1666,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__);
@@ -1692,7 +1692,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;
@@ -1724,16 +1724,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';
@@ -1743,7 +1743,7 @@ void WM_clipboard_text_set(const char *buf, bool selection)
}
}
*p2 = '\0';
-
+
GHOST_putClipboard((GHOST_TInt8 *)newbuf, selection);
MEM_freeN(newbuf);
#else
@@ -1772,24 +1772,24 @@ 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)
{
-
+
#ifdef WIN32
glDisable(GL_SCISSOR_TEST);
GHOST_SwapWindowBuffers(win->ghostwin);
@@ -1890,16 +1890,16 @@ float WM_cursor_pressure(const struct wmWindow *win)
int WM_window_pixels_x(wmWindow *win)
{
float f = GHOST_GetNativePixelSize(win->ghostwin);
-
+
return (int)(f * (float)win->sizex);
}
int WM_window_pixels_y(wmWindow *win)
{
float f = GHOST_GetNativePixelSize(win->ghostwin);
-
+
return (int)(f * (float)win->sizey);
-
+
}
bool WM_window_is_fullscreen(wmWindow *win)
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 3b834c600e7..42b1b2a5fb4 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -38,7 +38,7 @@ typedef struct wmPaintCursor {
struct wmPaintCursor *next, *prev;
void *customdata;
-
+
int (*poll)(struct bContext *C);
void (*draw)(bContext *C, int, int, void *customdata);
} wmPaintCursor;
@@ -51,7 +51,7 @@ extern void wm_close_and_free_all(bContext *C, ListBase *);
extern void wm_add_default(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 c43aee86d36..460ff1a1b8d 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,