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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/CMakeLists.txt1
-rw-r--r--source/blender/windowmanager/WM_api.h13
-rw-r--r--source/blender/windowmanager/WM_types.h11
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c128
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c18
-rw-r--r--source/blender/windowmanager/intern/wm_files.c8
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c19
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c40
-rw-r--r--source/blender/windowmanager/intern/wm_gesture_ops.c52
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c8
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c2
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c85
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c326
-rw-r--r--source/blender/windowmanager/intern/wm_window.c30
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c17
-rw-r--r--source/blender/windowmanager/message_bus/intern/wm_message_bus.c3
-rw-r--r--source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c2
-rw-r--r--source/blender/windowmanager/message_bus/wm_message_bus.h2
-rw-r--r--source/blender/windowmanager/wm_draw.h4
-rw-r--r--source/blender/windowmanager/wm_subwindow.h52
22 files changed, 233 insertions, 594 deletions
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 059055daea9..0da45202730 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -93,7 +93,6 @@ set(SRC
wm_event_system.h
wm_event_types.h
wm_files.h
- wm_subwindow.h
wm_window.h
manipulators/WM_manipulator_api.h
manipulators/WM_manipulator_types.h
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 16c376888df..aaf1a11a416 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -68,6 +68,8 @@ struct ScrArea;
struct Main;
struct bToolDef;
+#include "DNA_object_enums.h"
+
#ifdef WITH_INPUT_NDOF
struct wmNDOFMotionData;
#endif
@@ -105,6 +107,7 @@ bool WM_window_is_fullscreen(struct wmWindow *win);
void WM_windows_scene_data_sync(const ListBase *win_lb, struct Scene *scene) ATTR_NONNULL();
struct Scene *WM_windows_scene_get_from_screen(const struct wmWindowManager *wm, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
struct WorkSpace *WM_windows_workspace_get_from_screen(const wmWindowManager *wm, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
+eObjectMode WM_windows_object_mode_get(const struct wmWindowManager *wm) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
struct Scene *WM_window_get_active_scene(const struct wmWindow *win) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
void WM_window_change_active_scene(struct Main *bmain, struct bContext *C, struct wmWindow *win,
@@ -140,7 +143,7 @@ void WM_file_autoexec_init(const char *filepath);
bool WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
void WM_autosave_init(struct wmWindowManager *wm);
void WM_recover_last_session(struct bContext *C, struct ReportList *reports);
-void WM_file_tag_modified(const struct bContext *C);
+void WM_file_tag_modified(void);
void WM_lib_reload(struct Library *lib, struct bContext *C, struct ReportList *reports);
@@ -456,15 +459,17 @@ struct wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(s
void (*copy)(struct wmDrag *, struct wmDropBox *));
ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid);
- /* Set a subwindow active in pixelspace view, with optional scissor subset */
-void wmSubWindowSet (struct wmWindow *win, int swinid);
-void wmSubWindowScissorSet (struct wmWindow *win, int swinid, const struct rcti *srct, bool srct_pad);
+ /* Set OpenGL viewport and scissor */
+void wmViewport(const struct rcti *rect);
+void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct);
+void wmWindowViewport(struct wmWindow *win);
/* OpenGL utilities with safety check */
void wmOrtho2 (float x1, float x2, float y1, float y2);
/* use for conventions (avoid hard-coded offsets all over) */
void wmOrtho2_region_pixelspace(const struct ARegion *ar);
void wmOrtho2_pixelspace(const float x, const float y);
+void wmGetProjectionMatrix(float mat[4][4], const struct rcti *winrct);
/* threaded Jobs Manager */
enum {
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index cb90029a5e7..50062a04ae9 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -115,6 +115,7 @@ struct ImBuf;
#include "RNA_types.h"
#include "DNA_listBase.h"
+#include "DNA_vec_types.h"
#include "BLI_compiler_attrs.h"
/* exported types for WM */
@@ -214,7 +215,6 @@ typedef struct wmNotifier {
struct wmWindowManager *wm;
struct wmWindow *window;
- int swinid; /* can't rely on this, notifiers can be added without context, swinid of 0 */
unsigned int category, data, subtype, action;
void *reference;
@@ -423,7 +423,7 @@ typedef struct wmGesture {
struct wmGesture *next, *prev;
int event_type; /* event->type */
int type; /* gesture type define */
- int swinid; /* initial subwindow id where it started */
+ rcti winrct; /* bounds of region to draw gesture within */
int points; /* optional, amount of points stored */
int points_alloc; /* optional, maximum amount of points stored */
int modal_state;
@@ -521,6 +521,10 @@ typedef struct wmNDOFMotionData {
} wmNDOFMotionData;
#endif /* WITH_INPUT_NDOF */
+typedef enum { /* Timer flags */
+ WM_TIMER_NO_FREE_CUSTOM_DATA = 1 << 0, /* Do not attempt to free customdata pointer even if non-NULL. */
+} wmTimerFlags;
+
typedef struct wmTimer {
struct wmTimer *next, *prev;
@@ -528,6 +532,7 @@ typedef struct wmTimer {
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 */
@@ -536,7 +541,7 @@ typedef struct wmTimer {
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 */
- int sleep; /* internal, put timers to sleep when needed */
+ bool sleep; /* internal, put timers to sleep when needed */
} wmTimer;
typedef struct wmOperatorType {
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 30197537e14..70cff8465fc 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -95,7 +95,7 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
bScreen *screen = WM_window_get_active_screen(win);
wmPaintCursor *pc;
- if (ar->swinid && screen->subwinactive == ar->swinid) {
+ if (ar->visible && ar == screen->active_region) {
for (pc = wm->paintcursors.first; pc; pc = pc->next) {
if (pc->poll == NULL || pc->poll(C)) {
ARegion *ar_other = CTX_wm_region(C);
@@ -223,7 +223,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid) {
+ if (ar->visible) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
ar->do_draw = false;
@@ -242,7 +242,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
/* draw overlapping regions */
for (ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid) {
+ if (ar->visible) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
ar->do_draw = false;
@@ -300,7 +300,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
/* after backbuffer selection draw, we need to redraw */
ED_screen_areas_iter(win, screen, sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next)
- if (ar->swinid && !wm_area_test_invalid_backbuf(sa))
+ if (ar->visible && !wm_area_test_invalid_backbuf(sa))
ED_region_tag_redraw(ar);
}
@@ -309,18 +309,18 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
/* flush redraws of area regions up to overlapping regions */
ED_screen_areas_iter(win, screen, sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next)
- if (ar->swinid && ar->do_draw)
+ if (ar->visible && ar->do_draw)
wm_flush_regions_up(screen, &ar->winrct);
}
/* flush between overlapping regions */
for (ar = screen->regionbase.last; ar; ar = ar->prev)
- if (ar->swinid && ar->do_draw)
+ if (ar->visible && ar->do_draw)
wm_flush_regions_up(screen, &ar->winrct);
/* flush redraws of overlapping regions down to area regions */
for (ar = screen->regionbase.last; ar; ar = ar->prev)
- if (ar->swinid && ar->do_draw)
+ if (ar->visible && ar->do_draw)
wm_flush_regions_down(win, screen, &ar->winrct);
}
@@ -339,7 +339,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid) {
+ if (ar->visible) {
if (ar->do_draw) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
@@ -396,7 +396,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
/* draw marked overlapping regions */
for (ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->do_draw) {
+ if (ar->visible && ar->do_draw) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
ar->do_draw = false;
@@ -437,15 +437,8 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win)
static bool wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
{
/* compute texture sizes */
- triple->x = WM_window_pixels_x(win);
- triple->y = WM_window_pixels_y(win);
-
-#if USE_TEXTURE_RECTANGLE
- /* GL_TEXTURE_RECTANGLE is part of GL 3.1 so we can use it soon without runtime checks */
- triple->target = GL_TEXTURE_RECTANGLE;
-#else
- triple->target = GL_TEXTURE_2D;
-#endif
+ const int sizex = WM_window_pixels_x(win);
+ const int sizey = WM_window_pixels_y(win);
/* generate texture names */
glGenTextures(1, &triple->bind);
@@ -454,29 +447,25 @@ static bool wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
* there is only one texture in use, which may not be the case */
const GLint maxsize = GPU_max_texture_size();
- if (triple->x > maxsize || triple->y > maxsize) {
+ if (sizex > maxsize || sizey > maxsize) {
printf("WM: failed to allocate texture for triple buffer drawing "
"(texture too large for graphics card).\n");
return false;
}
/* setup actual texture */
- glBindTexture(triple->target, triple->bind);
+ glBindTexture(GL_TEXTURE_2D, triple->bind);
/* no mipmaps */
-#if USE_TEXTURE_RECTANGLE
- /* already has no mipmaps */
-#else
- glTexParameteri(triple->target, GL_TEXTURE_MAX_LEVEL, 0);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
/* GL_TEXTURE_BASE_LEVEL = 0 by default */
-#endif
- glTexParameteri(triple->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(triple->target, 0, GL_RGB8, triple->x, triple->y, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, sizex, sizey, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
- glBindTexture(triple->target, 0);
+ glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
@@ -487,19 +476,10 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
const int sizey = WM_window_pixels_y(win);
/* wmOrtho for the screen has this same offset */
- float ratiox = sizex;
- float ratioy = sizey;
- float halfx = GLA_PIXEL_OFS;
- float halfy = GLA_PIXEL_OFS;
-
-#if USE_TEXTURE_RECTANGLE
- /* texture rectangle has unnormalized coordinates */
-#else
- ratiox /= triple->x;
- ratioy /= triple->y;
- halfx /= triple->x;
- halfy /= triple->y;
-#endif
+ const float ratiox = 1.0f;
+ const float ratioy = 1.0f;
+ const float halfx = GLA_PIXEL_OFS / sizex;
+ const float halfy = GLA_PIXEL_OFS / sizey;
Gwn_VertFormat *format = immVertexFormat();
unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -507,16 +487,10 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
const int activeTex = 7; /* arbitrary */
glActiveTexture(GL_TEXTURE0 + activeTex);
- glBindTexture(triple->target, triple->bind);
-
-#if USE_TEXTURE_RECTANGLE
- immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA);
-#else
- immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA);
- /* TODO: make pure 2D version
- * and a 2D_IMAGE (replace, not modulate) version for when alpha = 1.0
- */
-#endif
+ glBindTexture(GL_TEXTURE_2D, triple->bind);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_ALPHA);
+
immUniform1f("alpha", alpha);
immUniform1i("image", activeTex);
@@ -537,7 +511,7 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha)
immEnd();
immUnbindProgram();
- glBindTexture(triple->target, 0);
+ glBindTexture(GL_TEXTURE_2D, 0);
if (activeTex != 0)
glActiveTexture(GL_TEXTURE0);
}
@@ -547,10 +521,10 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
const int sizex = WM_window_pixels_x(win);
const int sizey = WM_window_pixels_y(win);
- glBindTexture(triple->target, triple->bind);
+ glBindTexture(GL_TEXTURE_2D, triple->bind);
/* what is GL_READ_BUFFER right now? */
- glCopyTexSubImage2D(triple->target, 0, 0, 0, 0, 0, sizex, sizey);
- glBindTexture(triple->target, 0);
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, sizex, sizey);
+ glBindTexture(GL_TEXTURE_2D, 0);
}
static void wm_draw_region_blend(wmWindow *win, ARegion *ar, wmDrawTriple *triple)
@@ -559,9 +533,7 @@ static void wm_draw_region_blend(wmWindow *win, ARegion *ar, wmDrawTriple *tripl
/* region blend always is 1, except when blend timer is running */
if (fac < 1.0f) {
- bScreen *screen = WM_window_get_active_screen(win);
-
- wmSubWindowScissorSet(win, screen->mainwin, &ar->winrct, true);
+ wmViewport(&ar->winrct);
glEnable(GL_BLEND);
wm_triple_draw_textures(win, triple, 1.0f - fac);
@@ -583,7 +555,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#endif
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
}
@@ -619,7 +591,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->do_draw) {
+ if (ar->visible && ar->do_draw) {
if (ar->overlap == false) {
wm_draw_region(C, ar);
copytex = true;
@@ -632,7 +604,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
}
if (copytex) {
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
wm_triple_copy_textures(win, triple);
}
@@ -640,12 +612,12 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if (wm->paintcursors.first) {
ED_screen_areas_iter(win, screen, sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->swinid == screen->subwinactive) {
+ if (ar->visible && ar == screen->active_region) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* make region ready for draw, scissor, pixelspace */
- ED_region_set(C, ar);
+ wmViewport(&ar->winrct);
wm_paintcursor_draw(C, ar);
CTX_wm_region_set(C, NULL);
@@ -654,7 +626,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
}
}
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
}
/* draw overlapping area regions (always like popups) */
@@ -662,7 +634,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->overlap) {
+ if (ar->visible && ar->overlap) {
wm_draw_region(C, ar);
wm_draw_region_blend(win, ar, triple);
}
@@ -678,7 +650,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
/* draw floating regions (menus) */
for (ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid) {
+ if (ar->visible) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
ar->do_draw = false;
@@ -717,7 +689,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#endif
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
}
@@ -782,7 +754,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
/* draw marked area regions */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->do_draw) {
+ if (ar->visible && ar->do_draw) {
if (ar->overlap == false) {
CTX_wm_region_set(C, ar);
@@ -802,7 +774,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
}
if (copytex) {
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
wm_triple_copy_textures(win, triple_data);
}
@@ -810,12 +782,12 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
if (wm->paintcursors.first) {
ED_screen_areas_iter(win, screen, sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->swinid == screen->subwinactive) {
+ if (ar->visible && ar == screen->active_region) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* make region ready for draw, scissor, pixelspace */
- ED_region_set(C, ar);
+ wmViewport(&ar->winrct);
wm_paintcursor_draw(C, ar);
CTX_wm_region_set(C, NULL);
@@ -824,7 +796,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
}
}
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
}
/* draw overlapping area regions (always like popups) */
@@ -832,7 +804,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
CTX_wm_area_set(C, sa);
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid && ar->overlap) {
+ if (ar->visible && ar->overlap) {
CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar);
if (sview == STEREO_RIGHT_ID)
@@ -855,7 +827,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
/* draw floating regions (menus) */
for (ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid) {
+ if (ar->visible) {
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
if (sview == STEREO_RIGHT_ID)
@@ -874,7 +846,7 @@ static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoV
}
/* copy the ui + overlays */
- wmSubWindowSet(win, screen->mainwin);
+ wmWindowViewport(win);
wm_triple_copy_textures(win, triple_all);
}
@@ -896,7 +868,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
wm_tag_redraw_overlay(win, ar);
ar->do_draw_overlay = false;
}
- if (ar->swinid && ar->do_draw)
+ if (ar->visible && ar->do_draw)
do_draw = true;
}
@@ -904,7 +876,7 @@ static bool wm_draw_update_test_window(wmWindow *win)
for (ar = sa->regionbase.first; ar; ar = ar->next) {
wm_region_test_render_do_draw(scene, depsgraph, sa, ar);
- if (ar->swinid && ar->do_draw)
+ if (ar->visible && ar->do_draw)
do_draw = true;
}
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e66e7728d31..040ecc63bec 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -182,7 +182,6 @@ static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, v
/* XXX: in future, which notifiers to send to other windows? */
void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference)
{
- ARegion *ar;
wmWindowManager *wm = CTX_wm_manager(C);
wmNotifier *note;
@@ -196,10 +195,6 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
note->window = CTX_wm_window(C);
- ar = CTX_wm_region(C);
- if (ar)
- note->swinid = ar->swinid;
-
note->category = type & NOTE_CATEGORY;
note->data = type & NOTE_DATA;
note->subtype = type & NOTE_SUBTYPE;
@@ -339,6 +334,9 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
scene->customdata_mask |= scene->customdata_mask_modal;
WorkSpace *workspace = WM_window_get_active_workspace(win);
+
+ BKE_workspace_update_object_mode(bmain->eval_ctx, workspace);
+
BKE_workspace_update_tagged(bmain->eval_ctx, bmain, workspace, scene);
}
}
@@ -383,7 +381,7 @@ void wm_event_do_notifiers(bContext *C)
UI_popup_handlers_remove_all(C, &win->modalhandlers);
- ED_workspace_change(ref_ws, C, wm, win);
+ ED_workspace_change(ref_ws, C, win);
if (G.debug & G_DEBUG_EVENTS)
printf("%s: Workspace set %p\n", __func__, note->reference);
}
@@ -1219,8 +1217,8 @@ static int wm_operator_invoke(
}
if ((G.debug & G_DEBUG_HANDLERS) && ((event == NULL) || (event->type != MOUSEMOVE))) {
- printf("%s: handle evt %d win %d op %s\n",
- __func__, event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname);
+ printf("%s: handle evt %d region %p op %s\n",
+ __func__, event ? event->type : 0, CTX_wm_screen(C)->active_region, ot->idname);
}
if (op->type->invoke && event) {
@@ -1357,6 +1355,8 @@ static int wm_operator_call_internal(
switch (context) {
case WM_OP_INVOKE_DEFAULT:
case WM_OP_INVOKE_REGION_WIN:
+ case WM_OP_INVOKE_REGION_PREVIEW:
+ case WM_OP_INVOKE_REGION_CHANNELS:
case WM_OP_INVOKE_AREA:
case WM_OP_INVOKE_SCREEN:
/* window is needed for invoke, cancel operator */
@@ -2783,7 +2783,7 @@ void wm_event_do_handlers(bContext *C)
/* Note: setting subwin active should be done here, after modal handlers have been done */
if (event->type == MOUSEMOVE) {
/* state variables in screen, cursors. Also used in wm_draw.c, fails for modal handlers though */
- ED_screen_set_subwinactive(C, event);
+ ED_screen_set_active_region(C, event);
/* for regions having custom cursors */
wm_paintcursor_test(C, event);
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 6a86644da17..98606379a61 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -182,7 +182,6 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
{
win->ghostwin = oldwin->ghostwin;
- win->multisamples = oldwin->multisamples;
win->active = oldwin->active;
if (win->active)
wm->winactive = win;
@@ -191,7 +190,6 @@ static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWi
GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
oldwin->ghostwin = NULL;
- oldwin->multisamples = 0;
win->eventstate = oldwin->eventstate;
oldwin->eventstate = NULL;
@@ -1365,13 +1363,13 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs)
/** \} */
-void WM_file_tag_modified(const bContext *C)
+void WM_file_tag_modified(void)
{
- wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindowManager *wm = G.main->wm.first;
if (wm->file_saved) {
wm->file_saved = 0;
/* notifier that data changed, for save-over warning or header */
- WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, NULL);
+ WM_main_add_notifier(NC_WM | ND_DATACHANGED, NULL);
}
}
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index cd6a38cb9a8..a33df1bc1f2 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -320,9 +320,6 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
char path[FILE_MAX_LIBEXTRA], root[FILE_MAXDIR], libname[FILE_MAX_LIBEXTRA], relname[FILE_MAX];
char *group, *name;
int totfiles = 0;
- short flag;
- bool has_item = false;
- bool do_append;
RNA_string_get(op->ptr, "filename", relname);
RNA_string_get(op->ptr, "directory", root);
@@ -359,8 +356,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- flag = wm_link_append_flag(op);
- do_append = (flag & FILE_LINK) == 0;
+ short flag = wm_link_append_flag(op);
+ const bool do_append = (flag & FILE_LINK) == 0;
/* sanity checks for flag */
if (scene && scene->id.lib) {
@@ -406,7 +403,6 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
BLI_ghash_insert(libraries, BLI_strdup(libname), SET_INT_IN_POINTER(lib_idx));
lib_idx++;
wm_link_append_data_library_add(lapp_data, libname);
- has_item = true;
}
}
}
@@ -429,7 +425,6 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL);
BLI_BITMAP_ENABLE(item->libraries, lib_idx);
- has_item = true;
}
}
RNA_END;
@@ -442,10 +437,10 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
wm_link_append_data_library_add(lapp_data, libname);
item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL);
BLI_BITMAP_ENABLE(item->libraries, 0);
- has_item = true;
}
- if (!has_item) {
+ if (lapp_data->num_items == 0) {
+ /* Early out in case there is nothing to link. */
wm_link_append_data_free(lapp_data);
return OPERATOR_CANCELLED;
}
@@ -614,7 +609,6 @@ static void lib_relocate_do(
LinkNode *itemlink;
int item_idx;
- bool has_item = false;
/* Remove all IDs to be reloaded from Main. */
lba_idx = set_listbasepointers(bmain, lbarray);
@@ -636,7 +630,6 @@ static void lib_relocate_do(
BLI_remlink(lbarray[lba_idx], id);
item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id);
BLI_BITMAP_SET_ALL(item->libraries, true, lapp_data->num_libraries);
- has_item = true;
#ifdef PRINT_DEBUG
printf("\tdatablock to seek for: %s\n", id->name);
@@ -645,8 +638,8 @@ static void lib_relocate_do(
}
}
- if (!has_item) {
- /* nothing to relocate */
+ if (lapp_data->num_items == 0) {
+ /* Early out in case there is nothing to do. */
return;
}
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index fa5fd38b7b2..6da9101156a 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -41,7 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_lasso.h"
+#include "BLI_lasso_2d.h"
#include "BKE_context.h"
@@ -49,7 +49,6 @@
#include "WM_types.h"
#include "wm.h"
-#include "wm_subwindow.h"
#include "wm_draw.h"
#include "GPU_immediate.h"
@@ -64,40 +63,37 @@ 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);
- int sx, sy;
BLI_addtail(&window->gesture, gesture);
gesture->type = type;
gesture->event_type = event->type;
- gesture->swinid = ar->swinid; /* means only in area-region context! */
+ gesture->winrct = ar->winrct;
gesture->userdata_free = true; /* Free if userdata is set. */
gesture->modal_state = GESTURE_MODAL_NOP;
- wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy);
-
if (ELEM(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE))
{
rcti *rect = MEM_callocN(sizeof(rcti), "gesture rect new");
gesture->customdata = rect;
- rect->xmin = event->x - sx;
- rect->ymin = event->y - sy;
+ rect->xmin = event->x - gesture->winrct.xmin;
+ rect->ymin = event->y - gesture->winrct.ymin;
if (type == WM_GESTURE_CIRCLE) {
/* caller is responsible for initializing 'xmax' to radius. */
}
else {
- rect->xmax = event->x - sx;
- rect->ymax = event->y - sy;
+ rect->xmax = event->x - gesture->winrct.xmin;
+ rect->ymax = event->y - gesture->winrct.ymin;
}
}
else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) {
short *lasso;
gesture->points_alloc = 1024;
gesture->customdata = lasso = MEM_mallocN(sizeof(short[2]) * gesture->points_alloc, "lasso points");
- lasso[0] = event->x - sx;
- lasso[1] = event->y - sy;
+ lasso[0] = event->x - gesture->winrct.xmin;
+ lasso[1] = event->y - gesture->winrct.ymin;
gesture->points = 1;
}
@@ -273,14 +269,13 @@ static void draw_filled_lasso_px_cb(int x, int x_end, int y, void *user_data)
memset(col, 0x10, x_end - x);
}
-static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
+static void draw_filled_lasso(wmGesture *gt)
{
const short *lasso = (short *)gt->customdata;
const int tot = gt->points;
int (*moves)[2] = MEM_mallocN(sizeof(*moves) * (tot + 1), __func__);
int i;
rcti rect;
- rcti rect_win;
float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
for (i = 0; i < tot; i++, lasso += 2) {
@@ -290,10 +285,9 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
BLI_lasso_boundbox(&rect, (const int (*)[2])moves, tot);
- wm_subwindow_rect_get(win, gt->swinid, &rect_win);
- BLI_rcti_translate(&rect, rect_win.xmin, rect_win.ymin);
- BLI_rcti_isect(&rect_win, &rect, &rect);
- BLI_rcti_translate(&rect, -rect_win.xmin, -rect_win.ymin);
+ BLI_rcti_translate(&rect, gt->winrct.xmin, gt->winrct.ymin);
+ BLI_rcti_isect(&gt->winrct, &rect, &rect);
+ BLI_rcti_translate(&rect, -gt->winrct.xmin, -gt->winrct.ymin);
/* highly unlikely this will fail, but could crash if (tot == 0) */
if (BLI_rcti_is_empty(&rect) == false) {
@@ -335,13 +329,13 @@ static void draw_filled_lasso(wmWindow *win, wmGesture *gt)
}
-static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
+static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
{
const short *lasso = (short *)gt->customdata;
int i;
if (filled) {
- draw_filled_lasso(win, gt);
+ draw_filled_lasso(gt);
}
const int numverts = gt->points;
@@ -425,7 +419,7 @@ void wm_gesture_draw(wmWindow *win)
glLineWidth(1.0f);
for (; gt; gt = gt->next) {
/* all in subwindow space */
- wmSubWindowSet(win, gt->swinid);
+ wmViewport(&gt->winrct);
if (gt->type == WM_GESTURE_RECT)
wm_gesture_draw_rect(gt);
@@ -442,9 +436,9 @@ void wm_gesture_draw(wmWindow *win)
}
}
else if (gt->type == WM_GESTURE_LINES)
- wm_gesture_draw_lasso(win, gt, false);
+ wm_gesture_draw_lasso(gt, false);
else if (gt->type == WM_GESTURE_LASSO)
- wm_gesture_draw_lasso(win, gt, true);
+ wm_gesture_draw_lasso(gt, true);
else if (gt->type == WM_GESTURE_STRAIGHTLINE)
wm_gesture_draw_line(gt);
}
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index a554727cacd..01184f47920 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -47,7 +47,6 @@
#include "wm.h"
#include "wm_event_types.h"
#include "wm_event_system.h"
-#include "wm_subwindow.h"
#include "ED_screen.h"
@@ -198,18 +197,15 @@ int WM_gesture_border_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
wmGesture *gesture = op->customdata;
rcti *rect = gesture->customdata;
- int sx, sy;
if (event->type == MOUSEMOVE) {
- wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy);
-
if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->is_active == false) {
- rect->xmin = rect->xmax = event->x - sx;
- rect->ymin = rect->ymax = event->y - sy;
+ rect->xmin = rect->xmax = event->x - gesture->winrct.xmin;
+ rect->ymin = rect->ymax = event->y - gesture->winrct.ymin;
}
else {
- rect->xmax = event->x - sx;
- rect->ymax = event->y - sy;
+ rect->xmax = event->x - gesture->winrct.xmin;
+ rect->ymax = event->y - gesture->winrct.ymin;
}
gesture_border_apply_rect(op);
@@ -333,13 +329,11 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
wmGesture *gesture = op->customdata;
rcti *rect = gesture->customdata;
- int sx, sy;
if (event->type == MOUSEMOVE) {
- wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy);
- rect->xmin = event->x - sx;
- rect->ymin = event->y - sy;
+ rect->xmin = event->x - gesture->winrct.xmin;
+ rect->ymin = event->y - gesture->winrct.ymin;
wm_gesture_tag_redraw(C);
@@ -464,24 +458,22 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
wmWindow *window = CTX_wm_window(C);
wmGesture *gesture = window->tweak;
rcti *rect = gesture->customdata;
- int sx, sy, val;
+ int val;
switch (event->type) {
case MOUSEMOVE:
case INBETWEEN_MOUSEMOVE:
- wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy);
-
- rect->xmax = event->x - sx;
- rect->ymax = event->y - sy;
+ rect->xmax = event->x - gesture->winrct.xmin;
+ rect->ymax = event->y - gesture->winrct.ymin;
if ((val = wm_gesture_evaluate(gesture))) {
wmEvent tevent;
wm_event_init_from_window(window, &tevent);
/* We want to get coord from start of drag, not from point where it becomes a tweak event, see T40549 */
- tevent.x = rect->xmin + sx;
- tevent.y = rect->ymin + sy;
+ tevent.x = rect->xmin + gesture->winrct.xmin;
+ tevent.y = rect->ymin + gesture->winrct.ymin;
if (gesture->event_type == LEFTMOUSE)
tevent.type = EVT_TWEAK_L;
else if (gesture->event_type == RIGHTMOUSE)
@@ -617,7 +609,6 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op)
int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
wmGesture *gesture = op->customdata;
- int sx, sy;
switch (event->type) {
case MOUSEMOVE:
@@ -625,8 +616,6 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
wm_gesture_tag_redraw(C);
- wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy);
-
if (gesture->points == gesture->points_alloc) {
gesture->points_alloc *= 2;
gesture->customdata = MEM_reallocN(gesture->customdata, sizeof(short[2]) * gesture->points_alloc);
@@ -637,15 +626,15 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
short *lasso = gesture->customdata;
lasso += (2 * gesture->points - 2);
- x = (event->x - sx - lasso[0]);
- y = (event->y - sy - lasso[1]);
+ x = (event->x - gesture->winrct.xmin - lasso[0]);
+ y = (event->y - gesture->winrct.ymin - lasso[1]);
/* make a simple distance check to get a smoother lasso
* add only when at least 2 pixels between this and previous location */
if ((x * x + y * y) > 4) {
lasso += 2;
- lasso[0] = event->x - sx;
- lasso[1] = event->y - sy;
+ lasso[0] = event->x - gesture->winrct.xmin;
+ lasso[1] = event->y - gesture->winrct.ymin;
gesture->points++;
}
}
@@ -813,18 +802,15 @@ int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *ev
{
wmGesture *gesture = op->customdata;
rcti *rect = gesture->customdata;
- int sx, sy;
if (event->type == MOUSEMOVE) {
- wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy);
-
if (gesture->is_active == false) {
- rect->xmin = rect->xmax = event->x - sx;
- rect->ymin = rect->ymax = event->y - sy;
+ rect->xmin = rect->xmax = event->x - gesture->winrct.xmin;
+ rect->ymin = rect->ymax = event->y - gesture->winrct.ymin;
}
else {
- rect->xmax = event->x - sx;
- rect->ymax = event->y - sy;
+ rect->xmax = event->x - gesture->winrct.xmin;
+ rect->ymax = event->y - gesture->winrct.ymin;
gesture_straightline_apply(C, op);
}
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 55ed8b2a091..adb03de4612 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -256,7 +256,7 @@ void WM_init(bContext *C, int argc, const char **argv)
clear_matcopybuf();
ED_render_clear_mtex_copybuf();
- // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ // glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
wm_history_file_read();
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 528b9e2b3d9..f9fe787ed2d 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -418,8 +418,8 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
// printf("job started: %s\n", wm_job->name);
- BLI_init_threads(&wm_job->threads, do_job_thread, 1);
- BLI_insert_thread(&wm_job->threads, wm_job);
+ BLI_threadpool_init(&wm_job->threads, do_job_thread, 1);
+ BLI_threadpool_insert(&wm_job->threads, wm_job);
}
/* restarted job has timer already */
@@ -450,7 +450,7 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
wm_job->stop = true;
WM_job_main_thread_lock_release(wm_job);
- BLI_end_threads(&wm_job->threads);
+ BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
if (wm_job->endjob)
@@ -601,7 +601,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
wm_job->running = false;
WM_job_main_thread_lock_release(wm_job);
- BLI_end_threads(&wm_job->threads);
+ BLI_threadpool_end(&wm_job->threads);
WM_job_main_thread_lock_acquire(wm_job);
if (wm_job->endnote)
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 8980c4acf26..579892734db 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -59,7 +59,7 @@
#include "PIL_time.h"
#include "BLI_blenlib.h"
-#include "BLI_dial.h"
+#include "BLI_dial_2d.h"
#include "BLI_dynstr.h" /*for WM_operator_pystring */
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -3313,7 +3313,7 @@ static void redraw_timer_step(
CTX_wm_area_set(C, sa_iter);
for (ar_iter = sa_iter->regionbase.first; ar_iter; ar_iter = ar_iter->next) {
- if (ar_iter->swinid) {
+ if (ar_iter->visible) {
CTX_wm_region_set(C, ar_iter);
ED_region_do_draw(C, ar_iter);
ar_iter->do_draw = false;
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index fcb471530e0..d6a1eb81981 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -317,7 +317,7 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
/* checkerboard for case alpha */
if (ibuf->planes == 32) {
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
imm_draw_box_checker_2d(offs_x, offs_y, offs_x + span_x, offs_y + span_y);
}
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 84b739a692e..b70769b2d51 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -110,10 +110,10 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win)
const int sizey = WM_window_pixels_y(win);
/* wmOrtho for the screen has this same offset */
- float ratiox = sizex;
- float ratioy = sizey;
- float halfx = GLA_PIXEL_OFS;
- float halfy = GLA_PIXEL_OFS;
+ float ratiox = 1.0f;
+ float ratioy = 1.0f;
+ float halfx = GLA_PIXEL_OFS / sizex;
+ float halfy = GLA_PIXEL_OFS / sizex;
Gwn_VertFormat *format = immVertexFormat();
unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -124,7 +124,7 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win)
/* leave GL_TEXTURE0 as the latest bind texture */
for (int eye = 1; eye >= 0; eye--) {
glActiveTexture(GL_TEXTURE0 + eye);
- glBindTexture(drawdata[eye]->triple->target, drawdata[eye]->triple->bind);
+ glBindTexture(GL_TEXTURE_2D, drawdata[eye]->triple->bind);
}
immUniform1i("image_a", 0);
@@ -149,8 +149,9 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win)
immEnd();
immUnbindProgram();
- for (int eye = 0; eye < 2; eye++) {
- glBindTexture(drawdata[eye]->triple->target, 0);
+ for (int eye = 1; eye >= 0; eye--) {
+ glActiveTexture(GL_TEXTURE0 + eye);
+ glBindTexture(GL_TEXTURE_2D, 0);
}
}
@@ -194,7 +195,6 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
{
wmDrawData *drawdata;
wmDrawTriple *triple;
- float halfx, halfy, ratiox, ratioy;
int view;
int soffx;
bool cross_eyed = (win->stereo3d_format->flag & S3D_SIDEBYSIDE_CROSSEYED) != 0;
@@ -203,6 +203,8 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_ALPHA);
+
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
triple = drawdata->triple;
@@ -217,27 +219,16 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
soffx = 0;
}
- const int sizex = triple->x;
- const int sizey = triple->y;
+ const int sizex = WM_window_pixels_x(win);
+ const int sizey = WM_window_pixels_y(win);
/* wmOrtho for the screen has this same offset */
- ratiox = sizex;
- ratioy = sizey;
- halfx = GLA_PIXEL_OFS;
- halfy = GLA_PIXEL_OFS;
-
- /* texture rectangle has unnormalized coordinates */
- if (triple->target == GL_TEXTURE_2D) {
- ratiox /= triple->x;
- ratioy /= triple->y;
- halfx /= triple->x;
- halfy /= triple->y;
- }
-
- /* TODO: if target is always same for both eyes, bind program & set uniform before loop */
- immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_3D_IMAGE_MODULATE_ALPHA : GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA);
+ const float ratiox = 1.0f;
+ const float ratioy = 1.0f;
+ const float halfx = GLA_PIXEL_OFS / sizex;
+ const float halfy = GLA_PIXEL_OFS / sizey;
- glBindTexture(triple->target, triple->bind);
+ glBindTexture(GL_TEXTURE_2D, triple->bind);
immUniform1f("alpha", 1.0f);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
@@ -257,18 +248,16 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win)
immVertex2f(pos, soffx, sizey);
immEnd();
-
- /* TODO: if target is always same for both eyes, unbind program & texture target after loop */
- glBindTexture(triple->target, 0);
- immUnbindProgram();
}
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ immUnbindProgram();
}
static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
{
wmDrawData *drawdata;
wmDrawTriple *triple;
- float halfx, halfy, ratiox, ratioy;
int view;
int soffy;
@@ -276,6 +265,8 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
unsigned int texcoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_ALPHA);
+
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
triple = drawdata->triple;
@@ -287,27 +278,16 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
soffy = 0;
}
- const int sizex = triple->x;
- const int sizey = triple->y;
+ const int sizex = WM_window_pixels_x(win);
+ const int sizey = WM_window_pixels_y(win);
/* wmOrtho for the screen has this same offset */
- ratiox = sizex;
- ratioy = sizey;
- halfx = GLA_PIXEL_OFS;
- halfy = GLA_PIXEL_OFS;
-
- /* texture rectangle has unnormalized coordinates */
- if (triple->target == GL_TEXTURE_2D) {
- ratiox /= triple->x;
- ratioy /= triple->y;
- halfx /= triple->x;
- halfy /= triple->y;
- }
-
- /* TODO: if target is always same for both eyes, bind program & set uniforms before loop */
- immBindBuiltinProgram((triple->target == GL_TEXTURE_2D) ? GPU_SHADER_3D_IMAGE_MODULATE_ALPHA : GPU_SHADER_3D_IMAGE_RECT_MODULATE_ALPHA);
+ const float ratiox = 1.0f;
+ const float ratioy = 1.0f;
+ const float halfx = GLA_PIXEL_OFS / sizex;
+ const float halfy = GLA_PIXEL_OFS / sizey;
- glBindTexture(triple->target, triple->bind);
+ glBindTexture(GL_TEXTURE_2D, triple->bind);
immUniform1f("alpha", 1.0f);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
@@ -327,11 +307,10 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win)
immVertex2f(pos, 0.0f, soffy + (sizey * 0.5f));
immEnd();
-
- /* TODO: if target is always same for both eyes, unbind program & texture target after loop */
- immUnbindProgram();
- glBindTexture(triple->target, 0);
}
+
+ immUnbindProgram();
+ glBindTexture(GL_TEXTURE_2D, 0);
}
void wm_method_draw_stereo3d(const bContext *UNUSED(C), wmWindow *win)
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 57085d4f4bd..5ca34880743 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -21,317 +21,87 @@
* Contributor(s): 2007 Blender Foundation (refactor)
*
* ***** END GPL LICENSE BLOCK *****
- *
- *
- * Subwindow opengl handling.
- * BTW: subwindows open/close in X11 are way too slow, tried it, and choose for my own system... (ton)
- *
*/
/** \file blender/windowmanager/intern/wm_subwindow.c
* \ingroup wm
*
- * Internal subwindows used for OpenGL state, used for regions and screens.
+ * OpenGL utilities for setting up 2D viewport for window and regions.
*/
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+#include "BLI_rect.h"
-#include "DNA_windowmanager_types.h"
#include "DNA_screen_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
+#include "DNA_windowmanager_types.h"
#include "BIF_gl.h"
#include "GPU_matrix.h"
#include "WM_api.h"
-#include "wm_subwindow.h"
-
-/**
- * \note #wmSubWindow stored in #wmWindow but not exposed outside this C file,
- * it seems a bit redundant (area regions can store it too, but we keep it
- * because we can store all kind of future opengl fanciness here.
- *
- * We use indices and array because:
- * - index has safety, no pointers from this C file hanging around
- * - fast lookups of indices with array, list would give overhead
- * - old code used it this way...
- * - keep option open to have 2 screens using same window
- */
-
-typedef struct wmSubWindow {
- struct wmSubWindow *next, *prev;
-
- rcti winrct;
- int swinid;
-} wmSubWindow;
-
-
-/* ******************* open, free, set, get data ******************** */
-
-/* not subwindow itself */
-static void wm_subwindow_free(wmSubWindow *UNUSED(swin))
-{
- /* future fancy stuff */
-}
-
-void wm_subwindows_free(wmWindow *win)
-{
- wmSubWindow *swin;
-
- for (swin = win->subwindows.first; swin; swin = swin->next)
- wm_subwindow_free(swin);
-
- BLI_freelistN(&win->subwindows);
-}
-
-
-int wm_subwindow_get_id(wmWindow *win)
-{
- if (win->curswin)
- return win->curswin->swinid;
- return 0;
-}
-
-static wmSubWindow *swin_from_swinid(wmWindow *win, int swinid)
-{
- wmSubWindow *swin;
-
- for (swin = win->subwindows.first; swin; swin = swin->next)
- if (swin->swinid == swinid)
- break;
- return swin;
-}
-
-static void wm_swin_size_get(wmSubWindow *swin, int *x, int *y)
-{
- *x = BLI_rcti_size_x(&swin->winrct) + 1;
- *y = BLI_rcti_size_y(&swin->winrct) + 1;
-}
-void wm_subwindow_size_get(wmWindow *win, int swinid, int *x, int *y)
+void wmViewport(const rcti *winrct)
{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
-
- if (swin) {
- wm_swin_size_get(swin, x, y);
- }
-}
+ int width = BLI_rcti_size_x(winrct) + 1;
+ int height = BLI_rcti_size_y(winrct) + 1;
+ glViewport(winrct->xmin, winrct->ymin, width, height);
+ glScissor(winrct->xmin, winrct->ymin, width, height);
-static void wm_swin_origin_get(wmSubWindow *swin, int *x, int *y)
-{
- *x = swin->winrct.xmin;
- *y = swin->winrct.ymin;
-}
-void wm_subwindow_origin_get(wmWindow *win, int swinid, int *x, int *y)
-{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
-
- if (swin) {
- wm_swin_origin_get(swin, x, y);
- }
+ wmOrtho2_pixelspace(width, height);
+ gpuLoadIdentity();
}
-
-static void wm_swin_matrix_get(wmWindow *win, wmSubWindow *swin, float mat[4][4])
+void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct)
{
- const bScreen *screen = WM_window_get_active_screen(win);
+ /* Setup part of the viewport for partial redraw. */
+ bool scissor_pad;
- /* used by UI, should find a better way to get the matrix there */
- if (swin->swinid == screen->mainwin) {
- int width, height;
-
- wm_swin_size_get(swin, &width, &height);
- orthographic_m4(mat, -GLA_PIXEL_OFS, (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS, -100, 100);
+ if (partialrct->xmin == partialrct->xmax) {
+ /* Full region. */
+ *drawrct = *winrct;
+ scissor_pad = true;
}
else {
- gpuGetProjectionMatrix(mat);
- }
-}
-void wm_subwindow_matrix_get(wmWindow *win, int swinid, float mat[4][4])
-{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
-
- if (swin) {
- wm_swin_matrix_get(win, swin, mat);
- }
-}
-
-
-static void wm_swin_rect_get(wmSubWindow *swin, rcti *r_rect)
-{
- *r_rect = swin->winrct;
-}
-void wm_subwindow_rect_get(wmWindow *win, int swinid, rcti *r_rect)
-{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
-
- if (swin) {
- wm_swin_rect_get(swin, r_rect);
- }
-}
-
-
-static void wm_swin_rect_set(wmSubWindow *swin, const rcti *rect)
-{
- swin->winrct = *rect;
-}
-void wm_subwindow_rect_set(wmWindow *win, int swinid, const rcti *rect)
-{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
-
- if (swin) {
- wm_swin_rect_set(swin, rect);
- }
-}
-
-
-/* always sets pixel-precise 2D window/view matrices */
-/* coords is in whole pixels. xmin = 15, xmax = 16: means window is 2 pix big */
-int wm_subwindow_open(wmWindow *win, const rcti *winrct, bool activate)
-{
- wmSubWindow *swin;
- int width, height;
- int freewinid = 1;
-
- for (swin = win->subwindows.first; swin; swin = swin->next)
- if (freewinid <= swin->swinid)
- freewinid = swin->swinid + 1;
-
- win->curswin = swin = MEM_callocN(sizeof(wmSubWindow), "swinopen");
- BLI_addtail(&win->subwindows, swin);
-
- swin->swinid = freewinid;
- swin->winrct = *winrct;
-
- if (activate) {
- /* and we appy it all right away */
- wmSubWindowSet(win, swin->swinid);
-
- /* extra service */
- wm_swin_size_get(swin, &width, &height);
- wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ /* Partial redraw, clipped to region. */
+ BLI_rcti_isect(winrct, partialrct, drawrct);
+ scissor_pad = false;
}
- return swin->swinid;
-}
+ int x = drawrct->xmin;
+ int y = drawrct->ymin;
+ int width = BLI_rcti_size_x(winrct) + 1;
+ int height = BLI_rcti_size_y(winrct) + 1;
-void wm_subwindow_close(wmWindow *win, int swinid)
-{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
+ int scissor_width = BLI_rcti_size_x(drawrct);
+ int scissor_height = BLI_rcti_size_y(drawrct);
- if (swin) {
- if (swin == win->curswin)
- win->curswin = NULL;
- wm_subwindow_free(swin);
- BLI_remlink(&win->subwindows, swin);
- MEM_freeN(swin);
+ /* Partial redraw rect uses different convention than region rect,
+ * so compensate for that here. One pixel offset is noticeable with
+ * viewport border render. */
+ if (scissor_pad) {
+ scissor_width += 1;
+ scissor_height += 1;
}
- else {
- printf("%s: Internal error, bad winid: %d\n", __func__, swinid);
- }
-}
-/* pixels go from 0-99 for a 100 pixel window */
-void wm_subwindow_position(wmWindow *win, int swinid, const rcti *winrct, bool activate)
-{
- wmSubWindow *swin = swin_from_swinid(win, swinid);
-
- if (swin) {
- const int window_size_x = WM_window_pixels_x(win);
- const int window_size_y = WM_window_pixels_y(win);
+ glViewport(x, y, width, height);
+ glScissor(x, y, scissor_width, scissor_height);
- int width, height;
-
- swin->winrct = *winrct;
-
- /* CRITICAL, this clamping ensures that
- * the viewport never goes outside the screen
- * edges (assuming the x, y coords aren't
- * outside). This caused a hardware lock
- * on Matrox cards if it happens.
- *
- * Really Blender should never _ever_ try
- * to do such a thing, but just to be safe
- * clamp it anyway (or fix the bScreen
- * scaling routine, and be damn sure you
- * fixed it). - zr (2001!)
- */
-
- if (swin->winrct.xmax > window_size_x)
- swin->winrct.xmax = window_size_x;
- if (swin->winrct.ymax > window_size_y)
- swin->winrct.ymax = window_size_y;
-
- if (activate) {
- /* extra service */
- wmSubWindowSet(win, swinid);
- wm_swin_size_get(swin, &width, &height);
- wmOrtho2_pixelspace(width, height);
- }
- }
- else {
- printf("%s: Internal error, bad winid: %d\n", __func__, swinid);
- }
+ wmOrtho2_pixelspace(width, height);
+ gpuLoadIdentity();
}
-/* ---------------- WM versions of OpenGL style API calls ------------------------ */
-/* ----------------- exported in WM_api.h ------------------------------------------------------ */
-
-/* internal state, no threaded opengl! XXX */
-static wmWindow *_curwindow = NULL;
-static wmSubWindow *_curswin = NULL;
-
-void wmSubWindowScissorSet(wmWindow *win, int swinid, const rcti *srct, bool srct_pad)
+void wmWindowViewport(wmWindow *win)
{
- int width, height;
- _curswin = swin_from_swinid(win, swinid);
-
- if (_curswin == NULL) {
- printf("%s %d: doesn't exist\n", __func__, swinid);
- return;
- }
-
- win->curswin = _curswin;
- _curwindow = win;
-
- width = BLI_rcti_size_x(&_curswin->winrct) + 1;
- height = BLI_rcti_size_y(&_curswin->winrct) + 1;
- glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
-
- if (srct) {
- int scissor_width = BLI_rcti_size_x(srct);
- int scissor_height = BLI_rcti_size_y(srct);
+ int width = WM_window_pixels_x(win);
+ int height = WM_window_pixels_y(win);
- /* typically a single pixel doesn't matter,
- * but one pixel offset is noticeable with viewport border render */
- if (srct_pad) {
- scissor_width += 1;
- scissor_height += 1;
- }
+ glViewport(0, 0, width, height);
+ glScissor(0, 0, width, height);
- glScissor(srct->xmin, srct->ymin, scissor_width, scissor_height);
- }
- else
- glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
-
wmOrtho2_pixelspace(width, height);
gpuLoadIdentity();
-
- glFlush();
-}
-
-/* enable the WM versions of opengl calls */
-void wmSubWindowSet(wmWindow *win, int swinid)
-{
- wmSubWindowScissorSet(win, swinid, NULL, true);
}
void wmOrtho2(float x1, float x2, float y1, float y2)
@@ -348,9 +118,7 @@ static void wmOrtho2_offset(const float x, const float y, const float ofs)
wmOrtho2(ofs, x + ofs, ofs, y + ofs);
}
-/**
- * default pixel alignment.
- */
+/* Default pixel alignment for regions. */
void wmOrtho2_region_pixelspace(const ARegion *ar)
{
wmOrtho2_offset(ar->winx, ar->winy, -0.01f);
@@ -361,5 +129,9 @@ void wmOrtho2_pixelspace(const float x, const float y)
wmOrtho2_offset(x, y, -GLA_PIXEL_OFS);
}
-/* ********** END MY WINDOW ************** */
-
+void wmGetProjectionMatrix(float mat[4][4], const rcti *winrct)
+{
+ int width = BLI_rcti_size_x(winrct) + 1;
+ int height = BLI_rcti_size_y(winrct) + 1;
+ orthographic_m4(mat, -GLA_PIXEL_OFS, (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS, -100, 100);
+}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index a1d9edd2e96..60e67bb2129 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -68,7 +68,6 @@
#include "wm.h"
#include "wm_draw.h"
#include "wm_window.h"
-#include "wm_subwindow.h"
#include "wm_event_system.h"
#include "ED_scene.h"
@@ -175,7 +174,6 @@ static void wm_ghostwindow_destroy(wmWindow *win)
if (win->ghostwin) {
GHOST_DisposeWindow(g_system, win->ghostwin);
win->ghostwin = NULL;
- win->multisamples = 0;
}
}
@@ -228,7 +226,6 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
if (win->eventstate) MEM_freeN(win->eventstate);
wm_event_free_all(win);
- wm_subwindows_free(win);
wm_draw_data_free(win);
@@ -474,16 +471,8 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
{
GHOST_WindowHandle ghostwin;
GHOST_GLSettings glSettings = {0};
- static int multisamples = -1;
int scr_w, scr_h, posy;
- /* force setting multisamples only once, it requires restart - and you cannot
- * mix it, either all windows have it, or none (tested in OSX opengl) */
- if (multisamples == -1)
- multisamples = U.ogl_multisamples;
-
- glSettings.numOfAASamples = multisamples;
-
/* 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;
@@ -521,9 +510,6 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
if (win->eventstate == NULL)
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
- /* store multisamples window was created with, in case user prefs change */
- win->multisamples = multisamples;
-
/* store actual window size in blender window */
bounds = GHOST_GetClientBounds(win->ghostwin);
@@ -1627,6 +1613,7 @@ wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigne
wt->timestep = timestep;
wt->win = win;
wt->customdata = SET_UINT_IN_POINTER(type);
+ wt->flags |= WM_TIMER_NO_FREE_CUSTOM_DATA;
BLI_addtail(&wm->timers, wt);
@@ -1648,8 +1635,9 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
wm->reports.reporttimer = NULL;
BLI_remlink(&wm->timers, wt);
- if (wt->customdata)
+ 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 */
@@ -1979,6 +1967,18 @@ WorkSpace *WM_windows_workspace_get_from_screen(const wmWindowManager *wm, const
return NULL;
}
+eObjectMode WM_windows_object_mode_get(const struct wmWindowManager *wm)
+{
+ eObjectMode object_mode = 0;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ const WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
+ if (workspace != NULL) {
+ object_mode |= workspace->object_mode;
+ }
+ }
+ return object_mode;
+}
+
Scene *WM_window_get_active_scene(const wmWindow *win)
{
return win->scene;
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index a9875020fbb..153052d7e1c 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -390,16 +390,9 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext
return;
}
- const bool draw_multisample = (U.ogl_multisamples != USER_MULTISAMPLE_NONE);
-
/* TODO this will need it own shader probably? don't think it can be handled from that point though. */
/* const bool use_lighting = (U.manipulator_flag & V3D_MANIPULATOR_SHADED) != 0; */
- /* enable multisampling */
- if (draw_multisample) {
- glEnable(GL_MULTISAMPLE);
- }
-
bool is_depth_prev = false;
/* draw_manipulators contains all visible manipulators - draw them */
@@ -435,10 +428,6 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext
if (is_depth_prev) {
glDisable(GL_DEPTH_TEST);
}
-
- if (draw_multisample) {
- glDisable(GL_MULTISAMPLE);
- }
}
void WM_manipulatormap_draw(
@@ -619,7 +608,7 @@ wmManipulator *wm_manipulatormap_highlight_find(
if (do_step[step]) {
if ((mmap->update_flag[step] & MANIPULATORMAP_IS_REFRESH_CALLBACK) &&
- (mgroup->type->refresh != NULL))
+ (mgroup->type->refresh != NULL))
{
mgroup->type->refresh(C, mgroup);
/* cleared below */
@@ -760,7 +749,7 @@ static bool wm_manipulatormap_select_all_intern(
int i;
bool changed = false;
- wm_manipulatormap_select_array_ensure_len_alloc(mmap, BLI_ghash_size(hash));
+ wm_manipulatormap_select_array_ensure_len_alloc(mmap, BLI_ghash_len(hash));
GHASH_ITER_INDEX (gh_iter, hash, i) {
wmManipulator *mpr_iter = BLI_ghashIterator_getValue(&gh_iter);
@@ -769,7 +758,7 @@ static bool wm_manipulatormap_select_all_intern(
/* highlight first manipulator */
wm_manipulatormap_highlight_set(mmap, C, msel->items[0], msel->items[0]->highlight_part);
- BLI_assert(BLI_ghash_size(hash) == msel->len);
+ BLI_assert(BLI_ghash_len(hash) == msel->len);
BLI_ghash_free(hash, NULL, NULL);
return changed;
diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus.c
index 7183655b0de..dba38dc8c8c 100644
--- a/source/blender/windowmanager/message_bus/intern/wm_message_bus.c
+++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus.c
@@ -86,6 +86,9 @@ void WM_msgbus_clear_by_owner(struct wmMsgBus *mbus, void *owner)
for (wmMsgSubscribeValueLink *msg_lnk = msg_key->values.first; msg_lnk; msg_lnk = msg_lnk_next) {
msg_lnk_next = msg_lnk->next;
if (msg_lnk->params.owner == owner) {
+ if (msg_lnk->params.tag) {
+ mbus->messages_tag_count -= 1;
+ }
if (msg_lnk->params.free_data) {
msg_lnk->params.free_data(msg_key, &msg_lnk->params);
}
diff --git a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
index 59bebad7f7b..d768e77c8fe 100644
--- a/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
+++ b/source/blender/windowmanager/message_bus/intern/wm_message_bus_static.c
@@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/intern/wm_message_bus_static.c
+/** \file blender/windowmanager/intern/message_bus/wm_message_bus_static.c
* \ingroup wm
*/
diff --git a/source/blender/windowmanager/message_bus/wm_message_bus.h b/source/blender/windowmanager/message_bus/wm_message_bus.h
index 53f283cacd2..8a800d18101 100644
--- a/source/blender/windowmanager/message_bus/wm_message_bus.h
+++ b/source/blender/windowmanager/message_bus/wm_message_bus.h
@@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/wm_message_bus.h
+/** \file blender/windowmanager/message_bus/wm_message_bus.h
* \ingroup wm
*/
diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h
index 56dff304719..fa3d443e6ae 100644
--- a/source/blender/windowmanager/wm_draw.h
+++ b/source/blender/windowmanager/wm_draw.h
@@ -34,12 +34,8 @@
#include "GPU_glew.h"
-#define USE_TEXTURE_RECTANGLE 1
-
typedef struct wmDrawTriple {
GLuint bind;
- int x, y;
- GLenum target;
} wmDrawTriple;
typedef struct wmDrawData {
diff --git a/source/blender/windowmanager/wm_subwindow.h b/source/blender/windowmanager/wm_subwindow.h
deleted file mode 100644
index cc9abf87514..00000000000
--- a/source/blender/windowmanager/wm_subwindow.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2007 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/windowmanager/wm_subwindow.h
- * \ingroup wm
- */
-
-
-#ifndef __WM_SUBWINDOW_H__
-#define __WM_SUBWINDOW_H__
-
-
-/* *************** internal api ************** */
-void wm_subwindows_free(wmWindow *win);
-
-int wm_subwindow_open(wmWindow *win, const rcti *winrct, bool activate);
-void wm_subwindow_close(wmWindow *win, int swinid);
-int wm_subwindow_get_id(wmWindow *win); /* returns id */
-
-void wm_subwindow_position(wmWindow *win, int swinid, const rcti *winrct, bool activate);
-
-void wm_subwindow_size_get(wmWindow *win, int swinid, int *x, int *y);
-void wm_subwindow_origin_get(wmWindow *win, int swinid, int *x, int *y);
-void wm_subwindow_matrix_get(wmWindow *win, int swinid, float mat[4][4]);
-void wm_subwindow_rect_get(wmWindow *win, int swinid, struct rcti *r_rect);
-void wm_subwindow_rect_set(wmWindow *win, int swinid, const rcti *rect);
-
-#endif /* __WM_SUBWINDOW_H__ */
-