Merge branch 'master' into blender2.8
This commit is contained in:
commit
f0815b1322
|
@ -142,7 +142,7 @@ enum {
|
|||
struct wmWindow *WM_window_open(struct bContext *C, const struct rcti *rect);
|
||||
struct wmWindow *WM_window_open_temp(struct bContext *C, int x, int y, int sizex, int sizey, int type);
|
||||
void WM_window_set_dpi(wmWindow *win);
|
||||
|
||||
|
||||
bool WM_stereo3d_enabled(struct wmWindow *win, bool only_fullscreen_test);
|
||||
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ void WM_keyconfig_update_operatortype(void);
|
|||
void WM_keymap_init (struct bContext *C);
|
||||
void WM_keymap_free (struct wmKeyMap *keymap);
|
||||
|
||||
wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, const char *idname, int type,
|
||||
wmKeyMapItem *WM_keymap_verify_item(struct wmKeyMap *keymap, const char *idname, int type,
|
||||
int val, int modifier, int keymodifier);
|
||||
wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, int type,
|
||||
wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, const char *idname, int type,
|
||||
int val, int modifier, int keymodifier);
|
||||
wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, int type,
|
||||
int val, int modifier, int keymodifier);
|
||||
|
@ -79,7 +79,7 @@ wmKeyMap *WM_keymap_active(struct wmWindowManager *wm, struct wmKeyMap *keymap);
|
|||
wmKeyMap *WM_keymap_guess_opname(const struct bContext *C, const char *opname);
|
||||
bool WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap);
|
||||
bool WM_keymap_poll(struct bContext *C, struct wmKeyMap *keymap);
|
||||
|
||||
|
||||
wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id);
|
||||
int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
|
||||
|
||||
|
|
|
@ -211,14 +211,14 @@ typedef enum eOperatorPropTags {
|
|||
|
||||
typedef struct wmNotifier {
|
||||
struct wmNotifier *next, *prev;
|
||||
|
||||
|
||||
struct wmWindowManager *wm;
|
||||
struct wmWindow *window;
|
||||
|
||||
|
||||
unsigned int category, data, subtype, action;
|
||||
|
||||
|
||||
void *reference;
|
||||
|
||||
|
||||
} wmNotifier;
|
||||
|
||||
|
||||
|
@ -335,7 +335,7 @@ typedef struct wmNotifier {
|
|||
/* NC_TEXT Text */
|
||||
#define ND_CURSOR (50<<16)
|
||||
#define ND_DISPLAY (51<<16)
|
||||
|
||||
|
||||
/* NC_ANIMATION Animato */
|
||||
#define ND_KEYFRAME (70<<16)
|
||||
#define ND_KEYFRAME_PROP (71<<16)
|
||||
|
@ -433,7 +433,7 @@ typedef struct wmGesture {
|
|||
uint is_active : 1;
|
||||
/* Use for gestures that support both immediate or delayed activation. */
|
||||
uint wait_for_input : 1;
|
||||
|
||||
|
||||
void *customdata;
|
||||
/* customdata for border is a recti */
|
||||
/* customdata for circle is recti, (xmin, ymin) is center, xmax radius */
|
||||
|
@ -451,7 +451,7 @@ typedef struct wmGesture {
|
|||
/* event comes from eventmanager and from keymap */
|
||||
typedef struct wmEvent {
|
||||
struct wmEvent *next, *prev;
|
||||
|
||||
|
||||
short type; /* event code itself (short, is also in keymap) */
|
||||
short val; /* press, release, scrollvalue */
|
||||
int x, y; /* mouse pointer position, screen coord */
|
||||
|
@ -468,11 +468,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;
|
||||
|
@ -488,7 +488,7 @@ typedef struct wmEvent {
|
|||
short customdatafree;
|
||||
int pad2;
|
||||
void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */
|
||||
|
||||
|
||||
} wmEvent;
|
||||
|
||||
/* ************** custom wmEvent data ************** */
|
||||
|
@ -527,17 +527,17 @@ typedef enum { /* Timer flags */
|
|||
|
||||
typedef struct wmTimer {
|
||||
struct wmTimer *next, *prev;
|
||||
|
||||
|
||||
struct wmWindow *win; /* window this timer is attached to (optional) */
|
||||
|
||||
double timestep; /* set by timer user */
|
||||
int event_type; /* set by timer user, goes to event system */
|
||||
wmTimerFlags flags; /* Various flags controlling timer options, see below. */
|
||||
void *customdata; /* set by timer user, to allow custom values */
|
||||
|
||||
|
||||
double duration; /* total running time in seconds */
|
||||
double delta; /* time since previous step in seconds */
|
||||
|
||||
|
||||
double ltime; /* internal, last time timer was activated */
|
||||
double ntime; /* internal, next time we want to activate the timer */
|
||||
double stime; /* internal, when the timer started */
|
||||
|
@ -653,16 +653,16 @@ typedef enum wmDragFlags {
|
|||
|
||||
typedef struct wmDrag {
|
||||
struct wmDrag *next, *prev;
|
||||
|
||||
|
||||
int icon, type; /* type, see WM_DRAG defines above */
|
||||
void *poin;
|
||||
char path[1024]; /* FILE_MAX */
|
||||
double value;
|
||||
|
||||
|
||||
struct ImBuf *imb; /* if no icon but imbuf should be drawn around cursor */
|
||||
float scale;
|
||||
int sx, sy;
|
||||
|
||||
|
||||
char opname[200]; /* if set, draws operator name*/
|
||||
unsigned int flags;
|
||||
} wmDrag;
|
||||
|
@ -671,13 +671,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 */
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ void WM_operator_free(wmOperator *op)
|
|||
WM_operator_free(opm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MEM_freeN(op);
|
||||
}
|
||||
|
||||
|
@ -192,11 +192,11 @@ void wm_operator_register(bContext *C, wmOperator *op)
|
|||
void WM_operator_stack_clear(wmWindowManager *wm)
|
||||
{
|
||||
wmOperator *op;
|
||||
|
||||
|
||||
while ((op = BLI_pophead(&wm->operators))) {
|
||||
WM_operator_free(op);
|
||||
}
|
||||
|
||||
|
||||
WM_main_add_notifier(NC_WM | ND_HISTORY, NULL);
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ void WM_keymap_init(bContext *C)
|
|||
wm->addonconf = WM_keyconfig_new(wm, "Blender Addon");
|
||||
if (!wm->userconf)
|
||||
wm->userconf = WM_keyconfig_new(wm, "Blender User");
|
||||
|
||||
|
||||
/* initialize only after python init is done, for keymaps that
|
||||
* use python operators */
|
||||
if (CTX_py_init_get(C) && (wm->initialized & WM_KEYMAP_IS_INITIALIZED) == 0) {
|
||||
|
@ -396,7 +396,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;
|
||||
|
@ -434,7 +434,7 @@ void wm_clear_default_size(bContext *C)
|
|||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmWindow *win;
|
||||
|
||||
|
||||
/* wm context */
|
||||
if (wm == NULL) {
|
||||
wm = CTX_data_main(C)->wm.first;
|
||||
|
@ -444,7 +444,7 @@ void wm_clear_default_size(bContext *C)
|
|||
if (wm == NULL || BLI_listbase_is_empty(&wm->windows)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
win->sizex = 0;
|
||||
win->sizey = 0;
|
||||
|
@ -490,7 +490,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
|||
WM_window_set_active_workspace(win, NULL); /* prevent draw clear to use screen */
|
||||
wm_window_free(C, wm, win);
|
||||
}
|
||||
|
||||
|
||||
while ((op = BLI_pophead(&wm->operators))) {
|
||||
WM_operator_free(op);
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
|||
BLI_freelistN(&wm->paintcursors);
|
||||
|
||||
WM_drag_free_list(&wm->drags);
|
||||
|
||||
|
||||
wm_reports_free(wm);
|
||||
|
||||
if (wm->undo_stack) {
|
||||
|
@ -538,16 +538,16 @@ void WM_main(bContext *C)
|
|||
wm_event_do_refresh_wm_and_depsgraph(C);
|
||||
|
||||
while (1) {
|
||||
|
||||
|
||||
/* get events from ghost, handle window events, add to window queues */
|
||||
wm_window_process_events(C);
|
||||
|
||||
wm_window_process_events(C);
|
||||
|
||||
/* per window, all events to the window, screen, area and region handlers */
|
||||
wm_event_do_handlers(C);
|
||||
|
||||
|
||||
/* events have left notes about changes, we handle and cache it */
|
||||
wm_event_do_notifiers(C);
|
||||
|
||||
|
||||
/* execute cached changes draw */
|
||||
wm_draw_update(C);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "BLI_sys_types.h"
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
@ -58,7 +58,7 @@
|
|||
|
||||
|
||||
/* Some simple ghost <-> blender conversions */
|
||||
static GHOST_TStandardCursor convert_cursor(int curs)
|
||||
static GHOST_TStandardCursor convert_cursor(int curs)
|
||||
{
|
||||
switch (curs) {
|
||||
default:
|
||||
|
@ -79,23 +79,23 @@ static GHOST_TStandardCursor convert_cursor(int curs)
|
|||
}
|
||||
}
|
||||
|
||||
static void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2],
|
||||
static void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2],
|
||||
unsigned char bitmap[16][2], int hotx, int hoty)
|
||||
{
|
||||
GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
|
||||
}
|
||||
|
||||
static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
|
||||
static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
|
||||
{
|
||||
if (useBig) {
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
(GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask,
|
||||
cursor->big_sizex, cursor->big_sizey,
|
||||
cursor->big_hotx, cursor->big_hoty,
|
||||
cursor->fg_color, cursor->bg_color);
|
||||
}
|
||||
else {
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
(GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
|
||||
cursor->small_sizex, cursor->small_sizey,
|
||||
cursor->small_hotx, cursor->small_hoty,
|
||||
|
@ -132,12 +132,12 @@ void WM_cursor_set(wmWindow *win, int curs)
|
|||
#endif
|
||||
|
||||
GHOST_SetCursorVisibility(win->ghostwin, 1);
|
||||
|
||||
|
||||
if (curs == CURSOR_STD && win->modalcursor)
|
||||
curs = win->modalcursor;
|
||||
|
||||
|
||||
win->cursor = curs;
|
||||
|
||||
|
||||
/* detect if we use system cursor or Blender cursor */
|
||||
if (curs >= BC_GHOST_CURSORS) {
|
||||
GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
|
||||
|
@ -196,7 +196,7 @@ void WM_cursor_wait(bool val)
|
|||
if (!G.background) {
|
||||
wmWindowManager *wm = G.main->wm.first;
|
||||
wmWindow *win = wm ? wm->windows.first : NULL;
|
||||
|
||||
|
||||
for (; win; win = win->next) {
|
||||
if (val) {
|
||||
WM_cursor_modal_set(win, BC_WAITCURSOR);
|
||||
|
@ -214,7 +214,7 @@ void WM_cursor_wait(bool val)
|
|||
void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4])
|
||||
{
|
||||
/* Only grab cursor when not running debug.
|
||||
* It helps not to get a stuck WM when hitting a breakpoint
|
||||
* It helps not to get a stuck WM when hitting a breakpoint
|
||||
* */
|
||||
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
|
||||
|
||||
|
@ -222,7 +222,7 @@ void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4])
|
|||
wm_cursor_position_to_ghost(win, &bounds[0], &bounds[1]);
|
||||
wm_cursor_position_to_ghost(win, &bounds[2], &bounds[3]);
|
||||
}
|
||||
|
||||
|
||||
if (hide) {
|
||||
mode = GHOST_kGrabHide;
|
||||
}
|
||||
|
@ -311,12 +311,12 @@ void WM_cursor_time(wmWindow *win, int nr)
|
|||
unsigned char mask[16][2];
|
||||
unsigned char bitmap[16][2] = {{0}};
|
||||
int i, idx;
|
||||
|
||||
|
||||
if (win->lastcursor == 0)
|
||||
win->lastcursor = win->cursor;
|
||||
|
||||
|
||||
memset(&mask, 0xFF, sizeof(mask));
|
||||
|
||||
|
||||
/* print number bottom right justified */
|
||||
for (idx = 3; nr && idx >= 0; idx--) {
|
||||
const char *digit = number_bitmaps[nr % 10];
|
||||
|
@ -327,7 +327,7 @@ void WM_cursor_time(wmWindow *win, int nr)
|
|||
bitmap[i + y * 8][x] = digit[i];
|
||||
nr /= 10;
|
||||
}
|
||||
|
||||
|
||||
window_set_custom_cursor(win, mask, bitmap, 7, 7);
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ BEGIN_CURSOR_BLOCK
|
|||
};
|
||||
|
||||
BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
|
||||
|
||||
|
||||
END_CURSOR_BLOCK
|
||||
/********************** EW_ARROW Cursor *************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
|
@ -462,7 +462,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor EWArrowCursor = {
|
||||
/*small*/
|
||||
ew_sbm, ew_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
7, 6,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
|
@ -532,7 +532,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor WaitCursor = {
|
||||
/*small*/
|
||||
wait_sbm, wait_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
7, 7,
|
||||
/*big*/
|
||||
wait_lbm, wait_lmsk,
|
||||
|
@ -601,7 +601,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor CrossCursor = {
|
||||
/*small*/
|
||||
cross_sbm, cross_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
7, 7,
|
||||
/*big*/
|
||||
cross_lbm, cross_lmsk,
|
||||
|
@ -633,7 +633,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor EditCrossCursor = {
|
||||
/*small*/
|
||||
editcross_sbm, editcross_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
9, 8,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
|
@ -666,7 +666,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor BoxSelCursor = {
|
||||
/*small*/
|
||||
box_sbm, box_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
9, 8,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
|
@ -738,7 +738,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor KnifeCursor = {
|
||||
/*small*/
|
||||
knife_sbm, knife_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
0, 15,
|
||||
/*big*/
|
||||
knife_lbm, knife_lmsk,
|
||||
|
@ -751,7 +751,7 @@ BEGIN_CURSOR_BLOCK
|
|||
BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
|
||||
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
|
||||
/********************** Loop Select Cursor ***********************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
|
||||
|
@ -814,7 +814,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor VLoopCursor = {
|
||||
/*small*/
|
||||
vloop_sbm, vloop_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
0, 0,
|
||||
/*big*/
|
||||
vloop_lbm, vloop_lmsk,
|
||||
|
@ -827,7 +827,7 @@ BEGIN_CURSOR_BLOCK
|
|||
BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
|
||||
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
|
||||
|
||||
/********************** TextEdit Cursor ***********************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
|
@ -848,7 +848,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor TextEditCursor = {
|
||||
/*small*/
|
||||
textedit_sbm, textedit_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
9, 8,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
|
@ -887,7 +887,7 @@ BEGIN_CURSOR_BLOCK
|
|||
static BCursor PaintBrushCursor = {
|
||||
/*small*/
|
||||
paintbrush_sbm, paintbrush_smsk,
|
||||
16, 16,
|
||||
16, 16,
|
||||
0, 15,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
|
@ -1060,7 +1060,7 @@ BEGIN_CURSOR_BLOCK
|
|||
0x7e, 0x00, 0x3f, 0x00, 0x0c, 0x00, 0x04, 0x00,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static BCursor EyedropperCursor = {
|
||||
/*small*/
|
||||
eyedropper_sbm, eyedropper_smsk,
|
||||
|
|
|
@ -69,29 +69,29 @@ static ListBase dropboxes = {NULL, NULL};
|
|||
|
||||
typedef struct wmDropBoxMap {
|
||||
struct wmDropBoxMap *next, *prev;
|
||||
|
||||
|
||||
ListBase dropboxes;
|
||||
short spaceid, regionid;
|
||||
char idname[KMAP_MAX_NAME];
|
||||
|
||||
|
||||
} wmDropBoxMap;
|
||||
|
||||
/* spaceid/regionid is zero for window drop maps */
|
||||
ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
|
||||
{
|
||||
wmDropBoxMap *dm;
|
||||
|
||||
|
||||
for (dm = dropboxes.first; dm; dm = dm->next)
|
||||
if (dm->spaceid == spaceid && dm->regionid == regionid)
|
||||
if (STREQLEN(idname, dm->idname, KMAP_MAX_NAME))
|
||||
return &dm->dropboxes;
|
||||
|
||||
|
||||
dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
|
||||
BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
|
||||
dm->spaceid = spaceid;
|
||||
dm->regionid = regionid;
|
||||
BLI_addtail(&dropboxes, dm);
|
||||
|
||||
|
||||
return &dm->dropboxes;
|
||||
}
|
||||
|
||||
|
@ -101,31 +101,31 @@ wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext
|
|||
void (*copy)(wmDrag *, wmDropBox *))
|
||||
{
|
||||
wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
|
||||
|
||||
|
||||
drop->poll = poll;
|
||||
drop->copy = copy;
|
||||
drop->ot = WM_operatortype_find(idname, 0);
|
||||
drop->opcontext = WM_OP_INVOKE_DEFAULT;
|
||||
|
||||
|
||||
if (drop->ot == NULL) {
|
||||
MEM_freeN(drop);
|
||||
printf("Error: dropbox with unknown operator: %s\n", idname);
|
||||
return NULL;
|
||||
}
|
||||
WM_operator_properties_alloc(&(drop->ptr), &(drop->properties), idname);
|
||||
|
||||
|
||||
BLI_addtail(lb, drop);
|
||||
|
||||
|
||||
return drop;
|
||||
}
|
||||
|
||||
void wm_dropbox_free(void)
|
||||
{
|
||||
wmDropBoxMap *dm;
|
||||
|
||||
|
||||
for (dm = dropboxes.first; dm; dm = dm->next) {
|
||||
wmDropBox *drop;
|
||||
|
||||
|
||||
for (drop = dm->dropboxes.first; drop; drop = drop->next) {
|
||||
if (drop->ptr) {
|
||||
WM_operator_properties_free(drop->ptr);
|
||||
|
@ -134,7 +134,7 @@ void wm_dropbox_free(void)
|
|||
}
|
||||
BLI_freelistN(&dm->dropboxes);
|
||||
}
|
||||
|
||||
|
||||
BLI_freelistN(&dropboxes);
|
||||
}
|
||||
|
||||
|
@ -145,10 +145,10 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
|
|||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmDrag *drag = MEM_callocN(sizeof(struct wmDrag), "new drag");
|
||||
|
||||
|
||||
/* keep track of future multitouch drag too, add a mousepointer id or so */
|
||||
/* if multiple drags are added, they're drawn as list */
|
||||
|
||||
|
||||
BLI_addtail(&wm->drags, drag);
|
||||
drag->flags = flags;
|
||||
drag->icon = icon;
|
||||
|
@ -158,7 +158,7 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
|
|||
else
|
||||
drag->poin = poin;
|
||||
drag->value = value;
|
||||
|
||||
|
||||
return drag;
|
||||
}
|
||||
|
||||
|
@ -211,13 +211,13 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
|
|||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
const char *name;
|
||||
|
||||
|
||||
name = dropbox_active(C, &win->handlers, drag, event);
|
||||
if (name) return name;
|
||||
|
||||
|
||||
name = dropbox_active(C, &sa->handlers, drag, event);
|
||||
if (name) return name;
|
||||
|
||||
|
||||
name = dropbox_active(C, &ar->handlers, drag, event);
|
||||
if (name) return name;
|
||||
|
||||
|
@ -234,16 +234,16 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *e
|
|||
/* for multiwin drags, we only do this if mouse inside */
|
||||
if (event->x < 0 || event->y < 0 || event->x > winsize_x || event->y > winsize_y)
|
||||
return;
|
||||
|
||||
|
||||
drag->opname[0] = 0;
|
||||
|
||||
|
||||
/* check buttons (XXX todo rna and value) */
|
||||
if (UI_but_active_drop_name(C)) {
|
||||
BLI_strncpy(drag->opname, IFACE_("Paste name"), sizeof(drag->opname));
|
||||
}
|
||||
else {
|
||||
const char *opname = wm_dropbox_active(C, drag, event);
|
||||
|
||||
|
||||
if (opname) {
|
||||
BLI_strncpy(drag->opname, opname, sizeof(drag->opname));
|
||||
// WM_cursor_modal_set(win, CURSOR_COPY);
|
||||
|
@ -259,7 +259,7 @@ void wm_drags_check_ops(bContext *C, const wmEvent *event)
|
|||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmDrag *drag;
|
||||
|
||||
|
||||
for (drag = wm->drags.first; drag; drag = drag->next) {
|
||||
wm_drop_operator_options(C, drag, event);
|
||||
}
|
||||
|
@ -312,25 +312,25 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
|||
wmDrag *drag;
|
||||
const int winsize_y = WM_window_pixels_y(win);
|
||||
int cursorx, cursory, x, y;
|
||||
|
||||
|
||||
cursorx = win->eventstate->x;
|
||||
cursory = win->eventstate->y;
|
||||
if (rect) {
|
||||
rect->xmin = rect->xmax = cursorx;
|
||||
rect->ymin = rect->ymax = cursory;
|
||||
}
|
||||
|
||||
|
||||
/* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */
|
||||
glEnable(GL_BLEND);
|
||||
for (drag = wm->drags.first; drag; drag = drag->next) {
|
||||
int iconsize = UI_DPI_ICON_SIZE;
|
||||
int padding = 4 * UI_DPI_FAC;
|
||||
|
||||
|
||||
/* image or icon */
|
||||
if (drag->imb) {
|
||||
x = cursorx - drag->sx / 2;
|
||||
y = cursory - drag->sy / 2;
|
||||
|
||||
|
||||
if (rect)
|
||||
drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy);
|
||||
else {
|
||||
|
@ -343,13 +343,13 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
|||
else {
|
||||
x = cursorx - 2 * padding;
|
||||
y = cursory - 2 * UI_DPI_FAC;
|
||||
|
||||
|
||||
if (rect)
|
||||
drag_rect_minmax(rect, x, y, x + iconsize, y + iconsize);
|
||||
else
|
||||
UI_icon_draw_aspect(x, y, drag->icon, 1.0f / UI_DPI_FAC, 0.8);
|
||||
}
|
||||
|
||||
|
||||
/* item name */
|
||||
if (drag->imb) {
|
||||
x = cursorx - drag->sx / 2;
|
||||
|
@ -359,7 +359,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
|||
x = cursorx + 10 * UI_DPI_FAC;
|
||||
y = cursory + 1 * UI_DPI_FAC;
|
||||
}
|
||||
|
||||
|
||||
if (rect) {
|
||||
int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
|
||||
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
|
||||
|
@ -368,7 +368,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
|||
const unsigned char col[] = {255, 255, 255, 255};
|
||||
UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), col);
|
||||
}
|
||||
|
||||
|
||||
/* operator name with roundbox */
|
||||
if (drag->opname[0]) {
|
||||
if (drag->imb) {
|
||||
|
@ -389,14 +389,14 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
|
|||
y = (cursory - iconsize) - padding;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (rect) {
|
||||
int w = UI_fontstyle_string_width(fstyle, wm_drag_name(drag));
|
||||
drag_rect_minmax(rect, x, y, x + w, y + iconsize);
|
||||
}
|
||||
else
|
||||
else
|
||||
wm_drop_operator_draw(drag->opname, x, y);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
|
|
|
@ -755,7 +755,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
|
|||
|
||||
if (do_draw)
|
||||
return true;
|
||||
|
||||
|
||||
if (screen->do_refresh)
|
||||
return true;
|
||||
if (screen->do_draw)
|
||||
|
@ -766,7 +766,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
|
|||
return true;
|
||||
if (screen->do_draw_drag)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ void wm_draw_update(bContext *C)
|
|||
#endif
|
||||
|
||||
GPU_free_unused_buffers();
|
||||
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
#ifdef WIN32
|
||||
GHOST_TWindowState state = GHOST_GetWindowState(win->ghostwin);
|
||||
|
@ -806,7 +806,7 @@ void wm_draw_update(bContext *C)
|
|||
bScreen *screen = WM_window_get_active_screen(win);
|
||||
|
||||
CTX_wm_window_set(C, win);
|
||||
|
||||
|
||||
/* sets context window+screen */
|
||||
wm_window_make_drawable(wm, win);
|
||||
|
||||
|
@ -818,7 +818,7 @@ void wm_draw_update(bContext *C)
|
|||
screen->do_draw_gesture = false;
|
||||
screen->do_draw_paintcursor = false;
|
||||
screen->do_draw_drag = false;
|
||||
|
||||
|
||||
wm_window_swap_buffers(win);
|
||||
|
||||
CTX_wm_window_set(C, NULL);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -152,27 +152,27 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
|
|||
{
|
||||
wmWindowManager *wm;
|
||||
wmWindow *win, *active_win;
|
||||
|
||||
|
||||
*wmlist = G.main->wm;
|
||||
BLI_listbase_clear(&G.main->wm);
|
||||
|
||||
|
||||
active_win = CTX_wm_window(C);
|
||||
|
||||
/* first wrap up running stuff */
|
||||
/* code copied from wm_init_exit.c */
|
||||
for (wm = wmlist->first; wm; wm = wm->id.next) {
|
||||
|
||||
|
||||
WM_jobs_kill_all(wm);
|
||||
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
|
||||
|
||||
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
|
||||
WM_event_remove_handlers(C, &win->handlers);
|
||||
WM_event_remove_handlers(C, &win->modalhandlers);
|
||||
ED_screen_exit(C, win, WM_window_get_active_screen(win));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* reset active window */
|
||||
CTX_wm_window_set(C, active_win);
|
||||
|
||||
|
@ -341,7 +341,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);
|
||||
|
||||
|
@ -570,7 +570,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||
/* it throws error box when file doesn't exist and returns -1 */
|
||||
/* note; it should set some error message somewhere... (ton) */
|
||||
retval = wm_read_exotic(filepath);
|
||||
|
||||
|
||||
/* we didn't succeed, now try to read Blender file */
|
||||
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
|
||||
int G_f = G.f;
|
||||
|
@ -579,7 +579,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||
/* put aside screens to match with persistent windows later */
|
||||
/* also exit screens and editors */
|
||||
wm_window_match_init(C, &wmbase);
|
||||
|
||||
|
||||
/* confusing this global... */
|
||||
G.relbase_valid = 1;
|
||||
retval = BKE_blendfile_read(C, filepath, reports, 0);
|
||||
|
@ -611,7 +611,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();
|
||||
|
@ -875,7 +875,7 @@ int wm_homefile_read(
|
|||
/* 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(C, &wmbase, &bmain->wm, &bmain->wm);
|
||||
WM_check(C); /* opens window(s), checks keymaps */
|
||||
|
@ -921,7 +921,7 @@ void wm_history_file_read(void)
|
|||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BLI_file_free_lines(lines);
|
||||
}
|
||||
|
||||
|
@ -1076,7 +1076,7 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
|
|||
|
||||
/* add pretty overlay */
|
||||
IMB_thumb_overlay_blend(ibuf->rect, ibuf->x, ibuf->y, aspect);
|
||||
|
||||
|
||||
thumb = BKE_main_thumbnail_from_imbuf(NULL, ibuf);
|
||||
}
|
||||
else {
|
||||
|
@ -1084,10 +1084,10 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen,
|
|||
fprintf(stderr, "blend_file_thumb failed to create thumbnail: %s\n", err_out);
|
||||
thumb = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* must be freed by caller */
|
||||
*thumb_pt = thumb;
|
||||
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
ImBuf *ibuf_thumb = NULL;
|
||||
|
||||
len = strlen(filepath);
|
||||
|
||||
|
||||
if (len == 0) {
|
||||
BKE_report(reports, RPT_ERROR, "Path is empty, cannot save");
|
||||
return ret;
|
||||
|
@ -1132,7 +1132,7 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor
|
|||
BKE_report(reports, RPT_ERROR, "Path too long, cannot save");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Check if file write permission is ok */
|
||||
if (BLI_exists(filepath) && !BLI_file_is_writable(filepath)) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Cannot save blend file, path '%s' is not writable", filepath);
|
||||
|
@ -1142,7 +1142,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) {
|
||||
|
@ -1170,7 +1170,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 */
|
||||
|
@ -1183,14 +1183,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 */
|
||||
}
|
||||
|
||||
|
@ -1275,7 +1275,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
|
|||
wmWindow *win;
|
||||
wmEventHandler *handler;
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
|
||||
WM_event_remove_timer(wm, NULL, wm->autosavetimer);
|
||||
|
||||
/* if a modal operator is running, don't autosave, but try again in 10 seconds */
|
||||
|
@ -1324,7 +1324,7 @@ void wm_autosave_timer_ended(wmWindowManager *wm)
|
|||
void wm_autosave_delete(void)
|
||||
{
|
||||
char filename[FILE_MAX];
|
||||
|
||||
|
||||
wm_autosave_location(filename);
|
||||
|
||||
if (BLI_exists(filename)) {
|
||||
|
|
|
@ -372,7 +372,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
|
|||
if (view_layer && RNA_boolean_get(op->ptr, "autoselect")) {
|
||||
BKE_view_layer_base_deselect_all(view_layer);
|
||||
}
|
||||
|
||||
|
||||
/* tag everything, all untagged data can be made local
|
||||
* its also generally useful to know what is new
|
||||
*
|
||||
|
@ -531,18 +531,18 @@ void WM_OT_link(wmOperatorType *ot)
|
|||
ot->name = "Link from Library";
|
||||
ot->idname = "WM_OT_link";
|
||||
ot->description = "Link from a Library .blend file";
|
||||
|
||||
|
||||
ot->invoke = wm_link_append_invoke;
|
||||
ot->exec = wm_link_append_exec;
|
||||
ot->poll = wm_link_append_poll;
|
||||
|
||||
|
||||
ot->flag |= OPTYPE_UNDO;
|
||||
|
||||
WM_operator_properties_filesel(
|
||||
ot, FILE_TYPE_FOLDER | FILE_TYPE_BLENDER | FILE_TYPE_BLENDERLIB, FILE_LOADLIB, FILE_OPENFILE,
|
||||
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
|
||||
FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
|
||||
|
||||
|
||||
wm_link_append_properties_common(ot, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,20 +63,20 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
|
|||
wmGesture *gesture = MEM_callocN(sizeof(wmGesture), "new gesture");
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
|
||||
BLI_addtail(&window->gesture, gesture);
|
||||
|
||||
|
||||
gesture->type = type;
|
||||
gesture->event_type = event->type;
|
||||
gesture->winrct = ar->winrct;
|
||||
gesture->userdata_free = true; /* Free if userdata is set. */
|
||||
gesture->modal_state = GESTURE_MODAL_NOP;
|
||||
|
||||
|
||||
if (ELEM(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
|
||||
WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE))
|
||||
{
|
||||
rcti *rect = MEM_callocN(sizeof(rcti), "gesture rect new");
|
||||
|
||||
|
||||
gesture->customdata = rect;
|
||||
rect->xmin = event->x - gesture->winrct.xmin;
|
||||
rect->ymin = event->y - gesture->winrct.ymin;
|
||||
|
@ -96,14 +96,14 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
|
|||
lasso[1] = event->y - gesture->winrct.ymin;
|
||||
gesture->points = 1;
|
||||
}
|
||||
|
||||
|
||||
return gesture;
|
||||
}
|
||||
|
||||
void WM_gesture_end(bContext *C, wmGesture *gesture)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
|
||||
if (win->tweak == gesture)
|
||||
win->tweak = NULL;
|
||||
BLI_remlink(&win->gesture, gesture);
|
||||
|
@ -117,7 +117,7 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
|
|||
void WM_gestures_remove(bContext *C)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
||||
|
||||
while (win->gesture.first)
|
||||
WM_gesture_end(C, win->gesture.first);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ int wm_gesture_evaluate(wmGesture *gesture)
|
|||
else if (theta == -1) val = EVT_GESTURE_SE;
|
||||
else if (theta == -2) val = EVT_GESTURE_S;
|
||||
else if (theta == -3) val = EVT_GESTURE_SW;
|
||||
|
||||
|
||||
#if 0
|
||||
/* debug */
|
||||
if (val == 1) printf("tweak north\n");
|
||||
|
@ -421,7 +421,7 @@ void wm_gesture_draw(wmWindow *win)
|
|||
for (; gt; gt = gt->next) {
|
||||
/* all in subwindow space */
|
||||
wmViewport(>->winrct);
|
||||
|
||||
|
||||
if (gt->type == WM_GESTURE_RECT)
|
||||
wm_gesture_draw_rect(gt);
|
||||
// else if (gt->type == WM_GESTURE_TWEAK)
|
||||
|
@ -448,7 +448,7 @@ void wm_gesture_draw(wmWindow *win)
|
|||
void wm_gesture_tag_redraw(bContext *C)
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
|
||||
|
||||
if (screen)
|
||||
screen->do_draw_gesture = true;
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ void WM_init_opengl(void)
|
|||
/* only called once, for startup */
|
||||
void WM_init(bContext *C, int argc, const char **argv)
|
||||
{
|
||||
|
||||
|
||||
if (!G.background) {
|
||||
wm_ghost_init(C); /* note: it assigns C to ghost! */
|
||||
wm_init_cursor_data();
|
||||
|
@ -224,12 +224,12 @@ void WM_init(bContext *C, int argc, const char **argv)
|
|||
BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
|
||||
DEG_editors_set_update_cb(ED_render_id_flush_update,
|
||||
ED_render_scene_update);
|
||||
|
||||
|
||||
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
|
||||
|
||||
|
||||
ED_file_init(); /* for fsmenu */
|
||||
ED_node_init_butfuncs();
|
||||
|
||||
|
||||
BLF_init();
|
||||
BLT_lang_init();
|
||||
|
||||
|
@ -307,7 +307,7 @@ void WM_init(bContext *C, int argc, const char **argv)
|
|||
COM_linker_hack = COM_execute;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* load last session, uses regular file reading so it has to be in end (after init py etc) */
|
||||
if (U.uiflag2 & USER_KEEP_SESSION) {
|
||||
/* calling WM_recover_last_session(C, NULL) has been moved to creator.c */
|
||||
|
@ -340,7 +340,7 @@ void WM_init_splash(bContext *C)
|
|||
if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmWindow *prevwin = CTX_wm_window(C);
|
||||
|
||||
|
||||
if (wm->windows.first) {
|
||||
CTX_wm_window_set(C, wm->windows.first);
|
||||
WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
|
||||
|
@ -353,10 +353,10 @@ void WM_init_splash(bContext *C)
|
|||
static void free_openrecent(void)
|
||||
{
|
||||
struct RecentFile *recent;
|
||||
|
||||
|
||||
for (recent = G.recent_files.first; recent; recent = recent->next)
|
||||
MEM_freeN(recent->filepath);
|
||||
|
||||
|
||||
BLI_freelistN(&(G.recent_files));
|
||||
}
|
||||
|
||||
|
@ -439,11 +439,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WM_jobs_kill_all(wm);
|
||||
|
||||
for (win = wm->windows.first; win; win = win->next) {
|
||||
|
||||
|
||||
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
|
||||
WM_event_remove_handlers(C, &win->handlers);
|
||||
WM_event_remove_handlers(C, &win->modalhandlers);
|
||||
|
@ -464,13 +464,13 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
|||
ED_undosys_type_free();
|
||||
|
||||
free_openrecent();
|
||||
|
||||
|
||||
BKE_mball_cubeTable_free();
|
||||
|
||||
|
||||
/* render code might still access databases */
|
||||
RE_FreeAllRender();
|
||||
RE_engines_exit();
|
||||
|
||||
|
||||
ED_preview_free_dbase(); /* frees a Main dbase, before BKE_blender_free! */
|
||||
|
||||
if (C && wm)
|
||||
|
@ -480,7 +480,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
|||
BKE_tracking_clipboard_free();
|
||||
BKE_mask_clipboard_free();
|
||||
BKE_vfont_clipboard_free();
|
||||
|
||||
|
||||
#ifdef WITH_COMPOSITOR
|
||||
COM_deinitialize();
|
||||
#endif
|
||||
|
@ -494,7 +494,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
|||
|
||||
GPU_exit();
|
||||
}
|
||||
|
||||
|
||||
BKE_blender_free(); /* blender.c, does entire library and spacetypes */
|
||||
// free_matcopybuf();
|
||||
ANIM_fcurves_copybuf_free();
|
||||
|
@ -523,11 +523,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
|||
BLF_free_unifont_mono();
|
||||
BLT_lang_free();
|
||||
#endif
|
||||
|
||||
|
||||
ANIM_keyingset_infos_exit();
|
||||
|
||||
|
||||
// free_txt_data();
|
||||
|
||||
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
/* option not to close python so we can use 'atexit' */
|
||||
|
@ -551,11 +551,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
|
|||
BKE_blender_userdef_data_free(&U, false);
|
||||
|
||||
RNA_exit(); /* should be after BPY_python_end so struct python slots are cleared */
|
||||
|
||||
|
||||
wm_ghost_exit();
|
||||
|
||||
CTX_free(C);
|
||||
|
||||
|
||||
GHOST_DisposeSystemPaths();
|
||||
|
||||
DNA_sdna_current_free();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -238,7 +238,7 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
|
|||
kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
|
||||
if (kmdi->remove_item)
|
||||
kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
|
||||
|
||||
|
||||
return kmdin;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ static void wm_keymap_diff_item_free(wmKeyMapDiffItem *kmdi)
|
|||
wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname)
|
||||
{
|
||||
wmKeyConfig *keyconf;
|
||||
|
||||
|
||||
keyconf = MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
|
||||
BLI_strncpy(keyconf->idname, idname, sizeof(keyconf->idname));
|
||||
BLI_addtail(&wm->keyconfigs, keyconf);
|
||||
|
@ -316,7 +316,7 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
|
|||
keyconf = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
|
||||
if (keyconf)
|
||||
return keyconf;
|
||||
|
||||
|
||||
/* otherwise use default */
|
||||
return wm->defaultconf;
|
||||
}
|
||||
|
@ -457,16 +457,16 @@ static void keymap_item_set_id(wmKeyMap *keymap, wmKeyMapItem *kmi)
|
|||
wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
|
||||
{
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
|
||||
for (kmi = keymap->items.first; kmi; kmi = kmi->next)
|
||||
if (STREQLEN(kmi->idname, idname, OP_MAX_TYPENAME))
|
||||
break;
|
||||
if (kmi == NULL) {
|
||||
kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
|
||||
|
||||
|
||||
BLI_addtail(&keymap->items, kmi);
|
||||
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
|
||||
|
||||
|
||||
keymap_item_set_id(keymap, kmi);
|
||||
|
||||
keymap_event_set(kmi, type, val, modifier, keymodifier);
|
||||
|
@ -479,7 +479,7 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
|
|||
wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
|
||||
{
|
||||
wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
|
||||
|
||||
|
||||
BLI_addtail(&keymap->items, kmi);
|
||||
BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
|
||||
|
||||
|
@ -557,7 +557,7 @@ static wmKeyMapItem *wm_keymap_find_item_equals(wmKeyMap *km, wmKeyMapItem *need
|
|||
for (kmi = km->items.first; kmi; kmi = kmi->next)
|
||||
if (wm_keymap_item_equals(kmi, needle))
|
||||
return kmi;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -568,7 +568,7 @@ static wmKeyMapItem *wm_keymap_find_item_equals_result(wmKeyMap *km, wmKeyMapIte
|
|||
for (kmi = km->items.first; kmi; kmi = kmi->next)
|
||||
if (wm_keymap_item_equals_result(kmi, needle))
|
||||
return kmi;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
|
|||
|
||||
/* add to list */
|
||||
BLI_addtail(lb, km);
|
||||
|
||||
|
||||
return km;
|
||||
}
|
||||
|
||||
|
@ -779,7 +779,7 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
|
|||
|
||||
/* ****************** storage in WM ************ */
|
||||
|
||||
/* name id's are for storing general or multiple keymaps,
|
||||
/* name id's are for storing general or multiple keymaps,
|
||||
* space/region ids are same as DNA_space_types.h */
|
||||
/* gets freed in wm.c */
|
||||
|
||||
|
@ -791,21 +791,21 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
|
|||
if (km->spaceid == spaceid && km->regionid == regionid)
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
|
||||
return km;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
|
||||
{
|
||||
wmKeyMap *km = WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
|
||||
|
||||
|
||||
if (km == NULL) {
|
||||
km = wm_keymap_new(idname, spaceid, regionid);
|
||||
BLI_addtail(&keyconf->keymaps, km);
|
||||
|
||||
WM_keyconfig_update_tag(km, NULL);
|
||||
}
|
||||
|
||||
|
||||
return km;
|
||||
}
|
||||
|
||||
|
@ -838,19 +838,19 @@ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, const Enu
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return km;
|
||||
}
|
||||
|
||||
wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
|
||||
{
|
||||
wmKeyMap *km;
|
||||
|
||||
|
||||
for (km = keyconf->keymaps.first; km; km = km->next)
|
||||
if (km->flag & KEYMAP_MODAL)
|
||||
if (STREQLEN(idname, km->idname, KMAP_MAX_NAME))
|
||||
break;
|
||||
|
||||
|
||||
return km;
|
||||
}
|
||||
|
||||
|
@ -858,10 +858,10 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
|
|||
wmKeyMapItem *WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value)
|
||||
{
|
||||
wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
|
||||
|
||||
|
||||
BLI_addtail(&km->items, kmi);
|
||||
kmi->propvalue = value;
|
||||
|
||||
|
||||
keymap_event_set(kmi, type, val, modifier, keymodifier);
|
||||
|
||||
keymap_item_set_id(km, kmi);
|
||||
|
@ -1129,7 +1129,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
|
|||
/* skip disabled keymap items [T38447] */
|
||||
if (kmi->flag & KMI_INACTIVE)
|
||||
continue;
|
||||
|
||||
|
||||
if (STREQ(kmi->idname, opname) && WM_key_event_string(kmi->type, false)[0]) {
|
||||
if (is_hotkey) {
|
||||
if (!ISHOTKEY(kmi->type))
|
||||
|
@ -1197,7 +1197,7 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ensure un-initialized keymap is never used */
|
||||
if (r_keymap) *r_keymap = NULL;
|
||||
return NULL;
|
||||
|
@ -1231,7 +1231,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(
|
|||
if (sa) {
|
||||
if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
|
||||
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
||||
|
||||
|
||||
if (ar)
|
||||
found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, is_strict, is_hotkey, r_keymap);
|
||||
}
|
||||
|
@ -1447,7 +1447,7 @@ static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
|
|||
{
|
||||
wmKeyMapItem *kmi;
|
||||
int update;
|
||||
|
||||
|
||||
update = (km->flag & KEYMAP_UPDATE);
|
||||
km->flag &= ~KEYMAP_UPDATE;
|
||||
|
||||
|
@ -1455,7 +1455,7 @@ static bool wm_keymap_test_and_clear_update(wmKeyMap *km)
|
|||
update = update || (kmi->flag & KMI_UPDATE);
|
||||
kmi->flag &= ~KMI_UPDATE;
|
||||
}
|
||||
|
||||
|
||||
return (update != 0);
|
||||
}
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ void WM_keyconfig_update(wmWindowManager *wm)
|
|||
if (wm_keymap_update_flag == 0)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
/* update operator properties for non-modal user keymaps */
|
||||
for (km = U.user_keymaps.first; km; km = km->next) {
|
||||
if ((km->flag & KEYMAP_MODAL) == 0) {
|
||||
|
@ -1586,7 +1586,7 @@ wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
|
|||
|
||||
if (!keymap)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* first user defined keymaps */
|
||||
km = WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
|
||||
|
||||
|
@ -1678,13 +1678,13 @@ void WM_keymap_restore_to_default(wmKeyMap *keymap, bContext *C)
|
|||
wmKeyMapItem *WM_keymap_item_find_id(wmKeyMap *keymap, int id)
|
||||
{
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
|
||||
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
|
||||
if (kmi->id == id) {
|
||||
return kmi;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1708,7 +1708,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
|||
|
||||
wmKeyMap *km = NULL;
|
||||
SpaceLink *sl = CTX_wm_space_data(C);
|
||||
|
||||
|
||||
/* Window */
|
||||
if (STRPREFIX(opname, "WM_OT")) {
|
||||
km = WM_keymap_find_all(C, "Window", 0, 0);
|
||||
|
@ -1735,8 +1735,8 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
|||
{
|
||||
km = WM_keymap_find_all(C, "Window", 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* 3D View */
|
||||
else if (STRPREFIX(opname, "VIEW3D_OT")) {
|
||||
km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
|
||||
|
@ -1756,11 +1756,11 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
|||
{
|
||||
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Editing Modes */
|
||||
else if (STRPREFIX(opname, "MESH_OT")) {
|
||||
km = WM_keymap_find_all(C, "Mesh", 0, 0);
|
||||
|
||||
|
||||
/* some mesh operators are active in object mode too, like add-prim */
|
||||
if (km && !WM_keymap_poll((bContext *)C, km)) {
|
||||
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
|
||||
|
@ -1770,7 +1770,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
|||
STRPREFIX(opname, "SURFACE_OT"))
|
||||
{
|
||||
km = WM_keymap_find_all(C, "Curve", 0, 0);
|
||||
|
||||
|
||||
/* some curve operators are active in object mode too, like add-prim */
|
||||
if (km && !WM_keymap_poll((bContext *)C, km)) {
|
||||
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
|
||||
|
@ -1798,7 +1798,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
|||
}
|
||||
else if (STRPREFIX(opname, "MBALL_OT")) {
|
||||
km = WM_keymap_find_all(C, "Metaball", 0, 0);
|
||||
|
||||
|
||||
/* some mball operators are active in object mode too, like add-prim */
|
||||
if (km && !WM_keymap_poll((bContext *)C, km)) {
|
||||
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
|
||||
|
@ -1939,7 +1939,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return km;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,15 +252,15 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
wmOperator *opm;
|
||||
int retval = OPERATOR_FINISHED;
|
||||
|
||||
|
||||
wm_macro_start(op);
|
||||
|
||||
for (opm = op->macro.first; opm; opm = opm->next) {
|
||||
|
||||
|
||||
if (opm->type->exec) {
|
||||
retval = opm->type->exec(C, opm);
|
||||
OPERATOR_RETVAL_CHECK(retval);
|
||||
|
||||
|
||||
if (retval & OPERATOR_FINISHED) {
|
||||
MacroData *md = op->customdata;
|
||||
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
|
||||
|
@ -273,7 +273,7 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
|
|||
CLOG_WARN(WM_LOG_OPERATORS, "'%s' cant exec macro", opm->type->idname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return wm_macro_end(op, retval);
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, const wmEvent *
|
|||
OPERATOR_RETVAL_CHECK(retval);
|
||||
|
||||
BLI_movelisttolist(&op->reports->list, &opm->reports->list);
|
||||
|
||||
|
||||
if (retval & OPERATOR_FINISHED) {
|
||||
MacroData *md = op->customdata;
|
||||
md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
|
||||
|
@ -314,7 +314,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
{
|
||||
wmOperator *opm = op->opm;
|
||||
int retval = OPERATOR_FINISHED;
|
||||
|
||||
|
||||
if (opm == NULL) {
|
||||
CLOG_ERROR(WM_LOG_OPERATORS, "macro error, calling NULL modal()");
|
||||
}
|
||||
|
@ -389,20 +389,20 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
|
|||
{
|
||||
wmOperatorType *ot;
|
||||
const char *i18n_context;
|
||||
|
||||
|
||||
if (WM_operatortype_find(idname, true)) {
|
||||
CLOG_ERROR(WM_LOG_OPERATORS, "operator %s exists, cannot create macro", idname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
|
||||
ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties);
|
||||
|
||||
|
||||
ot->idname = idname;
|
||||
ot->name = name;
|
||||
ot->description = description;
|
||||
ot->flag = OPTYPE_MACRO | flag;
|
||||
|
||||
|
||||
ot->exec = wm_macro_exec;
|
||||
ot->invoke = wm_macro_invoke;
|
||||
ot->modal = wm_macro_modal;
|
||||
|
@ -411,7 +411,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
|
|||
|
||||
if (!ot->description) /* XXX All ops should have a description but for now allow them not to. */
|
||||
ot->description = UNDOCUMENTED_OPERATOR_TIP;
|
||||
|
||||
|
||||
RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
|
||||
RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname);
|
||||
/* Use i18n context from ext.srna if possible (py operators). */
|
||||
|
@ -479,7 +479,7 @@ wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char
|
|||
static void wm_operatortype_free_macro(wmOperatorType *ot)
|
||||
{
|
||||
wmOperatorTypeMacro *otmacro;
|
||||
|
||||
|
||||
for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
|
||||
if (otmacro->ptr) {
|
||||
WM_operator_properties_free(otmacro->ptr);
|
||||
|
@ -598,7 +598,7 @@ void WM_operator_py_idname(char *to, const char *from)
|
|||
const char *sep = strstr(from, "_OT_");
|
||||
if (sep) {
|
||||
int ofs = (sep - from);
|
||||
|
||||
|
||||
/* note, we use ascii tolower instead of system tolower, because the
|
||||
* latter depends on the locale, and can lead to idname mismatch */
|
||||
memcpy(to, from, sizeof(char) * ofs);
|
||||
|
@ -1317,7 +1317,7 @@ int WM_operator_confirm_message_ex(bContext *C, wmOperator *op,
|
|||
layout = UI_popup_menu_layout(pup);
|
||||
uiItemFullO_ptr(layout, op->type, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0, NULL);
|
||||
UI_popup_menu_end(C, pup);
|
||||
|
||||
|
||||
return OPERATOR_INTERFACE;
|
||||
}
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
|
|||
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
|
||||
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
|
||||
}
|
||||
|
||||
|
||||
UI_block_bounds_set_popup(block, 4, 0, 0);
|
||||
|
||||
return block;
|
||||
|
@ -1588,10 +1588,10 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
|
|||
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NUMSELECT);
|
||||
|
||||
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
|
||||
|
||||
|
||||
uiTemplateOperatorPropertyButs(C, layout, op, NULL, UI_BUT_LABEL_ALIGN_SPLIT_COLUMN,
|
||||
UI_TEMPLATE_OP_PROPS_SHOW_TITLE);
|
||||
|
||||
|
||||
/* clear so the OK button is left alone */
|
||||
UI_block_func_set(block, NULL, NULL, NULL);
|
||||
|
||||
|
@ -1663,7 +1663,7 @@ static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
|
|||
|
||||
if (op && retval > 0)
|
||||
WM_operator_call_ex(C, op, true);
|
||||
|
||||
|
||||
MEM_freeN(data);
|
||||
}
|
||||
|
||||
|
@ -1739,7 +1739,7 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
|
|||
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height)
|
||||
{
|
||||
wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
|
||||
|
||||
|
||||
data->op = op;
|
||||
data->width = width;
|
||||
data->height = height;
|
||||
|
@ -1763,7 +1763,7 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op)
|
|||
BKE_reportf(CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s': wrong context", op->type->idname);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
UI_popup_block_invoke(C, wm_block_create_redo, op);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -1791,11 +1791,11 @@ static void WM_OT_debug_menu(wmOperatorType *ot)
|
|||
ot->name = "Debug Menu";
|
||||
ot->idname = "WM_OT_debug_menu";
|
||||
ot->description = "Open a popup to set the debug level";
|
||||
|
||||
|
||||
ot->invoke = wm_debug_menu_invoke;
|
||||
ot->exec = wm_debug_menu_exec;
|
||||
ot->poll = WM_operator_winactive;
|
||||
|
||||
|
||||
RNA_def_int(ot->srna, "debug_value", 0, SHRT_MIN, SHRT_MAX, "Debug Value", "", -10000, 10000);
|
||||
}
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
|||
/* Builds made from tag only shows tag sha */
|
||||
BLI_snprintf(hash_buf, sizeof(hash_buf), "Hash: %s", build_hash);
|
||||
BLI_snprintf(date_buf, sizeof(date_buf), "Date: %s %s", build_commit_date, build_commit_time);
|
||||
|
||||
|
||||
BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.pixelsize * U.dpi);
|
||||
hash_width = (int)BLF_width(style->widgetlabel.uifont_id, hash_buf, sizeof(hash_buf)) + U.widget_unit;
|
||||
date_width = (int)BLF_width(style->widgetlabel.uifont_id, date_buf, sizeof(date_buf)) + U.widget_unit;
|
||||
|
@ -2011,9 +2011,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
|||
UI_but_flag_enable(but, 1);
|
||||
}
|
||||
#endif /* WITH_BUILDINFO */
|
||||
|
||||
|
||||
layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style);
|
||||
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
/* show the splash menu (containing interaction presets), using python */
|
||||
if (mt) {
|
||||
|
@ -2022,10 +2022,10 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
|||
// wmWindowManager *wm = CTX_wm_manager(C);
|
||||
// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NONE);
|
||||
}
|
||||
|
||||
|
||||
UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN);
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
|
||||
|
||||
|
||||
split = uiLayoutSplit(layout, 0.0f, false);
|
||||
col = uiLayoutColumn(split, false);
|
||||
uiItemL(col, IFACE_("Links"), ICON_NONE);
|
||||
|
@ -2071,21 +2071,21 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
|||
uiItemS(col);
|
||||
uiItemO(col, NULL, ICON_RECOVER_LAST, "WM_OT_recover_last_session");
|
||||
uiItemL(col, "", ICON_NONE);
|
||||
|
||||
|
||||
mt = WM_menutype_find("USERPREF_MT_splash_footer", false);
|
||||
if (mt) {
|
||||
UI_menutype_draw(C, mt, uiLayoutColumn(layout, false));
|
||||
}
|
||||
|
||||
UI_block_bounds_set_centered(block, 0);
|
||||
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
|
||||
{
|
||||
UI_popup_block_invoke(C, wm_block_create_splash, NULL);
|
||||
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -2094,7 +2094,7 @@ static void WM_OT_splash(wmOperatorType *ot)
|
|||
ot->name = "Splash Screen";
|
||||
ot->idname = "WM_OT_splash";
|
||||
ot->description = "Open the splash screen with release info";
|
||||
|
||||
|
||||
ot->invoke = wm_splash_invoke;
|
||||
ot->poll = WM_operator_winactive;
|
||||
}
|
||||
|
@ -2114,26 +2114,26 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *userdata)
|
|||
wmWindow *win = CTX_wm_window(C);
|
||||
uiBlock *block;
|
||||
uiBut *but;
|
||||
|
||||
|
||||
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
|
||||
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
|
||||
|
||||
|
||||
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, init_data->size[0], UI_UNIT_Y, 0, 0, "");
|
||||
UI_but_func_operator_search(but);
|
||||
|
||||
|
||||
/* fake button, it holds space for search items */
|
||||
uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 10 - init_data->size[1],
|
||||
init_data->size[0], init_data->size[1], NULL, 0, 0, 0, 0, NULL);
|
||||
|
||||
|
||||
UI_block_bounds_set_popup(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
|
||||
|
||||
|
||||
wm_event_init_from_window(win, &event);
|
||||
event.type = EVT_BUT_OPEN;
|
||||
event.val = KM_PRESS;
|
||||
event.customdata = but;
|
||||
event.customdatafree = false;
|
||||
wm_event_add(win, &event);
|
||||
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
|
@ -2152,7 +2152,7 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
|
|||
};
|
||||
|
||||
UI_popup_block_invoke(C, wm_block_search_menu, &data);
|
||||
|
||||
|
||||
return OPERATOR_INTERFACE;
|
||||
}
|
||||
|
||||
|
@ -2181,7 +2181,7 @@ static void WM_OT_search_menu(wmOperatorType *ot)
|
|||
ot->name = "Search Menu";
|
||||
ot->idname = "WM_OT_search_menu";
|
||||
ot->description = "Pop-up a search menu over all available operators in current context";
|
||||
|
||||
|
||||
ot->invoke = wm_search_menu_invoke;
|
||||
ot->exec = wm_search_menu_exec;
|
||||
ot->poll = wm_search_menu_poll;
|
||||
|
@ -2372,7 +2372,7 @@ static void WM_OT_console_toggle(wmOperatorType *ot)
|
|||
ot->name = CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Toggle System Console");
|
||||
ot->idname = "WM_OT_console_toggle";
|
||||
ot->description = N_("Toggle System Console");
|
||||
|
||||
|
||||
ot->exec = wm_console_toggle_exec;
|
||||
ot->poll = WM_operator_winactive;
|
||||
}
|
||||
|
@ -2390,20 +2390,20 @@ void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C),
|
|||
wmPaintCursorDraw draw, void *customdata)
|
||||
{
|
||||
wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
|
||||
|
||||
|
||||
BLI_addtail(&wm->paintcursors, pc);
|
||||
|
||||
|
||||
pc->customdata = customdata;
|
||||
pc->poll = poll;
|
||||
pc->draw = draw;
|
||||
|
||||
|
||||
return pc;
|
||||
}
|
||||
|
||||
void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
|
||||
{
|
||||
wmPaintCursor *pc;
|
||||
|
||||
|
||||
for (pc = wm->paintcursors.first; pc; pc = pc->next) {
|
||||
if (pc == (wmPaintCursor *)handle) {
|
||||
BLI_remlink(&wm->paintcursors, pc);
|
||||
|
@ -2446,7 +2446,7 @@ static void radial_control_update_header(wmOperator *op, bContext *C)
|
|||
char msg[UI_MAX_DRAW_STR];
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
|
||||
if (sa) {
|
||||
if (hasNumInput(&rc->num_input)) {
|
||||
char num_str[NUM_STR_REP_LEN];
|
||||
|
@ -2563,7 +2563,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
|
|||
|
||||
RNA_property_float_get_array(fill_ptr, fill_prop, col);
|
||||
}
|
||||
|
||||
|
||||
Gwn_VertFormat *format = immVertexFormat();
|
||||
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
|
||||
|
||||
|
@ -2600,10 +2600,10 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
|
|||
|
||||
immAttrib2f(texCoord, 1, 0);
|
||||
immVertex2f(pos, radius, -radius);
|
||||
|
||||
|
||||
immAttrib2f(texCoord, 1, 1);
|
||||
immVertex2f(pos, radius, radius);
|
||||
|
||||
|
||||
immAttrib2f(texCoord, 0, 1);
|
||||
immVertex2f(pos, -radius, radius);
|
||||
|
||||
|
@ -2619,7 +2619,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
|
|||
immUniformColor3fvAlpha(col, alpha);
|
||||
imm_draw_circle_fill_2d(pos, 0.0f, 0.0f, radius, 40);
|
||||
}
|
||||
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
|
@ -2634,7 +2634,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
|
|||
short strdrawlen = 0;
|
||||
float strwidth, strheight;
|
||||
float r1 = 0.0f, r2 = 0.0f, rmin = 0.0, tex_radius, alpha;
|
||||
float zoom[2], col[3] = {1, 1, 1};
|
||||
float zoom[2], col[3] = {1, 1, 1};
|
||||
|
||||
switch (rc->subtype) {
|
||||
case PROP_NONE:
|
||||
|
@ -2808,7 +2808,7 @@ static int radial_control_get_path(
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* check property's array length */
|
||||
if (*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
|
||||
MEM_freeN(str);
|
||||
|
@ -2857,7 +2857,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
|
|||
/* data path is required */
|
||||
if (!rc->prop)
|
||||
return 0;
|
||||
|
||||
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
|
||||
return 0;
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
|
||||
|
@ -2892,7 +2892,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
|
||||
return 0;
|
||||
else if (rc->image_id_ptr.data) {
|
||||
|
@ -3015,7 +3015,7 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
|
|||
if (sa) {
|
||||
ED_area_headerprint(sa, NULL);
|
||||
}
|
||||
|
||||
|
||||
WM_paint_cursor_end(wm, rc->cursor);
|
||||
|
||||
/* restore original paint cursors */
|
||||
|
@ -3056,10 +3056,10 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
if (numValue < 0.0f)
|
||||
numValue += 2.0f * (float)M_PI;
|
||||
}
|
||||
|
||||
|
||||
CLAMP(numValue, rc->min_value, rc->max_value);
|
||||
new_value = numValue;
|
||||
|
||||
|
||||
radial_control_set_value(rc, new_value);
|
||||
rc->current_value = new_value;
|
||||
radial_control_update_header(op, C);
|
||||
|
@ -3210,9 +3210,9 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
|
||||
CLAMP(numValue, rc->min_value, rc->max_value);
|
||||
new_value = numValue;
|
||||
|
||||
|
||||
radial_control_set_value(rc, new_value);
|
||||
|
||||
|
||||
rc->current_value = new_value;
|
||||
radial_control_update_header(op, C);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
|
@ -3416,7 +3416,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
|
|||
a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
time_delta = (PIL_check_seconds_timer() - time_start) * 1000;
|
||||
|
||||
RNA_enum_description(redraw_timer_type_items, type, &infostr);
|
||||
|
@ -3426,7 +3426,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
|
|||
BKE_reportf(op->reports, RPT_WARNING,
|
||||
"%d x %s: %.4f ms, average: %.8f ms",
|
||||
iter_steps, infostr, time_delta, time_delta / iter_steps);
|
||||
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -3460,7 +3460,7 @@ static void WM_OT_memory_statistics(wmOperatorType *ot)
|
|||
ot->name = "Memory Statistics";
|
||||
ot->idname = "WM_OT_memory_statistics";
|
||||
ot->description = "Print memory statistics to the console";
|
||||
|
||||
|
||||
ot->exec = memory_statistics_exec;
|
||||
}
|
||||
|
||||
|
@ -3825,21 +3825,21 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
|
|||
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
|
||||
|
||||
|
||||
/* this function is called for each spacetype, only needs to add map once */
|
||||
if (keymap && keymap->modal_items) return;
|
||||
|
||||
|
||||
keymap = WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
|
||||
|
||||
|
||||
/* items for modal map */
|
||||
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
|
||||
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
|
||||
|
||||
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
|
||||
|
||||
|
||||
/* assign map to operators */
|
||||
WM_modalkeymap_assign(keymap, "IMAGE_OT_sample_line");
|
||||
WM_modalkeymap_assign(keymap, "PAINT_OT_weight_gradient");
|
||||
|
@ -3867,7 +3867,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
|
|||
|
||||
/* items for modal map */
|
||||
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
|
||||
|
||||
|
||||
/* Note: cancel only on press otherwise you cannot map this to RMB-gesture */
|
||||
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
|
||||
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
|
||||
|
@ -3879,10 +3879,10 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
|
|||
/* any unhandled leftclick release handles select */
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
|
||||
|
||||
|
||||
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
|
||||
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_DESELECT);
|
||||
|
||||
|
||||
/* assign map to operators */
|
||||
WM_modalkeymap_assign(keymap, "ACTION_OT_select_border");
|
||||
WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_border");
|
||||
|
@ -3936,7 +3936,7 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
|
|||
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
|
||||
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_IN);
|
||||
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_IN);
|
||||
|
||||
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
|
||||
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_OUT);
|
||||
|
@ -3952,7 +3952,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
|
|||
{
|
||||
wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
|
||||
/* note, this doesn't replace existing keymap items */
|
||||
WM_keymap_verify_item(keymap, "WM_OT_window_new", WKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
|
||||
#ifdef __APPLE__
|
||||
|
@ -3964,7 +3964,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
|
|||
WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0);
|
||||
#endif
|
||||
WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
|
||||
|
@ -4037,7 +4037,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
|
|||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", F12KEY, KM_PRESS, KM_SHIFT, 0);
|
||||
RNA_string_set(kmi->ptr, "data_path", "area.type");
|
||||
RNA_string_set(kmi->ptr, "value", "DOPESHEET_EDITOR");
|
||||
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
/* ndof speed */
|
||||
const char *data_path = "user_preferences.inputs.ndof_sensitivity";
|
||||
|
|
|
@ -101,7 +101,7 @@ typedef struct PlayState {
|
|||
|
||||
/* window and viewport size */
|
||||
int win_x, win_y;
|
||||
|
||||
|
||||
/* current zoom level */
|
||||
float zoom;
|
||||
|
||||
|
@ -122,7 +122,7 @@ typedef struct PlayState {
|
|||
bool loading;
|
||||
/* x/y image flip */
|
||||
bool draw_flip[2];
|
||||
|
||||
|
||||
int fstep;
|
||||
|
||||
/* current picture */
|
||||
|
@ -134,7 +134,7 @@ typedef struct PlayState {
|
|||
|
||||
/* saves passing args */
|
||||
struct ImBuf *curframe_ibuf;
|
||||
|
||||
|
||||
/* restarts player for file drop */
|
||||
char dropped_file[FILE_MAX];
|
||||
} PlayState;
|
||||
|
@ -946,13 +946,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
|||
{
|
||||
GHOST_TEventButtonData *bd = GHOST_GetEventData(evt);
|
||||
int cx, cy, sizex, sizey, inside_window;
|
||||
|
||||
|
||||
GHOST_GetCursorPosition(g_WS.ghost_system, &cx, &cy);
|
||||
GHOST_ScreenToClient(g_WS.ghost_window, cx, cy, &cx, &cy);
|
||||
playanim_window_get_size(&sizex, &sizey);
|
||||
|
||||
inside_window = (cx >= 0 && cx < sizex && cy >= 0 && cy <= sizey);
|
||||
|
||||
|
||||
if (bd->button == GHOST_kButtonMaskLeft) {
|
||||
if (type == GHOST_kEventButtonDown) {
|
||||
if (inside_window) {
|
||||
|
@ -1016,23 +1016,23 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
|||
case GHOST_kEventWindowMove:
|
||||
{
|
||||
float zoomx, zoomy;
|
||||
|
||||
|
||||
playanim_window_get_size(&ps->win_x, &ps->win_y);
|
||||
GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
|
||||
|
||||
zoomx = (float) ps->win_x / ps->ibufx;
|
||||
zoomy = (float) ps->win_y / ps->ibufy;
|
||||
|
||||
|
||||
/* zoom always show entire image */
|
||||
ps->zoom = MIN2(zoomx, zoomy);
|
||||
|
||||
|
||||
/* zoom steps of 2 for speed */
|
||||
ps->zoom = floor(ps->zoom + 0.5f);
|
||||
if (ps->zoom < 1.0f) ps->zoom = 1.0f;
|
||||
|
||||
|
||||
glViewport(0, 0, ps->win_x, ps->win_y);
|
||||
glScissor(0, 0, ps->win_x, ps->win_y);
|
||||
|
||||
|
||||
playanim_gl_matrix();
|
||||
|
||||
ptottime = 0.0;
|
||||
|
@ -1049,11 +1049,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
|
|||
case GHOST_kEventDraggingDropDone:
|
||||
{
|
||||
GHOST_TEventDragnDropData *ddd = GHOST_GetEventData(evt);
|
||||
|
||||
|
||||
if (ddd->dataType == GHOST_kDragnDropTypeFilenames) {
|
||||
GHOST_TStringArray *stra = ddd->data;
|
||||
int a;
|
||||
|
||||
|
||||
for (a = 0; a < stra->count; a++) {
|
||||
BLI_strncpy(ps->dropped_file, (char *)stra->strings[a], sizeof(ps->dropped_file));
|
||||
ps->go = false;
|
||||
|
@ -1120,7 +1120,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
|||
int sfra = -1;
|
||||
int efra = -1;
|
||||
int totblock;
|
||||
|
||||
|
||||
PlayState ps = {0};
|
||||
|
||||
/* ps.doubleb = true;*/ /* UNUSED */
|
||||
|
@ -1271,14 +1271,14 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
|||
|
||||
ps.ibufx = ibuf->x;
|
||||
ps.ibufy = ibuf->y;
|
||||
|
||||
|
||||
ps.win_x = ps.ibufx;
|
||||
ps.win_y = ps.ibufy;
|
||||
|
||||
if (maxwinx % ibuf->x) maxwinx = ibuf->x * (1 + (maxwinx / ibuf->x));
|
||||
if (maxwiny % ibuf->y) maxwiny = ibuf->y * (1 + (maxwiny / ibuf->y));
|
||||
|
||||
|
||||
|
||||
glClearColor(0.1, 0.1, 0.1, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
@ -1547,7 +1547,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
|||
BLI_strncpy(filepath, ps.dropped_file, sizeof(filepath));
|
||||
return filepath;
|
||||
}
|
||||
|
||||
|
||||
IMB_exit();
|
||||
BKE_images_exit();
|
||||
DEG_free_node_types();
|
||||
|
@ -1560,7 +1560,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
|
|||
MEM_printmemlist();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
#include "DNA_workspace_types.h"
|
||||
|
@ -113,7 +113,7 @@ static struct WMInitStruct {
|
|||
|
||||
int windowstate;
|
||||
WinOverrideFlag override_flag;
|
||||
|
||||
|
||||
bool native_pixels;
|
||||
} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0, true};
|
||||
|
||||
|
@ -125,7 +125,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;
|
||||
|
@ -147,9 +147,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;
|
||||
|
@ -168,7 +168,7 @@ static void wm_window_check_position(rcti *rect)
|
|||
rect->ymax -= d;
|
||||
rect->ymin -= d;
|
||||
}
|
||||
|
||||
|
||||
if (rect->xmin < 0) rect->xmin = 0;
|
||||
if (rect->ymin < 0) rect->ymin = 0;
|
||||
}
|
||||
|
@ -194,12 +194,12 @@ static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win)
|
|||
}
|
||||
}
|
||||
|
||||
/* including window itself, C can be NULL.
|
||||
/* including window itself, C can be NULL.
|
||||
* ED_screen_exit should have been called */
|
||||
void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
||||
{
|
||||
wmTimer *wt, *wtnext;
|
||||
|
||||
|
||||
/* update context */
|
||||
if (C) {
|
||||
WM_event_remove_handlers(C, &win->handlers);
|
||||
|
@ -217,7 +217,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;
|
||||
|
@ -226,7 +226,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
|||
}
|
||||
|
||||
if (win->eventstate) MEM_freeN(win->eventstate);
|
||||
|
||||
|
||||
wm_event_free_all(win);
|
||||
|
||||
wm_ghostwindow_destroy(wm, win);
|
||||
|
@ -241,11 +241,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;
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,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)
|
||||
|
@ -504,7 +504,7 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
|
|||
WorkSpaceLayout *layout = BKE_workspace_active_layout_get(win->workspace_hook);
|
||||
|
||||
BLI_remlink(&wm->windows, win);
|
||||
|
||||
|
||||
CTX_wm_window_set(C, win); /* needed by handlers */
|
||||
WM_event_remove_handlers(C, &win->handlers);
|
||||
WM_event_remove_handlers(C, &win->modalhandlers);
|
||||
|
@ -562,7 +562,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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,7 +628,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
|
|||
GHOST_WindowHandle ghostwin;
|
||||
GHOST_GLSettings glSettings = {0};
|
||||
int scr_w, scr_h, posy;
|
||||
|
||||
|
||||
/* a new window is created when pageflip mode is required for a window */
|
||||
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
|
||||
glSettings.flags |= GHOST_glStereoVisual;
|
||||
|
@ -639,7 +639,7 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
|
|||
|
||||
wm_get_screensize(&scr_w, &scr_h);
|
||||
posy = (scr_h - win->posy - win->sizey);
|
||||
|
||||
|
||||
ghostwin = GHOST_CreateWindow(g_system, title,
|
||||
win->posx, posy, win->sizex, win->sizey,
|
||||
(GHOST_TWindowState)win->windowstate,
|
||||
|
@ -655,16 +655,16 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
|
|||
gpu_batch_presets_reset();
|
||||
|
||||
win->gwnctx = GWN_context_create();
|
||||
|
||||
|
||||
/* the new window has already been made drawable upon creation */
|
||||
wm->windrawable = win;
|
||||
|
||||
/* needed so we can detect the graphics card below */
|
||||
GPU_init();
|
||||
|
||||
|
||||
win->ghostwin = ghostwin;
|
||||
GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
|
||||
|
||||
|
||||
wm_window_ensure_eventstate(win);
|
||||
|
||||
/* store actual window size in blender window */
|
||||
|
@ -676,7 +676,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);
|
||||
|
@ -687,14 +687,14 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
|
|||
if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
||||
/* needed here, because it's used before it reads userdef */
|
||||
WM_window_set_dpi(win);
|
||||
|
||||
|
||||
wm_window_swap_buffers(win);
|
||||
|
||||
|
||||
//GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified);
|
||||
|
||||
|
||||
/* standard state vars for window */
|
||||
GPU_state_init();
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
|
|||
{
|
||||
wmKeyMap *keymap;
|
||||
wmWindow *win;
|
||||
|
||||
|
||||
BLI_assert(G.background == false);
|
||||
|
||||
/* no commandline prefsize? then we set this.
|
||||
|
@ -726,7 +726,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 */
|
||||
|
@ -744,7 +744,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)) {
|
||||
|
@ -775,13 +775,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);
|
||||
|
@ -824,7 +824,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);
|
||||
|
@ -875,16 +875,16 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
|||
|
||||
/* changes rect to fit within desktop */
|
||||
wm_window_check_position(&rect);
|
||||
|
||||
|
||||
/* test if we have a temp screen already */
|
||||
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
|
||||
if (WM_window_is_temp_screen(win))
|
||||
break;
|
||||
|
||||
|
||||
/* add new window? */
|
||||
if (win == NULL) {
|
||||
win = wm_window_new(C);
|
||||
|
||||
|
||||
win->posx = rect.xmin;
|
||||
win->posy = rect.ymin;
|
||||
}
|
||||
|
@ -936,7 +936,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
|||
/* ensure it shows the right spacetype editor */
|
||||
sa = screen->areabase.first;
|
||||
CTX_wm_area_set(C, sa);
|
||||
|
||||
|
||||
if (type == WM_WINDOW_RENDER) {
|
||||
ED_area_newspace(C, sa, SPACE_IMAGE, false);
|
||||
}
|
||||
|
@ -946,26 +946,26 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
|||
else {
|
||||
ED_area_newspace(C, sa, SPACE_USERPREF, false);
|
||||
}
|
||||
|
||||
|
||||
ED_screen_change(C, screen);
|
||||
ED_screen_refresh(CTX_wm_manager(C), win); /* test scale */
|
||||
|
||||
|
||||
/* do additional setup for specific editor type */
|
||||
if (type == WM_WINDOW_DRIVERS) {
|
||||
/* Configure editor - mode, tabs, framing */
|
||||
SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
|
||||
sipo->mode = SIPO_MODE_DRIVERS;
|
||||
|
||||
|
||||
ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_UI);
|
||||
if (ar_props) {
|
||||
UI_panel_category_active_set(ar_props, "Drivers");
|
||||
|
||||
|
||||
ar_props->flag &= ~RGN_FLAG_HIDDEN;
|
||||
/* XXX: Adjust width of this too? */
|
||||
|
||||
|
||||
ED_region_visibility_change_update(C, ar_props);
|
||||
}
|
||||
|
||||
|
||||
ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
|
||||
if (ar_main) {
|
||||
/* XXX: Ideally we recenter based on the range instead... */
|
||||
|
@ -973,11 +973,11 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
|
|||
ar_main->v2d.tot.ymin = -2.0f;
|
||||
ar_main->v2d.tot.xmax = 2.0f;
|
||||
ar_main->v2d.tot.ymax = 2.0f;
|
||||
|
||||
|
||||
ar_main->v2d.cur = ar_main->v2d.tot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sa->spacetype == SPACE_IMAGE)
|
||||
title = IFACE_("Blender Render");
|
||||
else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
|
||||
|
@ -1133,7 +1133,7 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1142,10 +1142,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;
|
||||
}
|
||||
|
@ -1175,11 +1175,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;
|
||||
|
@ -1198,15 +1198,15 @@ static int query_qual(modifierKeyType qual)
|
|||
right = GHOST_kModifierKeyRightAlt;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
GHOST_GetModifierKeyState(g_system, left, &val);
|
||||
if (!val)
|
||||
GHOST_GetModifierKeyState(g_system, right, &val);
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
|
||||
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
|
||||
{
|
||||
BLI_assert(GPU_framebuffer_current_get() == 0);
|
||||
|
||||
|
@ -1260,7 +1260,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);
|
||||
}
|
||||
|
@ -1268,7 +1268,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
|
|||
GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
|
||||
GHOST_TEventDataPtr data = GHOST_GetEventData(evt);
|
||||
wmWindow *win;
|
||||
|
||||
|
||||
/* Ghost now can call this function for life resizes, but it should return if WM didn't initialize yet.
|
||||
* Can happen on file read (especially full size window) */
|
||||
if ((wm->initialized & WM_WINDOW_IS_INITIALIZED) == 0) {
|
||||
|
@ -1289,12 +1289,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;
|
||||
|
@ -1303,7 +1303,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;
|
||||
|
@ -1319,10 +1319,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...
|
||||
|
@ -1391,15 +1391,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
|
||||
|
@ -1430,7 +1430,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);
|
||||
|
||||
|
@ -1449,18 +1449,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;
|
||||
|
@ -1471,8 +1471,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 ||
|
||||
|
@ -1515,12 +1515,12 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
|
|||
win->posx, win->posy, win->sizex, win->sizey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wm_window_make_drawable(wm, win);
|
||||
BKE_icon_changed(screen->id.icon_id);
|
||||
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
|
||||
|
||||
|
||||
#if defined(__APPLE__) || defined(WIN32)
|
||||
/* OSX and Win32 don't return to the mainloop while resize */
|
||||
wm_event_do_notifiers(C);
|
||||
|
@ -1551,19 +1551,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;
|
||||
|
@ -1573,53 +1573,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:
|
||||
|
@ -1649,7 +1649,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;
|
||||
|
@ -1657,7 +1657,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;
|
||||
|
@ -1685,7 +1685,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;
|
||||
|
@ -1706,7 +1706,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;
|
||||
|
@ -1722,7 +1722,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;
|
||||
|
||||
|
@ -1732,7 +1732,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 */
|
||||
|
@ -1740,7 +1740,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);
|
||||
|
@ -1759,10 +1759,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;
|
||||
}
|
||||
}
|
||||
|
@ -1779,13 +1779,13 @@ void wm_ghost_init(bContext *C)
|
|||
if (C != NULL) {
|
||||
consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
|
||||
}
|
||||
|
||||
|
||||
g_system = GHOST_CreateSystem();
|
||||
|
||||
if (C != NULL) {
|
||||
GHOST_AddEventConsumer(g_system, consumer);
|
||||
}
|
||||
|
||||
|
||||
if (wm_init_state.native_pixels) {
|
||||
GHOST_UseNativePixels();
|
||||
}
|
||||
|
@ -1806,7 +1806,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;
|
||||
|
@ -1825,9 +1825,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;
|
||||
}
|
||||
|
||||
|
@ -1852,23 +1852,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;
|
||||
|
@ -1905,7 +1905,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__);
|
||||
|
||||
|
@ -1931,7 +1931,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;
|
||||
|
@ -1963,16 +1963,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';
|
||||
|
@ -1982,7 +1982,7 @@ void WM_clipboard_text_set(const char *buf, bool selection)
|
|||
}
|
||||
}
|
||||
*p2 = '\0';
|
||||
|
||||
|
||||
GHOST_putClipboard((GHOST_TInt8 *)newbuf, selection);
|
||||
MEM_freeN(newbuf);
|
||||
#else
|
||||
|
@ -2011,17 +2011,17 @@ 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);
|
||||
}
|
||||
|
@ -2123,13 +2123,13 @@ float WM_cursor_pressure(const struct wmWindow *win)
|
|||
int WM_window_pixels_x(const wmWindow *win)
|
||||
{
|
||||
float f = GHOST_GetNativePixelSize(win->ghostwin);
|
||||
|
||||
|
||||
return (int)(f * (float)win->sizex);
|
||||
}
|
||||
int WM_window_pixels_y(const wmWindow *win)
|
||||
{
|
||||
float f = GHOST_GetNativePixelSize(win->ghostwin);
|
||||
|
||||
|
||||
return (int)(f * (float)win->sizey);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct wmPaintCursor {
|
|||
struct wmPaintCursor *next, *prev;
|
||||
|
||||
void *customdata;
|
||||
|
||||
|
||||
int (*poll)(struct bContext *C);
|
||||
void (*draw)(bContext *C, int, int, void *customdata);
|
||||
} wmPaintCursor;
|
||||
|
@ -54,7 +54,7 @@ extern void wm_close_and_free_all(bContext *C, ListBase *);
|
|||
|
||||
extern void wm_add_default(struct Main *bmain, bContext *C);
|
||||
extern void wm_clear_default_size(bContext *C);
|
||||
|
||||
|
||||
/* register to windowmanager for redo or macro */
|
||||
void wm_operator_register(bContext *C, wmOperator *op);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue