Blender V5.0
screen_edit.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cmath>
10#include <cstring>
11#include <limits>
12
13#include "MEM_guardedalloc.h"
14
15#include "DNA_object_types.h"
16#include "DNA_scene_types.h"
17#include "DNA_userdef_types.h"
18
19#include "BLI_listbase.h"
20#include "BLI_rect.h"
21#include "BLI_string_utf8.h"
22#include "BLI_utildefines.h"
23
24#include "BKE_context.hh"
25#include "BKE_global.hh"
26#include "BKE_icons.h"
27#include "BKE_image.hh"
28#include "BKE_layer.hh"
29#include "BKE_lib_id.hh"
30#include "BKE_main.hh"
31#include "BKE_report.hh"
32#include "BKE_scene.hh"
33#include "BKE_screen.hh"
34#include "BKE_sound.h"
35#include "BKE_workspace.hh"
36
37#include "WM_api.hh"
38#include "WM_types.hh"
39
40#include "ED_clip.hh"
41#include "ED_node.hh"
42#include "ED_screen.hh"
43#include "ED_screen_types.hh"
44#include "ED_sequencer.hh"
45
46#include "RNA_access.hh"
47#include "RNA_enum_types.hh"
48
49#include "UI_interface.hh"
50
51#include "WM_message.hh"
52#include "WM_toolsystem.hh"
53
55
56#include "screen_intern.hh" /* own module include */
57
58/* adds no space data */
60 ScrVert *bottom_left,
61 ScrVert *top_left,
62 ScrVert *top_right,
63 ScrVert *bottom_right,
64 const eSpace_Type space_type)
65{
66 ScrArea *area = MEM_callocN<ScrArea>("addscrarea");
67
68 area->v1 = bottom_left;
69 area->v2 = top_left;
70 area->v3 = top_right;
71 area->v4 = bottom_right;
72 area->spacetype = space_type;
73
74 BLI_addtail(&area_map->areabase, area);
75
76 return area;
77}
79 ScrVert *left_bottom,
80 ScrVert *left_top,
81 ScrVert *right_top,
82 ScrVert *right_bottom,
83 const eSpace_Type space_type)
84{
85 return screen_addarea_ex(
86 AREAMAP_FROM_SCREEN(screen), left_bottom, left_top, right_top, right_bottom, space_type);
87}
88
89static void screen_delarea(bContext *C, bScreen *screen, ScrArea *area)
90{
91
92 ED_area_exit(C, area);
93
95
96 BLI_remlink(&screen->areabase, area);
97 MEM_freeN(area);
98}
99
101 bScreen *screen,
102 ScrArea *area,
103 const eScreenAxis dir_axis,
104 const float fac,
105 const bool merge)
106{
107 ScrArea *newa = nullptr;
108
109 if (area == nullptr) {
110 return nullptr;
111 }
112
113 rcti window_rect;
114 WM_window_rect_calc(win, &window_rect);
115
116 short split = screen_geom_find_area_split_point(area, &window_rect, dir_axis, fac);
117 if (split == 0) {
118 return nullptr;
119 }
120
121 /* NOTE(@ideasman42): regarding (fac > 0.5f) checks below.
122 * normally it shouldn't matter which is used since the copy should match the original
123 * however with viewport rendering and python console this isn't the case. */
124
125 if (dir_axis == SCREEN_AXIS_H) {
126 /* new vertices */
127 ScrVert *sv1 = screen_geom_vertex_add(screen, area->v1->vec.x, split);
128 ScrVert *sv2 = screen_geom_vertex_add(screen, area->v4->vec.x, split);
129
130 /* new edges */
131 screen_geom_edge_add(screen, area->v1, sv1);
132 screen_geom_edge_add(screen, sv1, area->v2);
133 screen_geom_edge_add(screen, area->v3, sv2);
134 screen_geom_edge_add(screen, sv2, area->v4);
135 screen_geom_edge_add(screen, sv1, sv2);
136
137 if (fac > 0.5f) {
138 /* new areas: top */
139 newa = screen_addarea(screen, sv1, area->v2, area->v3, sv2, eSpace_Type(area->spacetype));
140
141 /* area below */
142 area->v2 = sv1;
143 area->v3 = sv2;
144 }
145 else {
146 /* new areas: bottom */
147 newa = screen_addarea(screen, area->v1, sv1, sv2, area->v4, eSpace_Type(area->spacetype));
148
149 /* area above */
150 area->v1 = sv1;
151 area->v4 = sv2;
152 }
153
154 ED_area_data_copy(newa, area, true);
155 }
156 else {
157 /* new vertices */
158 ScrVert *sv1 = screen_geom_vertex_add(screen, split, area->v1->vec.y);
159 ScrVert *sv2 = screen_geom_vertex_add(screen, split, area->v2->vec.y);
160
161 /* new edges */
162 screen_geom_edge_add(screen, area->v1, sv1);
163 screen_geom_edge_add(screen, sv1, area->v4);
164 screen_geom_edge_add(screen, area->v2, sv2);
165 screen_geom_edge_add(screen, sv2, area->v3);
166 screen_geom_edge_add(screen, sv1, sv2);
167
168 if (fac > 0.5f) {
169 /* new areas: right */
170 newa = screen_addarea(screen, sv1, sv2, area->v3, area->v4, eSpace_Type(area->spacetype));
171
172 /* area left */
173 area->v3 = sv2;
174 area->v4 = sv1;
175 }
176 else {
177 /* new areas: left */
178 newa = screen_addarea(screen, area->v1, area->v2, sv2, sv1, eSpace_Type(area->spacetype));
179
180 /* area right */
181 area->v1 = sv1;
182 area->v2 = sv2;
183 }
184
185 ED_area_data_copy(newa, area, true);
186 }
187
188 /* remove double vertices en edges */
189 if (merge) {
191 }
194
195 return newa;
196}
197
198bScreen *screen_add(Main *bmain, const char *name, const rcti *rect)
199{
200 bScreen *screen = static_cast<bScreen *>(BKE_libblock_alloc(bmain, ID_SCR, name, 0));
201 screen->do_refresh = true;
203
204 ScrVert *sv1 = screen_geom_vertex_add(screen, rect->xmin, rect->ymin);
205 ScrVert *sv2 = screen_geom_vertex_add(screen, rect->xmin, rect->ymax - 1);
206 ScrVert *sv3 = screen_geom_vertex_add(screen, rect->xmax - 1, rect->ymax - 1);
207 ScrVert *sv4 = screen_geom_vertex_add(screen, rect->xmax - 1, rect->ymin);
208
209 screen_geom_edge_add(screen, sv1, sv2);
210 screen_geom_edge_add(screen, sv2, sv3);
211 screen_geom_edge_add(screen, sv3, sv4);
212 screen_geom_edge_add(screen, sv4, sv1);
213
214 /* dummy type, no spacedata */
215 screen_addarea(screen, sv1, sv2, sv3, sv4, SPACE_EMPTY);
216
217 return screen;
218}
219
221{
222 /* Free contents of 'to', is from blenkernel `screen.cc`. */
224
225 to->flag = from->flag;
226
227 BLI_duplicatelist(&to->vertbase, &from->vertbase);
228 BLI_duplicatelist(&to->edgebase, &from->edgebase);
229 BLI_duplicatelist(&to->areabase, &from->areabase);
231
232 ScrVert *s2 = static_cast<ScrVert *>(to->vertbase.first);
233 for (ScrVert *s1 = static_cast<ScrVert *>(from->vertbase.first); s1;
234 s1 = s1->next, s2 = s2->next)
235 {
236 s1->newv = s2;
237 }
238
239 LISTBASE_FOREACH (ScrEdge *, se, &to->edgebase) {
240 se->v1 = se->v1->newv;
241 se->v2 = se->v2->newv;
242 BKE_screen_sort_scrvert(&(se->v1), &(se->v2));
243 }
244
245 ScrArea *from_area = static_cast<ScrArea *>(from->areabase.first);
246 LISTBASE_FOREACH (ScrArea *, area, &to->areabase) {
247 area->v1 = area->v1->newv;
248 area->v2 = area->v2->newv;
249 area->v3 = area->v3->newv;
250 area->v4 = area->v4->newv;
251
252 BLI_listbase_clear(&area->spacedata);
253 BLI_listbase_clear(&area->regionbase);
254 BLI_listbase_clear(&area->actionzones);
255 BLI_listbase_clear(&area->handlers);
256
257 ED_area_data_copy(area, from_area, true);
258
259 from_area = from_area->next;
260 }
261
262 /* put at zero (needed?) */
263 LISTBASE_FOREACH (ScrVert *, s1, &from->vertbase) {
264 s1->newv = nullptr;
265 }
266}
267
268void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new)
269{
270 screen_new->winid = win->winid;
271 screen_new->do_refresh = true;
272 screen_new->do_draw = true;
273}
274
276{
277 if (sa_a == nullptr || sa_b == nullptr || sa_a == sa_b) {
278 return SCREEN_DIR_NONE;
279 }
280
281 short left_a = sa_a->v1->vec.x;
282 short right_a = sa_a->v3->vec.x;
283 short top_a = sa_a->v3->vec.y;
284 short bottom_a = sa_a->v1->vec.y;
285
286 short left_b = sa_b->v1->vec.x;
287 short right_b = sa_b->v3->vec.x;
288 short top_b = sa_b->v3->vec.y;
289 short bottom_b = sa_b->v1->vec.y;
290
291 /* How much these areas share a common edge. */
292 short overlapx = std::min(right_a, right_b) - std::max(left_a, left_b);
293 short overlapy = std::min(top_a, top_b) - std::max(bottom_a, bottom_b);
294
295 /* Minimum overlap required. */
296 const short minx = std::min({int(AREAJOINTOLERANCEX), right_a - left_a, right_b - left_b});
297 const short miny = std::min({int(AREAJOINTOLERANCEY), top_a - bottom_a, top_b - bottom_b});
298
299 if (top_a == bottom_b && overlapx >= minx) {
300 return eScreenDir(1); /* sa_a to bottom of sa_b = N */
301 }
302 if (bottom_a == top_b && overlapx >= minx) {
303 return eScreenDir(3); /* sa_a on top of sa_b = S */
304 }
305 if (left_a == right_b && overlapy >= miny) {
306 return eScreenDir(0); /* sa_a to right of sa_b = W */
307 }
308 if (right_a == left_b && overlapy >= miny) {
309 return eScreenDir(2); /* sa_a to left of sa_b = E */
310 }
311
312 return eScreenDir(-1);
313}
314
316 ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2)
317{
318 if (sa_a == nullptr || sa_b == nullptr) {
319 *r_offset1 = std::numeric_limits<int>::max();
320 *r_offset2 = std::numeric_limits<int>::max();
321 }
322 else if (dir == SCREEN_DIR_W) { /* West: sa on right and sa_b to the left. */
323 *r_offset1 = sa_b->v3->vec.y - sa_a->v2->vec.y;
324 *r_offset2 = sa_b->v4->vec.y - sa_a->v1->vec.y;
325 }
326 else if (dir == SCREEN_DIR_N) { /* North: sa below and sa_b above. */
327 *r_offset1 = sa_a->v2->vec.x - sa_b->v1->vec.x;
328 *r_offset2 = sa_a->v3->vec.x - sa_b->v4->vec.x;
329 }
330 else if (dir == SCREEN_DIR_E) { /* East: sa on left and sa_b to the right. */
331 *r_offset1 = sa_b->v2->vec.y - sa_a->v3->vec.y;
332 *r_offset2 = sa_b->v1->vec.y - sa_a->v4->vec.y;
333 }
334 else if (dir == SCREEN_DIR_S) { /* South: sa above and sa_b below. */
335 *r_offset1 = sa_a->v1->vec.x - sa_b->v2->vec.x;
336 *r_offset2 = sa_a->v4->vec.x - sa_b->v3->vec.x;
337 }
338 else {
340 *r_offset1 = std::numeric_limits<int>::max();
341 *r_offset2 = std::numeric_limits<int>::max();
342 }
343}
344
345/* Screen verts with horizontal position equal to from_x are moved to to_x. */
346static void screen_verts_halign(const wmWindow *win,
347 const bScreen *screen,
348 const short from_x,
349 const short to_x)
350{
351 ED_screen_verts_iter(win, screen, v1)
352 {
353 if (v1->vec.x == from_x) {
354 v1->vec.x = to_x;
355 }
356 }
357}
358
359/* Screen verts with vertical position equal to from_y are moved to to_y. */
360static void screen_verts_valign(const wmWindow *win,
361 const bScreen *screen,
362 const short from_y,
363 const short to_y)
364{
365 ED_screen_verts_iter(win, screen, v1)
366 {
367 if (v1->vec.y == from_y) {
368 v1->vec.y = to_y;
369 }
370 }
371}
372
373/* Test if two adjoining areas can be aligned by having their screen edges adjusted. */
375 ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2, eScreenDir dir)
376{
377 if (dir == SCREEN_DIR_NONE) {
378 return false;
379 }
380
381 int offset1;
382 int offset2;
383 area_getoffsets(sa1, sa2, dir, &offset1, &offset2);
384
386 if ((abs(offset1) >= tolerance) || (abs(offset2) >= tolerance)) {
387 /* Misalignment is too great. */
388 return false;
389 }
390
391 /* Areas that are _smaller_ than minimum sizes, sharing an edge to be moved. See #100772. */
392 if (SCREEN_DIR_IS_VERTICAL(dir)) {
393 const short xmin = std::min(sa1->v1->vec.x, sa2->v1->vec.x);
394 const short xmax = std::max(sa1->v3->vec.x, sa2->v3->vec.x);
395 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
396 if (ELEM(area, sa1, sa2)) {
397 continue;
398 }
399 if (area->v3->vec.x - area->v1->vec.x < tolerance &&
400 (area->v1->vec.x == xmin || area->v3->vec.x == xmax))
401 {
402 BKE_report(reports, RPT_ERROR, "A narrow vertical area interferes with this operation");
403 return false;
404 }
405 }
406 }
407 else {
408 const short ymin = std::min(sa1->v1->vec.y, sa2->v1->vec.y);
409 const short ymax = std::max(sa1->v3->vec.y, sa2->v3->vec.y);
410 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
411 if (ELEM(area, sa1, sa2)) {
412 continue;
413 }
414 if (area->v3->vec.y - area->v1->vec.y < tolerance &&
415 (area->v1->vec.y == ymin || area->v3->vec.y == ymax))
416 {
417 BKE_report(reports, RPT_ERROR, "A narrow horizontal area interferes with this operation");
418 return false;
419 }
420 }
421 }
422
423 return true;
424}
425
426/* Adjust all screen edges to allow joining two areas. 'dir' value is like area_getorientation().
427 */
429 ReportList *reports,
430 bScreen *screen,
431 ScrArea *sa1,
432 ScrArea *sa2,
433 const eScreenDir dir)
434{
435 if (!screen_areas_can_align(reports, screen, sa1, sa2, dir)) {
436 return false;
437 }
438
439 wmWindow *win = CTX_wm_window(C);
440
441 if (SCREEN_DIR_IS_HORIZONTAL(dir)) {
442 /* horizontal join, use average for new top and bottom. */
443 int top = (sa1->v2->vec.y + sa2->v2->vec.y) / 2;
444 int bottom = (sa1->v4->vec.y + sa2->v4->vec.y) / 2;
445
446 /* Move edges exactly matching source top and bottom. */
447 screen_verts_valign(win, screen, sa1->v2->vec.y, top);
448 screen_verts_valign(win, screen, sa1->v4->vec.y, bottom);
449
450 /* Move edges exactly matching target top and bottom. */
451 screen_verts_valign(win, screen, sa2->v2->vec.y, top);
452 screen_verts_valign(win, screen, sa2->v4->vec.y, bottom);
453 }
454 else {
455 /* Vertical join, use averages for new left and right. */
456 int left = (sa1->v1->vec.x + sa2->v1->vec.x) / 2;
457 int right = (sa1->v3->vec.x + sa2->v3->vec.x) / 2;
458
459 /* Move edges exactly matching source left and right. */
460 screen_verts_halign(win, screen, sa1->v1->vec.x, left);
461 screen_verts_halign(win, screen, sa1->v3->vec.x, right);
462
463 /* Move edges exactly matching target left and right */
464 screen_verts_halign(win, screen, sa2->v1->vec.x, left);
465 screen_verts_halign(win, screen, sa2->v3->vec.x, right);
466 }
467
468 return true;
469}
470
471/* Simple join of two areas without any splitting. Will return false if not possible. */
473 bContext *C, ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
474{
475 const eScreenDir dir = area_getorientation(sa1, sa2);
476
477 /* Ensure that the area edges are exactly aligned. */
478 if (!screen_areas_align(C, reports, screen, sa1, sa2, dir)) {
479 return false;
480 }
481
482 if (dir == SCREEN_DIR_W) { /* sa1 to right of sa2 = West. */
483 sa1->v1 = sa2->v1; /* BL */
484 sa1->v2 = sa2->v2; /* TL */
485 screen_geom_edge_add(screen, sa1->v2, sa1->v3);
486 screen_geom_edge_add(screen, sa1->v1, sa1->v4);
487 }
488 else if (dir == SCREEN_DIR_N) { /* sa1 to bottom of sa2 = North. */
489 sa1->v2 = sa2->v2; /* TL */
490 sa1->v3 = sa2->v3; /* TR */
491 screen_geom_edge_add(screen, sa1->v1, sa1->v2);
492 screen_geom_edge_add(screen, sa1->v3, sa1->v4);
493 }
494 else if (dir == SCREEN_DIR_E) { /* sa1 to left of sa2 = East. */
495 sa1->v3 = sa2->v3; /* TR */
496 sa1->v4 = sa2->v4; /* BR */
497 screen_geom_edge_add(screen, sa1->v2, sa1->v3);
498 screen_geom_edge_add(screen, sa1->v1, sa1->v4);
499 }
500 else if (dir == SCREEN_DIR_S) { /* sa1 on top of sa2 = South. */
501 sa1->v1 = sa2->v1; /* BL */
502 sa1->v4 = sa2->v4; /* BR */
503 screen_geom_edge_add(screen, sa1->v1, sa1->v2);
504 screen_geom_edge_add(screen, sa1->v3, sa1->v4);
505 }
506
507 screen_delarea(C, screen, sa2);
509 /* Update preview thumbnail */
510 BKE_icon_changed(screen->id.icon_id);
511
512 return true;
513}
514
515/* Slice off and return new area. "Reverse" gives right/bottom, rather than left/top. */
517 bContext *C, bScreen *screen, ScrArea **area, int size, eScreenDir dir, bool reverse)
518{
519 const bool vertical = SCREEN_DIR_IS_VERTICAL(dir);
520 if (abs(size) < (vertical ? AREAJOINTOLERANCEX : AREAJOINTOLERANCEY)) {
521 return nullptr;
522 }
523
524 /* Measurement with ScrVerts because winx and winy might not be correct at this time. */
525 float fac = abs(size) / float(vertical ? ((*area)->v3->vec.x - (*area)->v1->vec.x) :
526 ((*area)->v3->vec.y - (*area)->v1->vec.y));
527 fac = (reverse == vertical) ? 1.0f - fac : fac;
528 ScrArea *newsa = area_split(
529 CTX_wm_window(C), screen, *area, vertical ? SCREEN_AXIS_V : SCREEN_AXIS_H, fac, true);
530
531 /* area_split always returns smallest of the two areas, so might have to swap. */
532 if (((fac > 0.5f) == vertical) != reverse) {
533 ScrArea *temp = *area;
534 *area = newsa;
535 newsa = temp;
536 }
537
538 return newsa;
539}
540
541/* Join any two neighboring areas. Might create new areas, kept if over min_remainder. */
543 ReportList *reports,
544 bScreen *screen,
545 ScrArea *sa1,
546 ScrArea *sa2,
547 bool close_all_remainders)
548{
549 const eScreenDir dir = area_getorientation(sa1, sa2);
550 if (dir == SCREEN_DIR_NONE) {
551 return false;
552 }
553
554 int offset1;
555 int offset2;
556 area_getoffsets(sa1, sa2, dir, &offset1, &offset2);
557
558 /* Split Left/Top into new area if overhanging. */
559 ScrArea *side1 = screen_area_trim(C, screen, (offset1 > 0) ? &sa2 : &sa1, offset1, dir, false);
560
561 /* Split Right/Bottom into new area if overhanging. */
562 ScrArea *side2 = screen_area_trim(C, screen, (offset2 > 0) ? &sa1 : &sa2, offset2, dir, true);
563
564 /* The two areas now line up, so join them. */
565 screen_area_join_aligned(C, reports, screen, sa1, sa2);
566
567 if (close_all_remainders || offset1 < 0 || offset2 > 0) {
568 /* Close both if trimming `sa1`. */
569 float inner[4] = {0.0f, 0.0f, 0.0f, 0.7f};
570 if (side1) {
571 rcti rect = {side1->v1->vec.x, side1->v3->vec.x, side1->v1->vec.y, side1->v3->vec.y};
573 CTX_wm_window(C), CTX_wm_screen(C), &rect, inner, nullptr, AREA_CLOSE_FADEOUT);
574 }
575 screen_area_close(C, reports, screen, side1);
576 if (side2) {
577 rcti rect = {side2->v1->vec.x, side2->v3->vec.x, side2->v1->vec.y, side2->v3->vec.y};
579 CTX_wm_window(C), CTX_wm_screen(C), &rect, inner, nullptr, AREA_CLOSE_FADEOUT);
580 }
581 screen_area_close(C, reports, screen, side2);
582 }
583 else {
584 /* Force full rebuild. #130732 */
585 ED_area_tag_redraw(side1);
586 ED_area_tag_redraw(side2);
587 }
588
589 if (sa1 != CTX_wm_area(C)) {
590 /* Active area has changed so active region could be invalid. It is
591 * safe to set null and let it be set later by mouse position. #131751. */
592 screen->active_region = nullptr;
593 }
594
595 BKE_icon_changed(screen->id.icon_id);
596 return true;
597}
598
599int screen_area_join(bContext *C, ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
600{
601 return screen_area_join_ex(C, reports, screen, sa1, sa2, false);
602}
603
604bool screen_area_close(bContext *C, ReportList *reports, bScreen *screen, ScrArea *area)
605{
606 if (area == nullptr) {
607 return false;
608 }
609
610 ScrArea *sa2 = nullptr;
611 float best_alignment = 0.0f;
612
613 LISTBASE_FOREACH (ScrArea *, neighbor, &screen->areabase) {
614 const eScreenDir dir = area_getorientation(area, neighbor);
615 /* Must at least partially share an edge and not be a global area. */
616 if ((dir != SCREEN_DIR_NONE) && (neighbor->global == nullptr)) {
617 /* Winx/Winy might not be updated yet, so get lengths from verts. */
618 const bool vertical = SCREEN_DIR_IS_VERTICAL(dir);
619 const int area_length = vertical ? (area->v3->vec.x - area->v1->vec.x) :
620 (area->v3->vec.y - area->v1->vec.y);
621 const int ar_length = vertical ? (neighbor->v3->vec.x - neighbor->v1->vec.x) :
622 (neighbor->v3->vec.y - neighbor->v1->vec.y);
623 /* Calculate the ratio of the lengths of the shared edges. */
624 float alignment = std::min(area_length, ar_length) / float(std::max(area_length, ar_length));
625 if (alignment > best_alignment) {
626 best_alignment = alignment;
627 sa2 = neighbor;
628 }
629 }
630 }
631
632 /* Join from neighbor into this area to close it. */
633 return screen_area_join_ex(C, reports, screen, sa2, area, true);
634}
635
636void screen_area_spacelink_add(const Scene *scene, ScrArea *area, eSpace_Type space_type)
637{
638 SpaceType *stype = BKE_spacetype_from_id(space_type);
639 SpaceLink *slink = stype->create(area, scene);
640
641 area->regionbase = slink->regionbase;
642
643 BLI_addhead(&area->spacedata, slink);
645}
646
647/* ****************** EXPORTED API TO OTHER MODULES *************************** */
648
649/* screen sets cursor based on active region */
650static void region_cursor_set_ex(wmWindow *win, ScrArea *area, ARegion *region, bool swin_changed)
651{
652 BLI_assert(WM_window_get_active_screen(win)->active_region == region);
653 if (win->tag_cursor_refresh || swin_changed ||
654 (region->runtime->type && region->runtime->type->event_cursor))
655 {
656 win->tag_cursor_refresh = false;
657 ED_region_cursor_set(win, area, region);
658 }
659}
660
661static void region_cursor_set(wmWindow *win, bool swin_changed)
662{
664
665 /* Don't touch cursor if something else is controlling it, like button handling. See #51739. */
666 if (win->grabcursor) {
667 return;
668 }
669 ED_screen_areas_iter (win, screen, area) {
670 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
671 if (region == screen->active_region) {
672 region_cursor_set_ex(win, area, region, swin_changed);
673 return;
674 }
675 }
676 }
677}
678
680{
681 wmWindow *win = CTX_wm_window(C);
682 bScreen *screen = CTX_wm_screen(C);
683
684 /* generic notes */
685 switch (note->category) {
686 case NC_WM:
687 if (note->data == ND_FILEREAD) {
688 screen->do_draw = true;
689 }
690 break;
691 case NC_WINDOW:
694 }
695 screen->do_draw = true;
696 break;
697 case NC_SCREEN:
698 if (note->action == NA_EDITED) {
701 }
702 screen->do_draw = screen->do_refresh = true;
703 }
704 break;
705 case NC_SCENE:
706 if (note->data == ND_MODE) {
707 region_cursor_set(win, true);
708 }
709 break;
710 }
711}
712
713static bool region_poll(const bContext *C,
714 const bScreen *screen,
715 const ScrArea *area,
716 const ARegion *region)
717{
718 if (!region->runtime->type) {
720 return false;
721 }
722 if (!region->runtime->type->poll) {
723 /* Show region by default. */
724 return true;
725 }
726
727 RegionPollParams params = {nullptr};
728 params.screen = screen;
729 params.area = area;
730 params.region = region;
731 params.context = C;
732
733 return region->runtime->type->poll(&params);
734}
735
736bool area_regions_poll(bContext *C, const bScreen *screen, ScrArea *area)
737{
738 bScreen *prev_screen = CTX_wm_screen(C);
739 ScrArea *prev_area = CTX_wm_area(C);
740 ARegion *prev_region = CTX_wm_region(C);
741
742 CTX_wm_screen_set(C, const_cast<bScreen *>(screen));
743 CTX_wm_area_set(C, area);
744
745 bool any_changed = false;
746 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
747 const int old_region_flag = region->flag;
748
749 region->flag &= ~RGN_FLAG_POLL_FAILED;
750
751 CTX_wm_region_set(C, region);
752 if (region_poll(C, screen, area, region) == false) {
753 region->flag |= RGN_FLAG_POLL_FAILED;
754 }
755 else if (region->runtime->type && region->runtime->type->on_poll_success) {
756 region->runtime->type->on_poll_success(C, region);
757 }
758
759 if (old_region_flag != region->flag) {
760 any_changed = true;
761
762 /* Enforce complete re-init. */
763 region->v2d.flag &= ~V2D_IS_INIT;
764
765 const bool is_hidden = region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_POLL_FAILED);
766 /* Don't re-init areas, caller is expected to handle that. In fact, this code might actually
767 * run as part of #ED_area_init(). */
768 const bool do_init = false;
769 ED_region_visibility_change_update_ex(C, area, region, is_hidden, do_init);
770 }
771 }
772
773 CTX_wm_screen_set(C, prev_screen);
774 CTX_wm_area_set(C, prev_area);
775 CTX_wm_region_set(C, prev_region);
776
777 return any_changed;
778}
779
783static bool screen_regions_poll(bContext *C, wmWindow *win, const bScreen *screen)
784{
785 wmWindow *prev_win = CTX_wm_window(C);
786 ScrArea *prev_area = CTX_wm_area(C);
787 ARegion *prev_region = CTX_wm_region(C);
788
789 CTX_wm_window_set(C, win);
790
791 bool any_changed = false;
792 ED_screen_areas_iter (win, screen, area) {
793 if (area_regions_poll(C, screen, area)) {
794 any_changed = true;
795 }
796 }
797
798 CTX_wm_window_set(C, prev_win);
799 CTX_wm_area_set(C, prev_area);
800 CTX_wm_region_set(C, prev_region);
801
802 return any_changed;
803}
804
812{
814
815 /* Exception for background mode, we only need the screen context. */
816 if (!G.background) {
817 if (screen->do_refresh) {
818 ED_screen_areas_iter (win, screen, area) {
819 /* Ensure all area and region types are set before polling, it depends on it (see #130583).
820 */
822 }
823 }
824
825 /* Returns true if a change was done that requires refreshing. */
826 if (screen_regions_poll(C, win, screen)) {
827 screen->do_refresh = true;
828 }
829
830 if (!screen->do_refresh) {
831 return;
832 }
833
834 /* Called even when creating the ghost window fails in #WM_window_open. */
835 if (win->ghostwin) {
836 /* Header size depends on DPI, let's verify. */
838 }
839
841
842 screen_geom_vertices_scale(win, screen);
843
844 ED_screen_areas_iter (win, screen, area) {
845 /* Set space-type and region callbacks, calls init() */
846 /* Sets sub-windows for regions, adds handlers. */
847 ED_area_init(C, win, area);
848 }
849
850 /* wake up animtimer */
851 if (screen->animtimer) {
852 WM_event_timer_sleep(wm, win, screen->animtimer, false);
853 }
854 }
855
856 if (G.debug & G_DEBUG_EVENTS) {
857 printf("%s: set screen\n", __func__);
858 }
859 screen->do_refresh = false;
860 /* Prevent multi-window errors. */
861 screen->winid = win->winid;
862
863 screen->context = reinterpret_cast<void *>(ed_screen_context);
864}
865
867{
869 /* Enforce full refresh. */
870 screen->do_refresh = true;
871 screen_refresh_if_needed(C, wm, win);
872}
873
875{
876 wmWindow *prev_ctx_win = CTX_wm_window(C);
877 BLI_SCOPED_DEFER([&]() { CTX_wm_window_set(C, prev_ctx_win); });
878
879 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
880 /* Region polls may need window/screen context. */
881 CTX_wm_window_set(C, win);
882
883 if (BKE_workspace_active_get(win->workspace_hook) == nullptr) {
884 BKE_workspace_active_set(win->workspace_hook,
885 static_cast<WorkSpace *>(bmain->workspaces.first));
886 }
887
888 ED_screen_refresh(C, wm, win);
889 if (win->eventstate) {
890 ED_screen_set_active_region(nullptr, win, win->eventstate->xy);
891 }
892 }
893
894 if (U.uiflag & USER_HEADER_FROM_PREF) {
895 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
897 }
898 }
899}
900
905
907{
908 ED_region_exit(C, region);
909 BKE_area_region_free(area->type, region);
910 BLI_freelinkN(&area->regionbase, region);
911}
912
913/* *********** exit calls are for closing running stuff ******** */
914
916{
918 wmWindow *win = CTX_wm_window(C);
919 ARegion *prevar = CTX_wm_region(C);
920
921 if (region->runtime->type && region->runtime->type->exit) {
922 region->runtime->type->exit(wm, region);
923 }
924
925 CTX_wm_region_set(C, region);
926
927 WM_event_remove_handlers(C, &region->runtime->handlers);
928 WM_event_modal_handler_region_replace(win, region, nullptr);
929
930 /* Stop panel animation in this region if there are any. */
931 LISTBASE_FOREACH (Panel *, panel, &region->panels) {
933 }
934
935 if (region->regiontype == RGN_TYPE_TEMPORARY) {
936 /* This may be a popup region such as a popover or splash screen.
937 * In the case of popups which spawn popups it's possible for
938 * the parent popup to be freed *before* a popup which created it.
939 * The child may have a reference to the freed parent unless cleared here, see: #122132.
940 *
941 * Having parent popups freed before the popups they spawn could be investigated although
942 * they're not technically nested as they're both stored in #Screen::regionbase. */
943 WM_event_ui_handler_region_popup_replace(win, region, nullptr);
944 }
945
946 WM_draw_region_free(region);
947 /* The region is not in a state that it can be visible in anymore. Reinitializing is needed. */
948 region->runtime->visible = false;
949
950 MEM_SAFE_FREE(region->runtime->headerstr);
951
952 if (region->runtime->regiontimer) {
953 WM_event_timer_remove(wm, win, region->runtime->regiontimer);
954 region->runtime->regiontimer = nullptr;
955 }
956
957 WM_msgbus_clear_by_owner(wm->runtime->message_bus, region);
958
959 CTX_wm_region_set(C, prevar);
960}
961
963{
965 wmWindow *win = CTX_wm_window(C);
966 ScrArea *prevsa = CTX_wm_area(C);
967
968 if (area->type && area->type->exit) {
969 area->type->exit(wm, area);
970 }
971
972 CTX_wm_area_set(C, area);
973
974 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
975 ED_region_exit(C, region);
976 }
977
979 WM_event_modal_handler_area_replace(win, area, nullptr);
980
981 CTX_wm_area_set(C, prevsa);
982}
983
984void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
985{
987 wmWindow *prevwin = CTX_wm_window(C);
988
989 CTX_wm_window_set(C, window);
990
991 if (screen->animtimer) {
992 WM_event_timer_remove(wm, window, screen->animtimer);
993
995 Scene *scene = WM_window_get_active_scene(prevwin);
996 Scene *scene_eval = DEG_get_evaluated(depsgraph, scene);
997 BKE_sound_stop_scene(scene_eval);
998 }
999 screen->animtimer = nullptr;
1000 screen->scrubbing = false;
1001
1002 screen->active_region = nullptr;
1003
1004 LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
1005 ED_region_exit(C, region);
1006 }
1007 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1008 ED_area_exit(C, area);
1009 }
1010 /* Don't use ED_screen_areas_iter here, it skips hidden areas. */
1011 LISTBASE_FOREACH (ScrArea *, area, &window->global_areas.areabase) {
1012 ED_area_exit(C, area);
1013 }
1014
1015 /* mark it available for use for other windows */
1016 screen->winid = 0;
1017
1018 if (!WM_window_is_temp_screen(prevwin)) {
1019 /* use previous window if possible */
1020 CTX_wm_window_set(C, prevwin);
1021 }
1022 else {
1023 /* none otherwise */
1024 CTX_wm_window_set(C, nullptr);
1025 }
1026}
1027
1029{
1030 if (area->type && area->type->space_name_get) {
1031 return area->type->space_name_get(area);
1032 }
1033
1035 const EnumPropertyItem item = rna_enum_space_type_items[index];
1036 return item.name;
1037}
1038
1039int ED_area_icon(const ScrArea *area)
1040{
1041 if (area->type && area->type->space_icon_get) {
1042 return area->type->space_icon_get(area);
1043 }
1044
1046 const EnumPropertyItem item = rna_enum_space_type_items[index];
1047 return item.icon;
1048}
1049
1050/* *********************************** */
1051
1052/* case when on area-edge or in azones, or outside window */
1053static void screen_cursor_set(wmWindow *win, const int xy[2])
1054{
1055 const bScreen *screen = WM_window_get_active_screen(win);
1056 AZone *az = nullptr;
1057 ScrArea *area = nullptr;
1058
1059 LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) {
1060 az = ED_area_actionzone_find_xy(area_iter, xy);
1061 /* We used to exclude AZONE_REGION_SCROLL as those used
1062 * to overlap screen edges, but they no longer do so. */
1063 if (az) {
1064 area = area_iter;
1065 break;
1066 }
1067 }
1068
1069 if (area) {
1070 if (az->type == AZONE_AREA) {
1072 }
1073 else if (az->type == AZONE_REGION_SCROLL) {
1075 }
1076 else if (az->type == AZONE_REGION) {
1079 }
1080 else {
1082 }
1083 }
1084 }
1085 else {
1086 ScrEdge *actedge = screen_geom_find_active_scredge(win, screen, xy[0], xy[1]);
1087
1088 if (actedge) {
1089 if (screen_geom_edge_is_horizontal(actedge)) {
1091 }
1092 else {
1094 }
1095 }
1096 else {
1098 }
1099 }
1100}
1101
1103{
1104 bScreen *screen = WM_window_get_active_screen(win);
1105 if (screen == nullptr) {
1106 return;
1107 }
1108
1109 ScrArea *area = nullptr;
1110 ARegion *region_prev = screen->active_region;
1111
1112 ED_screen_areas_iter (win, screen, area_iter) {
1113 if (xy[0] > (area_iter->totrct.xmin + BORDERPADDING) &&
1114 xy[0] < (area_iter->totrct.xmax - BORDERPADDING))
1115 {
1116 if (xy[1] > (area_iter->totrct.ymin + BORDERPADDING) &&
1117 xy[1] < (area_iter->totrct.ymax - BORDERPADDING))
1118 {
1119 if (ED_area_azones_update(area_iter, xy) == nullptr) {
1120 area = area_iter;
1121 break;
1122 }
1123 }
1124 }
1125 }
1126 if (area) {
1127 /* Make overlap active when mouse over. */
1128 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
1129 if (ED_region_contains_xy(region, xy)) {
1130 screen->active_region = region;
1131 break;
1132 }
1133 }
1134 }
1135 else {
1136 screen->active_region = nullptr;
1137 }
1138
1139 if (region_prev != screen->active_region || !screen->active_region) {
1141 }
1142
1143 /* Check for redraw headers. */
1144 if (region_prev != screen->active_region) {
1145
1146 ED_screen_areas_iter (win, screen, area_iter) {
1147 bool do_draw = false;
1148
1149 LISTBASE_FOREACH (ARegion *, region, &area_iter->regionbase) {
1150 /* Call old area's deactivate if assigned. */
1151 if (region == region_prev && area_iter->type && area_iter->type->deactivate) {
1152 area_iter->type->deactivate(area_iter);
1153 }
1154
1155 if (region == region_prev && region != screen->active_region) {
1156 wmGizmoMap *gzmap = region_prev->runtime->gizmo_map;
1157 if (gzmap) {
1158 if (WM_gizmo_highlight_set(gzmap, nullptr)) {
1160 }
1161 }
1162 }
1163
1164 if (ELEM(region, region_prev, screen->active_region)) {
1165 do_draw = true;
1166 }
1167 }
1168
1169 if (do_draw) {
1170 LISTBASE_FOREACH (ARegion *, region, &area_iter->regionbase) {
1171 if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
1173 }
1174 }
1175 }
1176 }
1177
1178 /* Ensure test-motion values are never shared between regions. */
1179 const int mval[2] = {-1, -1};
1180 const bool use_cycle = !WM_cursor_test_motion_and_update(mval);
1181 UNUSED_VARS(use_cycle);
1182 }
1183
1184 /* Cursors, for time being set always on edges,
1185 * otherwise the active region doesn't switch. */
1186 if (screen->active_region == nullptr) {
1187 screen_cursor_set(win, xy);
1188 }
1189 else {
1190 /* Notifier invokes freeing the buttons... causing a bit too much redraws. */
1191 region_cursor_set_ex(win, area, screen->active_region, region_prev != screen->active_region);
1192
1193 if (region_prev != screen->active_region) {
1194 /* This used to be a notifier, but needs to be done immediate
1195 * because it can undo setting the right button as active due
1196 * to delayed notifier handling. */
1197 if (C) {
1199 }
1200 }
1201 }
1202}
1203
1205{
1206 wmWindow *win = CTX_wm_window(C);
1207 bScreen *screen = CTX_wm_screen(C);
1208 ScrArea *area = CTX_wm_area(C);
1209
1210 if (win && screen && area) {
1211 AZone *az = ED_area_actionzone_find_xy(area, win->eventstate->xy);
1212
1213 if (az && az->type == AZONE_REGION) {
1214 return 1;
1215 }
1216
1217 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
1218 if (region == screen->active_region) {
1219 return 1;
1220 }
1221 }
1222 }
1223 return 0;
1224}
1225
1231 const rcti *rect,
1232 eSpace_Type space_type)
1233{
1234 ScrVert *bottom_left = screen_geom_vertex_add_ex(area_map, rect->xmin, rect->ymin);
1235 ScrVert *top_left = screen_geom_vertex_add_ex(area_map, rect->xmin, rect->ymax);
1236 ScrVert *top_right = screen_geom_vertex_add_ex(area_map, rect->xmax, rect->ymax);
1237 ScrVert *bottom_right = screen_geom_vertex_add_ex(area_map, rect->xmax, rect->ymin);
1238
1239 screen_geom_edge_add_ex(area_map, bottom_left, top_left);
1240 screen_geom_edge_add_ex(area_map, top_left, top_right);
1241 screen_geom_edge_add_ex(area_map, top_right, bottom_right);
1242 screen_geom_edge_add_ex(area_map, bottom_right, bottom_left);
1243
1244 return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, space_type);
1245}
1246
1247static void screen_area_set_geometry_rect(ScrArea *area, const rcti *rect)
1248{
1249 area->v1->vec.x = rect->xmin;
1250 area->v1->vec.y = rect->ymin;
1251 area->v2->vec.x = rect->xmin;
1252 area->v2->vec.y = rect->ymax;
1253 area->v3->vec.x = rect->xmax;
1254 area->v3->vec.y = rect->ymax;
1255 area->v4->vec.x = rect->xmax;
1256 area->v4->vec.y = rect->ymin;
1257}
1258
1260 bScreen *screen,
1261 const eSpace_Type space_type,
1262 GlobalAreaAlign align,
1263 const rcti *rect,
1264 const short height_cur,
1265 const short height_min,
1266 const short height_max)
1267{
1268 /* Full-screens shouldn't have global areas. Don't touch them. */
1269 if (screen->state == SCREENFULL) {
1270 return;
1271 }
1272
1273 ScrArea *area = nullptr;
1274 LISTBASE_FOREACH (ScrArea *, area_iter, &win->global_areas.areabase) {
1275 if (area_iter->spacetype == space_type) {
1276 area = area_iter;
1277 break;
1278 }
1279 }
1280
1281 if (area) {
1283 }
1284 else {
1285 area = screen_area_create_with_geometry(&win->global_areas, rect, space_type);
1287
1288 /* Data specific to global areas. */
1289 area->global = MEM_callocN<ScrGlobalAreaData>(__func__);
1290 area->global->size_max = height_max;
1291 area->global->size_min = height_min;
1292 area->global->align = align;
1293 }
1294
1295 if (area->global->cur_fixed_height != height_cur) {
1296 /* Refresh layout if size changes. */
1297 area->global->cur_fixed_height = height_cur;
1298 screen->do_refresh = true;
1299 }
1300}
1301
1303{
1304 return int(ceilf(ED_area_headersize() / UI_SCALE_FAC));
1305}
1306
1308{
1309 const blender::int2 win_size = WM_window_native_pixel_size(win);
1310 const short size = screen_global_header_size();
1311 rcti rect;
1312
1313 BLI_rcti_init(&rect, 0, win_size[0] - 1, 0, win_size[1] - 1);
1314 rect.ymin = rect.ymax - size;
1315
1317 win, screen, SPACE_TOPBAR, GLOBAL_AREA_ALIGN_TOP, &rect, size, size, size);
1318}
1319
1321{
1322 const blender::int2 win_size = WM_window_native_pixel_size(win);
1323 const short size_min = 1;
1324 const short size_max = 0.85f * screen_global_header_size();
1325 const short size = (screen->flag & SCREEN_COLLAPSE_STATUSBAR) ? size_min : size_max;
1326 rcti rect;
1327
1328 BLI_rcti_init(&rect, 0, win_size[0] - 1, 0, win_size[1] - 1);
1329 rect.ymax = rect.ymin + size_max;
1330
1332 win, screen, SPACE_STATUSBAR, GLOBAL_AREA_ALIGN_BOTTOM, &rect, size, size_min, size_max);
1333}
1334
1336{
1337 /* Update screen flags from height in window, this is weak and perhaps
1338 * global areas should just become part of the screen instead. */
1340
1342
1344 if (area->global->cur_fixed_height == area->global->size_min) {
1345 if (area->spacetype == SPACE_STATUSBAR) {
1347 }
1348 }
1349 }
1350}
1351
1353{
1354 /* Don't create global area for child and temporary windows. */
1356 if (!WM_window_is_main_top_level(win)) {
1357 if (win->global_areas.areabase.first) {
1358 screen->do_refresh = true;
1360 }
1361 return;
1362 }
1363
1366}
1367
1368/* -------------------------------------------------------------------- */
1369/* Screen changing */
1370
1372 bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win)
1373{
1374 UNUSED_VARS_NDEBUG(bmain);
1375 BLI_assert(BLI_findindex(&bmain->screens, screen_new) != -1);
1376
1377 if (screen_old != screen_new) {
1378 wmTimer *wt = screen_old->animtimer;
1379
1380 /* Remove popup handlers (menus), while unlikely, it's possible an "error"
1381 * popup is displayed when switching screens.
1382 * Ideally popups from reported errors would remain so the error isn't hidden from the user.
1383 * On the other hand this is a rare occurrence, script developers will often show errors
1384 * in a console too, so it's not such a priority to relocate these to the new screen.
1385 * See: #144958. */
1387
1388 /* remove handlers referencing areas in old screen */
1389 LISTBASE_FOREACH (ScrArea *, area, &screen_old->areabase) {
1391 }
1392
1393 /* we put timer to sleep, so screen_exit has to think there's no timer */
1394 screen_old->animtimer = nullptr;
1395 if (wt) {
1396 WM_event_timer_sleep(CTX_wm_manager(C), win, wt, true);
1397 }
1398 ED_screen_exit(C, win, screen_old);
1399
1400 /* Same scene, "transfer" playback to new screen. */
1401 if (wt) {
1402 screen_new->animtimer = wt;
1403 }
1404 }
1405}
1406
1408{
1409 Scene *scene = WM_window_get_active_scene(win);
1411 WorkSpaceLayout *layout = BKE_workspace_layout_find(workspace, screen);
1412
1413 CTX_wm_window_set(C, win); /* stores C->wm.screen... hrmf */
1414
1416
1417 BKE_screen_view3d_scene_sync(screen, scene); /* sync new screen with scene data */
1420
1421 /* Makes button highlights work. */
1423}
1424
1426{
1427 Main *bmain = CTX_data_main(C);
1428 wmWindow *win = CTX_wm_window(C);
1430 WorkSpaceLayout *layout = BKE_workspace_layout_find(workspace, screen);
1431 bScreen *screen_old = CTX_wm_screen(C);
1432
1433 /* Get the actual layout/screen to be activated (guaranteed to be unused, even if that means
1434 * having to duplicate an existing one). */
1436 bmain, workspace, layout, layout, win);
1437 bScreen *screen_new = BKE_workspace_layout_screen_get(layout_new);
1438
1439 screen_change_prepare(screen_old, screen_new, bmain, C, win);
1440
1441 if (screen_old != screen_new) {
1442 WM_window_set_active_screen(win, workspace, screen_new);
1443 screen_change_update(C, win, screen_new);
1444
1445 return true;
1446 }
1447
1448 return false;
1449}
1450
1452 ViewLayer *view_layer,
1453 ScrArea *area,
1454 View3D *v3d)
1455{
1456 /* Fix any cameras that are used in the 3d view but not in the scene. */
1457 BKE_screen_view3d_sync(v3d, scene);
1458
1459 BKE_view_layer_synced_ensure(scene, view_layer);
1460 if (!v3d->camera || !BKE_view_layer_base_find(view_layer, v3d->camera)) {
1461 v3d->camera = BKE_view_layer_camera_find(scene, view_layer);
1462 }
1463 ListBase *regionbase;
1464
1465 /* regionbase is in different place depending if space is active. */
1466 if (v3d == area->spacedata.first) {
1467 regionbase = &area->regionbase;
1468 }
1469 else {
1470 regionbase = &v3d->regionbase;
1471 }
1472
1473 LISTBASE_FOREACH (ARegion *, region, regionbase) {
1474 if (region->regiontype != RGN_TYPE_WINDOW) {
1475 continue;
1476 }
1477 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
1478 /* Keep the information about RV3D_CAMOB even when no camera can be found.
1479 * This prevents jumping off the camera view while scrubbing through the
1480 * Sequencer with some Scene strips without scene. */
1481 if (!v3d->camera) {
1482 if (rv3d->persp == RV3D_CAMOB) {
1483 rv3d->persp = RV3D_PERSP;
1484 rv3d->rflag |= RV3D_WAS_CAMOB;
1485 }
1486 }
1487 else if ((rv3d->rflag & RV3D_WAS_CAMOB) != 0) {
1488 rv3d->persp = RV3D_CAMOB;
1489 rv3d->rflag &= ~RV3D_WAS_CAMOB;
1490 }
1491 }
1492}
1493
1495 wmWindow *win,
1496 Scene *scene,
1497 const bool refresh_toolsystem)
1498{
1499#if 0
1500 ViewLayer *view_layer_old = WM_window_get_active_view_layer(win);
1501#endif
1502
1503 /* Switch scene. */
1504 win->scene = scene;
1505 if (CTX_wm_window(C) == win) {
1506 CTX_data_scene_set(C, scene);
1507 }
1508
1509 /* Ensure the view layer name is updated. */
1511 ViewLayer *view_layer = WM_window_get_active_view_layer(win);
1512
1513#if 0
1514 /* Mode Syncing. */
1515 if (view_layer_old) {
1516 WorkSpace *workspace = CTX_wm_workspace(C);
1517 Object *obact_new = BKE_view_layer_active_object_get(view_layer);
1518 UNUSED_VARS(obact_new);
1519 eObjectMode object_mode_old = workspace->object_mode;
1520 Object *obact_old = BKE_view_layer_active_object_get(view_layer_old);
1521 UNUSED_VARS(obact_old, object_mode_old);
1522 }
1523#endif
1524
1525 /* Update 3D view cameras. */
1526 const bScreen *screen = WM_window_get_active_screen(win);
1527 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1528 LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
1529 if (sl->spacetype == SPACE_VIEW3D) {
1530 View3D *v3d = (View3D *)sl;
1531 screen_set_3dview_camera(scene, view_layer, area, v3d);
1532 }
1533 }
1534 }
1535
1536 if (refresh_toolsystem) {
1538 }
1539}
1540
1542{
1543 bScreen *newscreen = nullptr;
1544 ScrArea *newsa = nullptr;
1545 SpaceLink *newsl;
1546
1547 if (!area || area->full == nullptr) {
1549 newsa = static_cast<ScrArea *>(newscreen->areabase.first);
1550 BLI_assert(newsa->spacetype == SPACE_EMPTY);
1551 }
1552
1553 if (!newsa) {
1554 newsa = area;
1555 }
1556
1557 BLI_assert(newsa);
1558 newsl = static_cast<SpaceLink *>(newsa->spacedata.first);
1559
1560 /* Tag the active space before changing, so we can identify it when user wants to go back. */
1561 if (newsl && (newsl->link_flag & SPACE_FLAG_TYPE_TEMPORARY) == 0) {
1563 }
1564
1565 ED_area_newspace(C, newsa, type, (newsl && newsl->link_flag & SPACE_FLAG_TYPE_TEMPORARY));
1566
1567 if (newscreen) {
1568 ED_screen_change(C, newscreen);
1569 }
1570
1571 return newsa;
1572}
1573
1575{
1576 BLI_assert(area->full);
1577
1578 if (area->flag & AREA_FLAG_STACKED_FULLSCREEN) {
1579 /* Stacked full-screen -> only go back to previous area and don't toggle out of full-screen. */
1580 ED_area_prevspace(C, area);
1581 }
1582 else {
1584 }
1585}
1586
1588{
1589 SpaceLink *sl = static_cast<SpaceLink *>(area->spacedata.first);
1590
1591 /* In case nether functions below run. */
1592 ED_area_tag_redraw(area);
1593
1595 ED_area_prevspace(C, area);
1596 }
1597
1598 if (area->full) {
1600 }
1601}
1602
1604{
1605 wmWindow *win = CTX_wm_window(C);
1606 SpaceLink *sl = static_cast<SpaceLink *>(area->spacedata.first);
1607 bScreen *screen = CTX_wm_screen(C);
1608 short state = (screen ? screen->state : short(SCREENMAXIMIZED));
1609
1610 /* If full-screen area has a temporary space (such as a file browser or full-screen render
1611 * overlaid on top of an existing setup) then return to the previous space. */
1612
1613 if (sl->next) {
1616 }
1617 else {
1618 ED_screen_state_toggle(C, win, area, state);
1619 }
1620 /* WARNING: 'area' may be freed */
1621 }
1622 /* otherwise just tile the area again */
1623 else {
1624 ED_screen_state_toggle(C, win, area, state);
1625 }
1626}
1627
1638 wmWindow *win,
1639 ScrArea *toggle_area,
1640 int state)
1641{
1642 Main *bmain = CTX_data_main(C);
1643 WorkSpace *workspace = WM_window_get_active_workspace(win);
1644
1645 /* change from SCREENNORMAL to new state */
1646 WorkSpaceLayout *layout_new;
1647 ScrArea *newa;
1648 char newname[MAX_ID_NAME - 2];
1649
1651
1652 bScreen *oldscreen = WM_window_get_active_screen(win);
1653
1654 oldscreen->state = state;
1655 SNPRINTF_UTF8(newname, "%s-%s", oldscreen->id.name + 2, "nonnormal");
1656
1657 layout_new = ED_workspace_layout_add(bmain, workspace, win, newname);
1658
1659 bScreen *screen = BKE_workspace_layout_screen_get(layout_new);
1660 screen->state = state;
1661 screen->redraws_flag = oldscreen->redraws_flag;
1662 screen->temp = oldscreen->temp;
1663 screen->flag = oldscreen->flag;
1664
1665 /* timer */
1666 screen->animtimer = oldscreen->animtimer;
1667 oldscreen->animtimer = nullptr;
1668
1669 newa = (ScrArea *)screen->areabase.first;
1670
1671 /* swap area */
1672 if (toggle_area) {
1673 ED_area_data_swap(newa, toggle_area);
1674 newa->flag = toggle_area->flag; /* mostly for AREA_FLAG_WASFULLSCREEN */
1675 }
1676
1677 if (state == SCREENFULL) {
1678 /* temporarily hide global areas */
1679 LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) {
1680 glob_area->global->flag |= GLOBAL_AREA_IS_HIDDEN;
1681 }
1682 /* temporarily hide the side panels/header */
1683 LISTBASE_FOREACH (ARegion *, region, &newa->regionbase) {
1684 region->flagfullscreen = region->flag;
1685
1686 if (ELEM(region->regiontype,
1696 {
1697 region->flag |= RGN_FLAG_HIDDEN;
1698 }
1699 }
1700
1701 /* Temporarily hide gizmos and overlays. */
1702 screen->fullscreen_flag = 0;
1703 if (newa->spacetype == SPACE_VIEW3D) {
1704 View3D *v3d = static_cast<View3D *>(newa->spacedata.first);
1705 if (v3d && !(v3d->gizmo_flag & V3D_GIZMO_HIDE_NAVIGATE)) {
1708 }
1709 if (v3d && !(v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT)) {
1712 }
1713 if (v3d && (v3d->overlay.flag & V3D_OVERLAY_STATS)) {
1716 }
1717 }
1718 else if (newa->spacetype == SPACE_CLIP) {
1719 SpaceClip *sc = static_cast<SpaceClip *>(newa->spacedata.first);
1720 if (sc && !(sc->gizmo_flag & SCLIP_GIZMO_HIDE_NAVIGATE)) {
1723 }
1724 }
1725 else if (newa->spacetype == SPACE_SEQ) {
1726 SpaceSeq *sseq = static_cast<SpaceSeq *>(newa->spacedata.first);
1727 if (sseq && !(sseq->gizmo_flag & SEQ_GIZMO_HIDE_NAVIGATE)) {
1730 }
1731 }
1732 else if (newa->spacetype == SPACE_IMAGE) {
1733 SpaceImage *sima = static_cast<SpaceImage *>(newa->spacedata.first);
1734 if (sima && !(sima->gizmo_flag & SI_GIZMO_HIDE_NAVIGATE)) {
1737 }
1738 }
1739 }
1740
1741 if (toggle_area) {
1742 toggle_area->full = oldscreen;
1743 }
1744 newa->full = oldscreen;
1745
1746 ED_area_tag_refresh(newa);
1747
1748 return screen;
1749}
1750
1755
1757{
1759 WorkSpace *workspace = WM_window_get_active_workspace(win);
1760
1761 if (area) {
1762 /* ensure we don't have a button active anymore, can crash when
1763 * switching screens with tooltip open because region and tooltip
1764 * are no longer in the same screen */
1765 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
1766 UI_blocklist_free(C, region);
1767 if (region->runtime->regiontimer) {
1768 WM_event_timer_remove(wm, nullptr, region->runtime->regiontimer);
1769 region->runtime->regiontimer = nullptr;
1770 }
1771 }
1772
1773 /* prevent hanging status prints */
1774 ED_area_status_text(area, nullptr);
1775 ED_workspace_status_text(C, nullptr);
1776 }
1777 bScreen *screen;
1778 if (area && area->full) {
1780 /* restoring back to SCREENNORMAL */
1781 screen = area->full; /* the old screen to restore */
1782 bScreen *oldscreen = WM_window_get_active_screen(win); /* the one disappearing */
1783
1784 BLI_assert(BKE_workspace_layout_screen_get(layout_old) != screen);
1786
1787 screen->state = SCREENNORMAL;
1788 screen->flag = oldscreen->flag;
1789 screen->fullscreen_flag = oldscreen->fullscreen_flag;
1790
1791 /* Find old area we may have swapped dummy space data to. It's swapped back here. */
1792 ScrArea *fullsa = nullptr;
1793 LISTBASE_FOREACH (ScrArea *, old, &screen->areabase) {
1794 /* area to restore from is always first */
1795 if (old->full && !fullsa) {
1796 fullsa = old;
1797 }
1798
1799 /* clear full screen state */
1800 old->full = nullptr;
1801 }
1802
1803 area->full = nullptr;
1804
1805 if (state == SCREENFULL) {
1806 /* unhide global areas */
1807 LISTBASE_FOREACH (ScrArea *, glob_area, &win->global_areas.areabase) {
1808 glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN;
1809 }
1810 /* restore the old side panels/header visibility */
1811 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
1812 region->flag = region->flagfullscreen;
1813 }
1814 /* Restore gizmos and overlays to their prior states. */
1815 if (area->spacetype == SPACE_VIEW3D) {
1816 View3D *v3d = static_cast<View3D *>(area->spacedata.first);
1817 if (v3d) {
1827 }
1828 }
1829 else if (area->spacetype == SPACE_CLIP) {
1830 SpaceClip *sc = static_cast<SpaceClip *>(area->spacedata.first);
1831 if (sc) {
1835 }
1836 }
1837 else if (area->spacetype == SPACE_SEQ) {
1838 SpaceSeq *sseq = static_cast<SpaceSeq *>(area->spacedata.first);
1839 if (sseq) {
1843 }
1844 }
1845 else if (area->spacetype == SPACE_IMAGE) {
1846 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1847 if (sima) {
1851 }
1852 }
1853 }
1854
1855 if (fullsa) {
1856 ED_area_data_swap(fullsa, area);
1857 ED_area_tag_refresh(fullsa);
1858 }
1859
1860 /* animtimer back */
1861 screen->animtimer = oldscreen->animtimer;
1862 oldscreen->animtimer = nullptr;
1863
1864 ED_screen_change(C, screen);
1865
1866 BKE_workspace_layout_remove(CTX_data_main(C), workspace, layout_old);
1867
1868 /* After we've restored back to SCREENNORMAL, we have to wait with
1869 * screen handling as it uses the area coords which aren't updated yet.
1870 * Without doing so, the screen handling gets wrong area coords,
1871 * which in worst case can lead to crashes (see #43139) */
1872 screen->skip_handling = true;
1873 }
1874 else {
1875 ScrArea *toggle_area = area;
1876
1877 /* use random area when we have no active one, e.g. when the
1878 * mouse is outside of the window and we open a file browser */
1879 if (!toggle_area || toggle_area->global) {
1880 bScreen *oldscreen = WM_window_get_active_screen(win);
1881 toggle_area = static_cast<ScrArea *>(oldscreen->areabase.first);
1882 }
1883
1884 screen = screen_state_to_nonnormal(C, win, toggle_area, state);
1885
1886 ED_screen_change(C, screen);
1887 }
1888
1889 BLI_assert(CTX_wm_screen(C) == screen);
1890 BLI_assert(CTX_wm_area(C) == nullptr); /* May have been freed. */
1891
1892 /* Setting the area is only needed for Python scripts that call
1893 * operators in succession before returning to the main event loop.
1894 * Without this, scripts can't run any operators that require
1895 * an area after toggling full-screen for example (see: #89526).
1896 * NOTE: an old comment stated this was "bad code",
1897 * however it doesn't cause problems so leave as-is. */
1898 CTX_wm_area_set(C, static_cast<ScrArea *>(screen->areabase.first));
1899
1900 return static_cast<ScrArea *>(screen->areabase.first);
1901}
1902
1904 bContext *C, const char *title, eSpace_Type space_type, int display_type, bool dialog)
1905{
1906 switch (display_type) {
1908 if (WM_window_open_temp(C, title, space_type, dialog)) {
1909 return CTX_wm_area(C);
1910 }
1911 break;
1913 bScreen *ctx_screen = CTX_wm_screen(C);
1914
1915 if (ctx_screen->state == SCREENMAXIMIZED) {
1916 /* Find the maximized area, check if it has the same type as the one we want to create. */
1917 LISTBASE_FOREACH (ScrArea *, screen_area, &ctx_screen->areabase) {
1918 if (screen_area->full && screen_area->spacetype == space_type) {
1919 /* Return the existing area instead of recreating an area on top, which would make the
1920 * "Back to Previous" button seem ineffective. */
1921 return screen_area;
1922 }
1923 }
1924 }
1925
1926 ScrArea *ctx_area = CTX_wm_area(C);
1927
1928 /* The current area is already fullscreen, stack the new area on top of it. */
1929 if (ctx_area != nullptr && ctx_area->full) {
1930 ScrArea *area = ctx_area;
1931 ED_area_newspace(C, ctx_area, space_type, true);
1933 ((SpaceLink *)area->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY;
1934 return area;
1935 }
1936
1937 /* Create a new fullscreen area. */
1938 ScrArea *area = ED_screen_full_newspace(C, ctx_area, int(space_type));
1939 ((SpaceLink *)area->spacedata.first)->link_flag |= SPACE_FLAG_TYPE_TEMPORARY;
1940 return area;
1941 }
1942 }
1943
1944 return nullptr;
1945}
1946
1948 bContext *C, Scene *scene, ViewLayer *view_layer, int redraws, int sync, int enable)
1949{
1950 bScreen *screen = CTX_wm_screen(C);
1952 wmWindow *win = CTX_wm_window(C);
1953 bScreen *stopscreen = ED_screen_animation_playing(wm);
1954
1955 if (stopscreen) {
1956 WM_event_timer_remove(wm, win, stopscreen->animtimer);
1957 stopscreen->animtimer = nullptr;
1958 }
1959
1960 if (enable) {
1961 ScreenAnimData *sad = MEM_callocN<ScreenAnimData>("ScreenAnimData");
1962
1963 screen->animtimer = WM_event_timer_add(wm, win, TIMER0, (1.0 / scene->frames_per_second()));
1964
1965 sad->region = CTX_wm_region(C);
1966 sad->scene = scene;
1967 sad->view_layer = view_layer;
1968
1970
1971 sad->sfra = scene->r.cfra;
1972 /* Make sure that were are inside the scene or preview frame range. */
1973 CLAMP(scene->r.cfra, PSFRA, PEFRA);
1974 if (scene->r.cfra != sad->sfra) {
1975 sad->flag |= ANIMPLAY_FLAG_JUMPED;
1976 }
1977
1978 if (sad->flag & ANIMPLAY_FLAG_JUMPED) {
1980 }
1981
1982 sad->redraws = redraws;
1983 sad->flag |= (enable < 0) ? ANIMPLAY_FLAG_REVERSE : 0;
1984 sad->flag |= (sync == 0) ? ANIMPLAY_FLAG_NO_SYNC : (sync == 1) ? ANIMPLAY_FLAG_SYNC : 0;
1985
1986 ScrArea *area = CTX_wm_area(C);
1987
1988 char spacetype = -1;
1989
1990 if (area) {
1991 spacetype = area->spacetype;
1992 }
1993
1995
1996 screen->animtimer->customdata = sad;
1997 }
1998
1999 /* Notifier caught by top header, for button. */
2001}
2002
2003/* helper for screen_animation_play() - only to be used for TimeLine */
2005{
2006 ARegion *region_top_left = nullptr;
2007 int min = 10000;
2008
2009 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2010 if (area->spacetype == SPACE_VIEW3D) {
2011 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
2012 if (region->regiontype == RGN_TYPE_WINDOW) {
2013 if (region->winrct.xmin - region->winrct.ymin < min) {
2014 region_top_left = region;
2015 min = region->winrct.xmin - region->winrct.ymin;
2016 }
2017 }
2018 }
2019 }
2020 }
2021
2022 return region_top_left;
2023}
2024
2026{
2027 if (screen && screen->animtimer) {
2028 wmTimer *wt = screen->animtimer;
2029 ScreenAnimData *sad = static_cast<ScreenAnimData *>(wt->customdata);
2030
2031 sad->redraws = redraws;
2032 sad->region = nullptr;
2033 if (redraws & TIME_REGION) {
2034 sad->region = time_top_left_3dwindow(screen);
2035 }
2036 }
2037}
2038
2039void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
2040{
2042
2043 DEG_time_tag_update(bmain);
2044
2045 void *camera = BKE_scene_camera_switch_find(scene);
2046 if (camera && scene->camera != camera) {
2047 scene->camera = static_cast<Object *>(camera);
2048 /* are there cameras in the views that are not in the scene? */
2049 LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
2050 BKE_screen_view3d_scene_sync(screen, scene);
2051 }
2053 }
2054
2055 ED_clip_update_frame(bmain, scene->r.cfra);
2056
2057 /* this function applies the changes too */
2059}
2060
2061bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene)
2062{
2063 const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0;
2064
2065 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2066 switch (area->spacetype) {
2067 case SPACE_VIEW3D: {
2068 View3D *v3d;
2069
2070 if (!is_multiview) {
2071 continue;
2072 }
2073
2074 v3d = static_cast<View3D *>(area->spacedata.first);
2075 if (v3d->camera && v3d->stereo3d_camera == STEREO_3D_ID) {
2076 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
2077 if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) {
2078 RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
2079 if (rv3d->persp == RV3D_CAMOB) {
2080 return true;
2081 }
2082 }
2083 }
2084 }
2085 break;
2086 }
2087 case SPACE_IMAGE: {
2088 SpaceImage *sima;
2089
2090 /* images should always show in stereo, even if
2091 * the file doesn't have views enabled */
2092 sima = static_cast<SpaceImage *>(area->spacedata.first);
2093 if (sima->image && BKE_image_is_stereo(sima->image) &&
2094 (sima->iuser.flag & IMA_SHOW_STEREO))
2095 {
2096 return true;
2097 }
2098 break;
2099 }
2100 case SPACE_NODE: {
2101 SpaceNode *snode;
2102
2103 if (!is_multiview) {
2104 continue;
2105 }
2106
2107 snode = static_cast<SpaceNode *>(area->spacedata.first);
2108 if ((snode->flag & SNODE_BACKDRAW) && ED_node_is_compositor(snode)) {
2109 return true;
2110 }
2111 break;
2112 }
2113 case SPACE_SEQ: {
2114 SpaceSeq *sseq;
2115
2116 if (!is_multiview) {
2117 continue;
2118 }
2119
2120 sseq = static_cast<SpaceSeq *>(area->spacedata.first);
2122 return true;
2123 }
2124
2125 break;
2126 }
2127 }
2128 }
2129
2130 return false;
2131}
2132
2134 const wmWindowManager *wm,
2135 wmWindow **r_window)
2136{
2137 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
2138 if (WM_window_get_active_screen(win) == screen) {
2139 if (r_window) {
2140 *r_window = win;
2141 }
2142 return WM_window_get_active_scene(win);
2143 }
2144 }
2145
2146 /* Can by nullptr when accessing a screen that isn't active. */
2147 return nullptr;
2148}
2149
2151 const SpaceLink *sl,
2152 const bool only_visible)
2153{
2154 if (only_visible) {
2155 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2156 if (area->spacedata.first == sl) {
2157 return area;
2158 }
2159 }
2160 }
2161 else {
2162 LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2163 if (BLI_findindex(&area->spacedata, sl) != -1) {
2164 return area;
2165 }
2166 }
2167 }
2168 return nullptr;
2169}
2170
2172{
2173 return ED_screen_scene_find_with_window(screen, wm, nullptr);
2174}
2175
2177{
2178 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
2179 if (WM_window_get_active_screen(win) == screen) {
2180 return win;
2181 }
2182 }
2183 return nullptr;
2184}
WorkSpace * CTX_wm_workspace(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void CTX_wm_screen_set(bContext *C, bScreen *screen)
void CTX_data_scene_set(bContext *C, Scene *scene)
void CTX_wm_window_set(bContext *C, wmWindow *win)
Main * CTX_data_main(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
@ G_DEBUG_EVENTS
void BKE_icon_changed(int icon_id)
Definition icons.cc:204
bool BKE_image_is_stereo(const Image *ima)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_camera_find(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
Definition lib_id.cc:1447
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
Object * BKE_scene_camera_switch_find(Scene *scene)
Definition scene.cc:2224
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
Definition scene.cc:2700
void BKE_screen_remove_unused_scredges(bScreen *screen)
Definition screen.cc:765
void BKE_screen_remove_double_scrverts(bScreen *screen)
Definition screen.cc:697
void BKE_screen_sort_scrvert(ScrVert **v1, ScrVert **v2)
Definition screen.cc:688
void BKE_screen_area_free(ScrArea *area)
Definition screen.cc:638
void BKE_screen_area_map_free(ScrAreaMap *area_map) ATTR_NONNULL()
Definition screen.cc:654
SpaceType * BKE_spacetype_from_id(int spaceid)
Definition screen.cc:257
void BKE_screen_header_alignment_reset(bScreen *screen)
Definition screen.cc:1059
void BKE_area_region_free(SpaceType *st, ARegion *region)
Definition screen.cc:597
void BKE_screen_view3d_scene_sync(bScreen *screen, Scene *scene)
Definition screen.cc:1004
void BKE_screen_remove_double_scredges(bScreen *screen)
Definition screen.cc:749
void BKE_screen_view3d_sync(View3D *v3d, Scene *scene)
Definition screen.cc:986
void BKE_screen_free_data(bScreen *screen)
Definition screen.cc:665
void BKE_sound_stop_scene(struct Scene *scene)
WorkSpaceLayout * BKE_workspace_layout_find(const WorkSpace *workspace, const bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
Definition workspace.cc:429
bScreen * BKE_workspace_layout_screen_get(const WorkSpaceLayout *layout) GETTER_ATTRS
Definition workspace.cc:639
void BKE_workspace_layout_remove(Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout) ATTR_NONNULL()
Definition workspace.cc:399
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition workspace.cc:614
WorkSpace * BKE_workspace_active_get(WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition workspace.cc:563
void BKE_workspace_active_set(WorkSpaceInstanceHook *hook, WorkSpace *workspace) SETTER_ATTRS
Definition workspace.cc:567
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:270
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:91
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
#define BLI_SCOPED_DEFER(function_to_defer)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition rct.cc:414
#define SNPRINTF_UTF8(dst, format,...)
#define CLAMP(a, b, c)
#define UNUSED_VARS(...)
#define UNUSED_VARS_NDEBUG(...)
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_time_tag_update(Main *bmain)
Scene * DEG_get_input_scene(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ ID_RECALC_PARAMETERS
Definition DNA_ID.h:1138
@ ID_RECALC_FRAME_CHANGE
Definition DNA_ID.h:1125
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
#define MAX_ID_NAME
Definition DNA_ID.h:373
@ ID_SCR
@ IMA_SHOW_STEREO
eObjectMode
Object is a sort of wrapper for general info.
#define PSFRA
@ STEREO_3D_ID
@ R_MULTIVIEW
#define PEFRA
@ AREA_FLAG_STACKED_FULLSCREEN
#define AREAMAP_FROM_SCREEN(screen)
@ GLOBAL_AREA_IS_HIDDEN
@ SCREENFULL
@ SCREENMAXIMIZED
@ SCREENNORMAL
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_EXECUTE
@ RGN_TYPE_UI
@ RGN_TYPE_TEMPORARY
@ RGN_TYPE_ASSET_SHELF_HEADER
@ RGN_TYPE_WINDOW
@ RGN_TYPE_ASSET_SHELF
@ RGN_TYPE_NAV_BAR
@ RGN_TYPE_FOOTER
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ SCREEN_COLLAPSE_STATUSBAR
@ RGN_FLAG_HIDDEN
@ RGN_FLAG_POLL_FAILED
@ FULLSCREEN_RESTORE_STATS
@ FULLSCREEN_RESTORE_GIZMO_NAVIGATE
@ FULLSCREEN_RESTORE_TEXT
@ TIME_REGION
@ TIME_ALL_3D_WIN
@ TIME_ALL_ANIM_WIN
GlobalAreaAlign
@ GLOBAL_AREA_ALIGN_BOTTOM
@ GLOBAL_AREA_ALIGN_TOP
@ SNODE_BACKDRAW
@ SI_GIZMO_HIDE_NAVIGATE
@ SPACE_FLAG_TYPE_WAS_ACTIVE
@ SPACE_FLAG_TYPE_TEMPORARY
eSpace_Type
@ SPACE_CLIP
@ SPACE_ACTION
@ SPACE_STATUSBAR
@ SPACE_TOPBAR
@ SPACE_NODE
@ SPACE_NLA
@ SPACE_SEQ
@ SPACE_EMPTY
@ SPACE_IMAGE
@ SPACE_GRAPH
@ SPACE_VIEW3D
@ SEQ_VIEW_SEQUENCE_PREVIEW
@ SEQ_VIEW_PREVIEW
@ SCLIP_GIZMO_HIDE_NAVIGATE
@ SEQ_GIZMO_HIDE_NAVIGATE
#define UI_SCALE_FAC
@ USER_HEADER_FROM_PREF
@ USER_TEMP_SPACE_DISPLAY_FULLSCREEN
@ USER_TEMP_SPACE_DISPLAY_WINDOW
@ V2D_IS_INIT
@ V3D_GIZMO_HIDE_NAVIGATE
@ RV3D_WAS_CAMOB
@ RV3D_CAMOB
@ RV3D_PERSP
@ V3D_OVERLAY_HIDE_TEXT
@ V3D_OVERLAY_STATS
void ED_clip_update_frame(const Main *mainp, int cfra)
bool ED_node_is_compositor(const SpaceNode *snode)
Definition node_edit.cc:487
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:693
void ED_area_init(bContext *C, const wmWindow *win, ScrArea *area)
Definition area.cc:2140
void ED_area_newspace(bContext *C, ScrArea *area, int type, bool skip_region_exit)
Definition area.cc:2699
WorkSpaceLayout * ED_workspace_layout_add(Main *bmain, WorkSpace *workspace, wmWindow *win, const char *name) ATTR_NONNULL()
void ED_region_cursor_set(wmWindow *win, ScrArea *area, ARegion *region)
Definition area.cc:2311
#define ED_screen_verts_iter(win, screen, vert_name)
Definition ED_screen.hh:299
void ED_area_and_region_types_init(ScrArea *area)
Definition area.cc:2123
bool ED_region_contains_xy(const ARegion *region, const int event_xy[2])
#define ED_screen_areas_iter(win, screen, area_name)
Definition ED_screen.hh:296
void ED_area_status_text(ScrArea *area, const char *str)
Definition area.cc:851
void ED_region_tag_redraw_no_rebuild(ARegion *region)
Definition area.cc:638
int ED_area_headersize()
Definition area.cc:3956
WorkSpaceLayout * ED_workspace_screen_change_ensure_unused_layout(Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout_new, const WorkSpaceLayout *layout_fallback_base, wmWindow *win) ATTR_NONNULL()
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
void ED_area_tag_refresh(ScrArea *area)
Definition area.cc:722
AZone * ED_area_azones_update(ScrArea *area, const int mouse_xy[2])
void ED_workspace_status_text(bContext *C, const char *str)
Definition area.cc:1024
void ED_region_visibility_change_update_ex(bContext *C, ScrArea *area, ARegion *region, bool is_hidden, bool do_init)
Definition area.cc:2332
void ED_area_prevspace(bContext *C, ScrArea *area)
Definition area.cc:2866
@ ANIMPLAY_FLAG_JUMPED
@ ANIMPLAY_FLAG_NO_SYNC
@ ANIMPLAY_FLAG_REVERSE
@ ANIMPLAY_FLAG_SYNC
@ AZONE_REGION
@ AZONE_REGION_SCROLL
@ AZONE_AREA
@ AE_LEFT_TO_TOPRIGHT
@ AE_RIGHT_TO_TOPLEFT
static void split(const char *text, const char *seps, char ***str, int *count)
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
#define C
Definition RandGen.cpp:29
void UI_panel_stop_animation(const bContext *C, Panel *panel)
void UI_blocklist_free(const bContext *C, ARegion *region)
void UI_screen_free_active_but_highlight(const bContext *C, bScreen *screen)
void UI_popup_handlers_remove_all(bContext *C, ListBase *handlers)
@ WM_CAPABILITY_WINDOW_DECORATION_STYLES
Definition WM_api.hh:203
#define NC_WINDOW
Definition WM_types.hh:375
#define ND_FILEREAD
Definition WM_types.hh:412
#define NC_WM
Definition WM_types.hh:374
#define NC_SCREEN
Definition WM_types.hh:377
#define ND_MODE
Definition WM_types.hh:445
#define ND_ANIMPLAY
Definition WM_types.hh:424
#define NC_SCENE
Definition WM_types.hh:378
#define NA_EDITED
Definition WM_types.hh:584
#define ND_LAYOUTSET
Definition WM_types.hh:426
void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free)
Definition area.cc:2378
void ED_area_data_swap(ScrArea *area_dst, ScrArea *area_src)
Definition area.cc:2411
#define U
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
nullptr float
uint top
#define printf(...)
#define abs
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds &cone_b)
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
static ulong state[N]
static int left
#define G(x, y, z)
bool is_scene_time_sync_needed(const bContext &C)
VecBase< int32_t, 2 > int2
const char * name
#define ceilf
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
const EnumPropertyItem rna_enum_space_type_items[]
Definition rna_space.cc:73
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
void screen_animate_area_highlight(wmWindow *win, bScreen *screen, const rcti *rect, float inner[4], float outline[4], float seconds)
int ED_area_icon(const ScrArea *area)
void ED_screen_global_areas_sync(wmWindow *win)
void ED_screen_animation_timer(bContext *C, Scene *scene, ViewLayer *view_layer, int redraws, int sync, int enable)
ScrArea * ED_screen_temp_space_open(bContext *C, const char *title, eSpace_Type space_type, int display_type, bool dialog)
static ScrArea * screen_addarea_ex(ScrAreaMap *area_map, ScrVert *bottom_left, ScrVert *top_left, ScrVert *top_right, ScrVert *bottom_right, const eSpace_Type space_type)
int ED_screen_area_active(const bContext *C)
bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene)
wmWindow * ED_screen_window_find(const bScreen *screen, const wmWindowManager *wm)
static void screen_global_area_refresh(wmWindow *win, bScreen *screen, const eSpace_Type space_type, GlobalAreaAlign align, const rcti *rect, const short height_cur, const short height_min, const short height_max)
static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrArea *area, View3D *v3d)
Scene * ED_screen_scene_find(const bScreen *screen, const wmWindowManager *wm)
static void screen_refresh_if_needed(bContext *C, wmWindowManager *wm, wmWindow *win)
static void screen_area_set_geometry_rect(ScrArea *area, const rcti *rect)
void screen_change_prepare(bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win)
static bool screen_areas_can_align(ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2, eScreenDir dir)
static ScrArea * screen_area_create_with_geometry(ScrAreaMap *area_map, const rcti *rect, eSpace_Type space_type)
bool area_regions_poll(bContext *C, const bScreen *screen, ScrArea *area)
void ED_screen_ensure_updated(bContext *C, wmWindowManager *wm, wmWindow *win)
void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new)
ScrArea * ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const short state)
ScrArea * ED_screen_area_find_with_spacedata(const bScreen *screen, const SpaceLink *sl, const bool only_visible)
void area_getoffsets(ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2)
static void region_cursor_set(wmWindow *win, bool swin_changed)
void ED_screen_refresh(bContext *C, wmWindowManager *wm, wmWindow *win)
void ED_screen_full_restore(bContext *C, ScrArea *area)
static void screen_verts_halign(const wmWindow *win, const bScreen *screen, const short from_x, const short to_x)
static bool region_poll(const bContext *C, const bScreen *screen, const ScrArea *area, const ARegion *region)
eScreenDir area_getorientation(ScrArea *sa_a, ScrArea *sa_b)
ScrArea * ED_screen_full_newspace(bContext *C, ScrArea *area, int type)
static void screen_global_statusbar_area_refresh(wmWindow *win, bScreen *screen)
void ED_screen_do_listen(bContext *C, const wmNotifier *note)
void ED_screens_init(bContext *C, Main *bmain, wmWindowManager *wm)
static void screen_delarea(bContext *C, bScreen *screen, ScrArea *area)
bool screen_area_close(bContext *C, ReportList *reports, bScreen *screen, ScrArea *area)
void ED_screen_global_areas_refresh(wmWindow *win)
bool ED_screen_change(bContext *C, bScreen *screen)
Change the active screen.
bScreen * ED_screen_state_maximized_create(bContext *C)
void ED_screen_restore_temp_type(bContext *C, ScrArea *area)
ScrArea * area_split(const wmWindow *win, bScreen *screen, ScrArea *area, const eScreenAxis dir_axis, const float fac, const bool merge)
void screen_change_update(bContext *C, wmWindow *win, bScreen *screen)
static void screen_verts_valign(const wmWindow *win, const bScreen *screen, const short from_y, const short to_y)
static bool screen_area_join_aligned(bContext *C, ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
static bool screen_area_join_ex(bContext *C, ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2, bool close_all_remainders)
void ED_area_exit(bContext *C, ScrArea *area)
static ScrArea * screen_addarea(bScreen *screen, ScrVert *left_bottom, ScrVert *left_top, ScrVert *right_top, ScrVert *right_bottom, const eSpace_Type space_type)
static void screen_global_topbar_area_refresh(wmWindow *win, bScreen *screen)
static bScreen * screen_state_to_nonnormal(bContext *C, wmWindow *win, ScrArea *toggle_area, int state)
void ED_screen_animation_timer_update(bScreen *screen, int redraws)
void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
blender::StringRefNull ED_area_name(const ScrArea *area)
void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
static void screen_cursor_set(wmWindow *win, const int xy[2])
static bool screen_areas_align(bContext *C, ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2, const eScreenDir dir)
void screen_data_copy(bScreen *to, bScreen *from)
static bool screen_regions_poll(bContext *C, wmWindow *win, const bScreen *screen)
void ED_screen_scene_change(bContext *C, wmWindow *win, Scene *scene, const bool refresh_toolsystem)
static ScrArea * screen_area_trim(bContext *C, bScreen *screen, ScrArea **area, int size, eScreenDir dir, bool reverse)
static ARegion * time_top_left_3dwindow(bScreen *screen)
void ED_region_remove(bContext *C, ScrArea *area, ARegion *region)
static int screen_global_header_size()
bScreen * screen_add(Main *bmain, const char *name, const rcti *rect)
void ED_region_exit(bContext *C, ARegion *region)
static void region_cursor_set_ex(wmWindow *win, ScrArea *area, ARegion *region, bool swin_changed)
void ED_screen_full_prevspace(bContext *C, ScrArea *area)
Scene * ED_screen_scene_find_with_window(const bScreen *screen, const wmWindowManager *wm, wmWindow **r_window)
int screen_area_join(bContext *C, ReportList *reports, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
void screen_area_spacelink_add(const Scene *scene, ScrArea *area, eSpace_Type space_type)
ScrVert * screen_geom_vertex_add(bScreen *screen, short x, short y)
ScrEdge * screen_geom_edge_add_ex(ScrAreaMap *area_map, ScrVert *v1, ScrVert *v2)
ScrVert * screen_geom_vertex_add_ex(ScrAreaMap *area_map, short x, short y)
ScrEdge * screen_geom_find_active_scredge(const wmWindow *win, const bScreen *screen, const int mx, const int my)
ScrEdge * screen_geom_edge_add(bScreen *screen, ScrVert *v1, ScrVert *v2)
bool screen_geom_edge_is_horizontal(ScrEdge *se)
void screen_geom_vertices_scale(const wmWindow *win, bScreen *screen)
Main screen-layout calculation function.
short screen_geom_find_area_split_point(const ScrArea *area, const rcti *window_rect, const eScreenAxis dir_axis, float fac)
#define SCREEN_DIR_IS_HORIZONTAL(dir)
#define BORDERPADDING
AZone * ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
eScreenAxis
@ SCREEN_AXIS_V
@ SCREEN_AXIS_H
#define SCREEN_DIR_IS_VERTICAL(dir)
#define AREAJOINTOLERANCEX
eScreenDir
@ SCREEN_DIR_W
@ SCREEN_DIR_N
@ SCREEN_DIR_E
@ SCREEN_DIR_S
@ SCREEN_DIR_NONE
#define AREA_CLOSE_FADEOUT
#define AREAJOINTOLERANCEY
#define min(a, b)
Definition sort.cc:36
ARegionRuntimeHandle * runtime
ListBase panels
AZEdge edge
const char * name
Definition RNA_types.hh:661
char name[258]
Definition DNA_ID.h:432
int icon_id
Definition DNA_ID.h:444
void * first
ListBase screens
Definition BKE_main.hh:292
ListBase workspaces
Definition BKE_main.hh:315
struct RenderData r
struct Object * camera
ListBase areabase
ListBase handlers
ScrVert * v2
ScrVert * v3
ListBase spacedata
struct SpaceType * type
bScreen * full
ScrVert * v1
struct ScrArea * next
ListBase regionbase
ScrGlobalAreaData * global
ScrVert * v4
struct ScrVert * next
struct ScrVert * newv
ViewLayer * view_layer
struct ImageUser iuser
struct Image * image
SpaceLink *(* create)(const ScrArea *area, const Scene *scene)
Definition BKE_screen.hh:93
int(* space_icon_get)(const ScrArea *area)
void(* exit)(wmWindowManager *wm, ScrArea *area)
blender::StringRefNull(* space_name_get)(const ScrArea *area)
View3DOverlay overlay
struct Object * camera
char stereo3d_camera
ListBase regionbase
Wrapper for bScreen.
ListBase edgebase
short redraws_flag
ListBase regionbase
char skip_handling
ListBase vertbase
struct wmTimer * animtimer
short fullscreen_flag
ListBase areabase
struct ARegion * active_region
int ymin
int ymax
int xmin
int xmax
short y
short x
int xy[2]
Definition WM_types.hh:761
unsigned int data
Definition WM_types.hh:358
unsigned int action
Definition WM_types.hh:358
unsigned int category
Definition WM_types.hh:358
void * customdata
Definition WM_types.hh:965
WindowManagerRuntimeHandle * runtime
struct wmEvent * eventstate
struct Scene * scene
ScrAreaMap global_areas
struct WorkSpaceInstanceHook * workspace_hook
void WM_cursor_set(wmWindow *win, int curs)
@ WM_CURSOR_DEFAULT
Definition wm_cursors.hh:15
@ WM_CURSOR_Y_MOVE
Definition wm_cursors.hh:40
@ WM_CURSOR_EDIT
Definition wm_cursors.hh:19
@ WM_CURSOR_X_MOVE
Definition wm_cursors.hh:39
int xy[2]
Definition wm_draw.cc:178
void WM_draw_region_free(ARegion *region)
Definition wm_draw.cc:1677
bool WM_cursor_test_motion_and_update(const int mval[2])
void WM_window_status_area_tag_redraw(wmWindow *win)
void WM_event_modal_handler_region_replace(wmWindow *win, const ARegion *old_region, ARegion *new_region)
void WM_event_modal_handler_area_replace(wmWindow *win, const ScrArea *old_area, ScrArea *new_area)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_event_ui_handler_region_popup_replace(wmWindow *win, const ARegion *old_region, ARegion *new_region)
void WM_event_remove_handlers_by_area(ListBase *handlers, const ScrArea *area)
void WM_event_remove_handlers(bContext *C, ListBase *handlers)
void WM_event_add_mousemove(wmWindow *win)
@ TIMER0
bool WM_gizmo_highlight_set(wmGizmoMap *gzmap, wmGizmo *gz)
Definition wm_gizmo.cc:405
void WM_msgbus_clear_by_owner(wmMsgBus *mbus, void *owner)
void WM_toolsystem_refresh_screen_window(wmWindow *win)
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
void WM_window_ensure_active_view_layer(wmWindow *win)
bool WM_window_is_main_top_level(const wmWindow *win)
wmWindow * WM_window_open_temp(bContext *C, const char *title, int space_type, bool dialog)
WorkSpaceLayout * WM_window_get_active_layout(const wmWindow *win)
void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *, wmTimer *timer, bool do_sleep)
void WM_window_dpi_set_userdef(const wmWindow *win)
Definition wm_window.cc:654
void WM_window_set_active_screen(wmWindow *win, WorkSpace *workspace, bScreen *screen)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
bool WM_window_is_temp_screen(const wmWindow *win)
void WM_window_rect_calc(const wmWindow *win, rcti *r_rect)
eWM_CapabilitiesFlag WM_capabilities_flag()
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Scene * WM_window_get_active_scene(const wmWindow *win)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)
void WM_window_decoration_style_apply(const wmWindow *win, const bScreen *screen)
Definition wm_window.cc:776