Blender  V3.3
wm_window.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. 2007 Blender Foundation. */
3 
10 #include <math.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 
15 #include "DNA_listBase.h"
16 #include "DNA_screen_types.h"
18 #include "DNA_workspace_types.h"
19 
20 #include "MEM_guardedalloc.h"
21 
22 #include "GHOST_C-api.h"
23 
24 #include "BLI_blenlib.h"
25 #include "BLI_math.h"
26 #include "BLI_system.h"
27 #include "BLI_utildefines.h"
28 
29 #include "BLT_translation.h"
30 
31 #include "BKE_context.h"
32 #include "BKE_global.h"
33 #include "BKE_icons.h"
34 #include "BKE_layer.h"
35 #include "BKE_main.h"
36 #include "BKE_report.h"
37 #include "BKE_screen.h"
38 #include "BKE_workspace.h"
39 
40 #include "RNA_access.h"
41 #include "RNA_define.h"
42 #include "RNA_enum_types.h"
43 
44 #include "WM_api.h"
45 #include "WM_types.h"
46 #include "wm.h"
47 #include "wm_draw.h"
48 #include "wm_event_system.h"
49 #include "wm_files.h"
50 #include "wm_platform_support.h"
51 #include "wm_window.h"
52 #include "wm_window_private.h"
53 #ifdef WITH_XR_OPENXR
54 # include "wm_xr.h"
55 #endif
56 
57 #include "ED_anim_api.h"
58 #include "ED_fileselect.h"
59 #include "ED_render.h"
60 #include "ED_scene.h"
61 #include "ED_screen.h"
62 
63 #include "UI_interface.h"
64 #include "UI_interface_icons.h"
65 
66 #include "PIL_time.h"
67 
68 #include "BLF_api.h"
69 #include "GPU_batch.h"
70 #include "GPU_batch_presets.h"
71 #include "GPU_context.h"
72 #include "GPU_framebuffer.h"
73 #include "GPU_immediate.h"
74 #include "GPU_init_exit.h"
75 #include "GPU_platform.h"
76 #include "GPU_state.h"
77 #include "GPU_texture.h"
78 
79 #include "UI_resources.h"
80 
81 /* for assert */
82 #ifndef NDEBUG
83 # include "BLI_threads.h"
84 #endif
85 
86 /* the global to talk to ghost */
87 static GHOST_SystemHandle g_system = NULL;
88 
89 typedef enum eWinOverrideFlag {
90  WIN_OVERRIDE_GEOM = (1 << 0),
93 
94 #define GHOST_WINDOW_STATE_DEFAULT GHOST_kWindowStateMaximized
95 
100 static struct WMInitStruct {
101  /* window geometry */
104 
107 
110 } wm_init_state = {
112  .window_focus = true,
113  .native_pixels = true,
114 };
115 
116 /* -------------------------------------------------------------------- */
120 static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool activate);
121 static bool wm_window_timer(const bContext *C);
122 
123 void wm_get_screensize(int *r_width, int *r_height)
124 {
125  unsigned int uiwidth;
126  unsigned int uiheight;
127 
128  GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
129  *r_width = uiwidth;
130  *r_height = uiheight;
131 }
132 
133 void wm_get_desktopsize(int *r_width, int *r_height)
134 {
135  unsigned int uiwidth;
136  unsigned int uiheight;
137 
138  GHOST_GetAllDisplayDimensions(g_system, &uiwidth, &uiheight);
139  *r_width = uiwidth;
140  *r_height = uiheight;
141 }
142 
143 /* keeps size within monitor bounds */
144 static void wm_window_check_size(rcti *rect)
145 {
146  int width, height;
148  if (BLI_rcti_size_x(rect) > width) {
149  BLI_rcti_resize_x(rect, width);
150  }
151  if (BLI_rcti_size_y(rect) > height) {
152  BLI_rcti_resize_y(rect, height);
153  }
154 }
155 
157 {
158  if (win->ghostwin) {
159  /* Prevents non-drawable state of main windows (bugs T22967,
160  * T25071 and possibly T22477 too). Always clear it even if
161  * this window was not the drawable one, because we mess with
162  * drawing context to discard the GW context. */
164 
165  if (win == wm->winactive) {
166  wm->winactive = NULL;
167  }
168 
169  /* We need this window's opengl context active to discard it. */
172 
173  /* Delete local GPU context. */
175 
177  win->ghostwin = NULL;
178  win->gpuctx = NULL;
179  }
180 }
181 
183 {
184  /* update context */
185  if (C) {
188 
189  if (CTX_wm_window(C) == win) {
191  }
192  }
193 
195 
196  /* end running jobs, a job end also removes its timer */
197  LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
198  if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
199  continue;
200  }
201  if (wt->win == win && wt->event_type == TIMERJOBS) {
202  wm_jobs_timer_end(wm, wt);
203  }
204  }
205 
206  /* timer removing, need to call this api function */
207  LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
208  if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
209  continue;
210  }
211  if (wt->win == win) {
212  WM_event_remove_timer(wm, win, wt);
213  }
214  }
216 
217  if (win->eventstate) {
218  MEM_freeN(win->eventstate);
219  }
220  if (win->event_last_handled) {
222  }
223 
224  if (win->cursor_keymap_status) {
226  }
227 
229 
230  wm_event_free_all(win);
231 
232  wm_ghostwindow_destroy(wm, win);
233 
236 
237  MEM_freeN(win);
238 }
239 
241 {
242  int id = 1;
243 
244  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
245  if (id <= win->winid) {
246  id = win->winid + 1;
247  }
248  }
249  return id;
250 }
251 
252 wmWindow *wm_window_new(const Main *bmain, wmWindowManager *wm, wmWindow *parent, bool dialog)
253 {
254  wmWindow *win = MEM_callocN(sizeof(wmWindow), "window");
255 
256  BLI_addtail(&wm->windows, win);
257  win->winid = find_free_winid(wm);
258 
259  /* Dialogs may have a child window as parent. Otherwise, a child must not be a parent too. */
260  win->parent = (!dialog && parent && parent->parent) ? parent->parent : parent;
261  win->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo 3D Format (window)");
263 
264  return win;
265 }
266 
268  wmWindowManager *wm,
269  wmWindow *win_src,
270  const bool duplicate_layout,
271  const bool child)
272 {
273  const bool is_dialog = GHOST_IsDialogWindow(win_src->ghostwin);
274  wmWindow *win_parent = (child) ? win_src : win_src->parent;
275  wmWindow *win_dst = wm_window_new(bmain, wm, win_parent, is_dialog);
276  WorkSpace *workspace = WM_window_get_active_workspace(win_src);
277  WorkSpaceLayout *layout_old = WM_window_get_active_layout(win_src);
278 
279  win_dst->posx = win_src->posx + 10;
280  win_dst->posy = win_src->posy;
281  win_dst->sizex = win_src->sizex;
282  win_dst->sizey = win_src->sizey;
283 
284  win_dst->scene = win_src->scene;
285  STRNCPY(win_dst->view_layer_name, win_src->view_layer_name);
286  BKE_workspace_active_set(win_dst->workspace_hook, workspace);
287  WorkSpaceLayout *layout_new = duplicate_layout ? ED_workspace_layout_duplicate(
288  bmain, workspace, layout_old, win_dst) :
289  layout_old;
290  BKE_workspace_active_layout_set(win_dst->workspace_hook, win_dst->winid, workspace, layout_new);
291 
292  *win_dst->stereo3d_format = *win_src->stereo3d_format;
293 
294  return win_dst;
295 }
296 
298  wmWindow *win_src,
299  const bool duplicate_layout,
300  const bool child)
301 {
302  Main *bmain = CTX_data_main(C);
304 
305  wmWindow *win_dst = wm_window_copy(bmain, wm, win_src, duplicate_layout, child);
306 
307  WM_check(C);
308 
309  if (win_dst->ghostwin) {
311  return win_dst;
312  }
313  wm_window_close(C, wm, win_dst);
314  return NULL;
315 }
316 
319 /* -------------------------------------------------------------------- */
324 {
326 }
327 
333 {
334  wmGenericCallback *action = MEM_callocN(sizeof(*action), __func__);
336  wm_close_file_dialog(C, action);
337 }
338 
340 {
341  wmWindow *win_ctx = CTX_wm_window(C);
342 
343  /* The popup will be displayed in the context window which may not be set
344  * here (this function gets called outside of normal event handling loop). */
345  CTX_wm_window_set(C, win);
346 
347  if (U.uiflag & USER_SAVE_PROMPT) {
349  !G.background) {
350  wm_window_raise(win);
352  }
353  else {
355  }
356  }
357  else {
359  }
360 
361  CTX_wm_window_set(C, win_ctx);
362 }
363 
367 {
368  wmWindow *win_other;
369 
370  /* First check if there is another main window remaining. */
371  for (win_other = wm->windows.first; win_other; win_other = win_other->next) {
372  if (win_other != win && win_other->parent == NULL && !WM_window_is_temp_screen(win_other)) {
373  break;
374  }
375  }
376 
377  if (win->parent == NULL && win_other == NULL) {
379  return;
380  }
381 
382  /* Close child windows */
383  LISTBASE_FOREACH_MUTABLE (wmWindow *, iter_win, &wm->windows) {
384  if (iter_win->parent == win) {
385  wm_window_close(C, wm, iter_win);
386  }
387  }
388 
389  bScreen *screen = WM_window_get_active_screen(win);
390  WorkSpace *workspace = WM_window_get_active_workspace(win);
392 
393  BLI_remlink(&wm->windows, win);
394 
395  CTX_wm_window_set(C, win); /* needed by handlers */
398 
399  /* for regular use this will _never_ be NULL,
400  * however we may be freeing an improperly initialized window. */
401  if (screen) {
402  ED_screen_exit(C, win, screen);
403  }
404 
405  wm_window_free(C, wm, win);
406 
407  /* if temp screen, delete it after window free (it stops jobs that can access it) */
408  if (screen && screen->temp) {
409  Main *bmain = CTX_data_main(C);
410 
411  BLI_assert(BKE_workspace_layout_screen_get(layout) == screen);
412  BKE_workspace_layout_remove(bmain, workspace, layout);
414  }
415 }
416 
418 {
419  if (WM_window_is_temp_screen(win)) {
420  /* Nothing to do for 'temp' windows,
421  * because #WM_window_open always sets window title. */
422  }
423  else if (win->ghostwin) {
424  /* this is set to 1 if you don't have startup.blend open */
425  const char *blendfile_path = BKE_main_blendfile_path_from_global();
426  if (blendfile_path[0] != '\0') {
427  char str[sizeof(((Main *)NULL)->filepath) + 24];
429  sizeof(str),
430  "Blender%s [%s%s]",
431  wm->file_saved ? "" : "*",
432  blendfile_path,
433  G_MAIN->recovered ? " (Recovered)" : "");
434  GHOST_SetTitle(win->ghostwin, str);
435  }
436  else {
437  GHOST_SetTitle(win->ghostwin, "Blender");
438  }
439 
440  /* Informs GHOST of unsaved changes, to set window modified visual indicator (macOS)
441  * and to give hint of unsaved changes for a user warning mechanism in case of OS application
442  * terminate request (e.g. OS Shortcut Alt+F4, Command+Q, (...), or session end). */
444  }
445 }
446 
447 void WM_window_set_dpi(const wmWindow *win)
448 {
449  float auto_dpi = GHOST_GetDPIHint(win->ghostwin);
450 
451  /* Clamp auto DPI to 96, since our font/interface drawing does not work well
452  * with lower sizes. The main case we are interested in supporting is higher
453  * DPI. If a smaller UI is desired it is still possible to adjust UI scale. */
454  auto_dpi = max_ff(auto_dpi, 96.0f);
455 
456  /* Lazily init UI scale size, preserving backwards compatibility by
457  * computing UI scale from ratio of previous DPI and auto DPI */
458  if (U.ui_scale == 0) {
459  int virtual_pixel = (U.virtual_pixel == VIRTUAL_PIXEL_NATIVE) ? 1 : 2;
460 
461  if (U.dpi == 0) {
462  U.ui_scale = virtual_pixel;
463  }
464  else {
465  U.ui_scale = (virtual_pixel * U.dpi * 96.0f) / (auto_dpi * 72.0f);
466  }
467 
468  CLAMP(U.ui_scale, 0.25f, 4.0f);
469  }
470 
471  /* Blender's UI drawing assumes DPI 72 as a good default following macOS
472  * while Windows and Linux use DPI 96. GHOST assumes a default 96 so we
473  * remap the DPI to Blender's convention. */
474  auto_dpi *= GHOST_GetNativePixelSize(win->ghostwin);
475  int dpi = auto_dpi * U.ui_scale * (72.0 / 96.0f);
476 
477  /* Automatically set larger pixel size for high DPI. */
478  int pixelsize = max_ii(1, (int)(dpi / 64));
479  /* User adjustment for pixel size. */
480  pixelsize = max_ii(1, pixelsize + U.ui_line_width);
481 
482  /* Set user preferences globals for drawing, and for forward compatibility. */
483  U.pixelsize = pixelsize;
484  U.dpi = dpi / pixelsize;
485  U.virtual_pixel = (pixelsize == 1) ? VIRTUAL_PIXEL_NATIVE : VIRTUAL_PIXEL_DOUBLE;
486  U.dpi_fac = ((U.pixelsize * (float)U.dpi) / 72.0f);
487  U.inv_dpi_fac = 1.0f / U.dpi_fac;
488 
489  /* Set user preferences globals for drawing, and for forward compatibility. */
490  U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;
491  /* If line thickness differs from scaling factor then adjustments need to be made */
492  U.widget_unit += 2 * ((int)U.pixelsize - (int)U.dpi_fac);
493 
494  /* update font drawing */
495  BLF_default_dpi(U.pixelsize * U.dpi);
496 }
497 
499 {
500  /* Update mouse position when a window is activated. */
501  wm_cursor_position_get(win, &win->eventstate->xy[0], &win->eventstate->xy[1]);
502 }
503 
505 {
506  if (win->eventstate) {
507  return;
508  }
509 
510  win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
512 }
513 
514 /* belongs to below */
516  const char *title,
517  wmWindow *win,
518  bool is_dialog)
519 {
520  /* A new window is created when page-flip mode is required for a window. */
521  GHOST_GLSettings glSettings = {0};
523  glSettings.flags |= GHOST_glStereoVisual;
524  }
525 
526  if (G.debug & G_DEBUG_GPU) {
527  glSettings.flags |= GHOST_glDebugContext;
528  }
529 
530  int scr_w, scr_h;
531  wm_get_desktopsize(&scr_w, &scr_h);
532  int posy = (scr_h - win->posy - win->sizey);
533 
534  /* Clear drawable so we can set the new window. */
535  wmWindow *prev_windrawable = wm->windrawable;
537 
538  GHOST_WindowHandle ghostwin = GHOST_CreateWindow(g_system,
539  (win->parent) ? win->parent->ghostwin : NULL,
540  title,
541  win->posx,
542  posy,
543  win->sizex,
544  win->sizey,
546  is_dialog,
548  glSettings);
549 
550  if (ghostwin) {
551  win->gpuctx = GPU_context_create(ghostwin);
552 
553  /* needed so we can detect the graphics card below */
554  GPU_init();
555 
556  /* Set window as drawable upon creation. Note this has already been
557  * it has already been activated by GHOST_CreateWindow. */
558  wm_window_set_drawable(wm, win, false);
559 
560  win->ghostwin = ghostwin;
561  GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
562 
564 
565  /* store actual window size in blender window */
566  GHOST_RectangleHandle bounds = GHOST_GetClientBounds(win->ghostwin);
567 
568  /* win32: gives undefined window size when minimized */
572  }
574 
575 #ifndef __APPLE__
576  /* set the state here, so minimized state comes up correct on windows */
579  }
580 #endif
581  /* until screens get drawn, make it nice gray */
582  GPU_clear_color(0.55f, 0.55f, 0.55f, 1.0f);
583 
584  /* needed here, because it's used before it reads userdef */
585  WM_window_set_dpi(win);
586 
588 
589  /* Clear double buffer to avoids flickering of new windows on certain drivers. (See T97600) */
590  GPU_clear_color(0.55f, 0.55f, 0.55f, 1.0f);
591 
592  // GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified);
593  }
594  else {
595  wm_window_set_drawable(wm, prev_windrawable, false);
596  }
597 }
598 
599 static void wm_window_ghostwindow_ensure(wmWindowManager *wm, wmWindow *win, bool is_dialog)
600 {
601  if (win->ghostwin == NULL) {
602  if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) {
603  win->posx = wm_init_state.start_x;
604  win->posy = wm_init_state.start_y;
605  win->sizex = wm_init_state.size_x;
606  win->sizey = wm_init_state.size_y;
607 
611  }
612  else {
614  }
615  }
616 
620  }
621 
622  /* without this, cursor restore may fail, T45456 */
623  if (win->cursor == 0) {
624  win->cursor = WM_CURSOR_DEFAULT;
625  }
626 
627  wm_window_ghostwindow_add(wm, "Blender", win, is_dialog);
628  }
629 
630  if (win->ghostwin != NULL) {
631  /* If we have no `ghostwin` this is a buggy window that should be removed.
632  * However we still need to initialize it correctly so the screen doesn't hang. */
633 
634  /* Happens after file-read. */
636 
637  WM_window_set_dpi(win);
638  }
639 
640  /* add keymap handlers (1 handler for all keys in map!) */
641  wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Window", 0, 0);
642  WM_event_add_keymap_handler(&win->handlers, keymap);
643 
644  keymap = WM_keymap_ensure(wm->defaultconf, "Screen", 0, 0);
645  WM_event_add_keymap_handler(&win->handlers, keymap);
646 
647  keymap = WM_keymap_ensure(wm->defaultconf, "Screen Editing", 0, 0);
649 
650  /* add drop boxes */
651  {
652  ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
654  }
655  wm_window_title(wm, win);
656 
657  /* add topbar */
659 }
660 
662 {
663  BLI_assert(G.background == false);
664 
665  /* No command-line prefsize? then we set this.
666  * Note that these values will be used only
667  * when there is no startup.blend yet.
668  */
669  if (wm_init_state.size_x == 0) {
671 
672  /* NOTE: this isn't quite correct, active screen maybe offset 1000s if PX,
673  * we'd need a #wm_get_screensize like function that gives offset,
674  * in practice the window manager will likely move to the correct monitor */
677  }
678 
679  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
680  wm_window_ghostwindow_ensure(wm, win, false);
681  }
682 }
683 
685 {
686  BLI_assert(G.background == false);
687 
688  LISTBASE_FOREACH_MUTABLE (wmWindow *, win, &wm->windows) {
689  if (win->ghostwin == NULL) {
690  wm_window_close(C, wm, win);
691  }
692  }
693 }
694 
695 /* Update window size and position based on data from GHOST window. */
697 {
698  GHOST_RectangleHandle client_rect = GHOST_GetClientBounds(win->ghostwin);
699  int l, t, r, b;
700  GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
701 
702  GHOST_DisposeRectangle(client_rect);
703 
704  int scr_w, scr_h;
705  wm_get_desktopsize(&scr_w, &scr_h);
706  int sizex = r - l;
707  int sizey = b - t;
708  int posx = l;
709  int posy = scr_h - t - win->sizey;
710 
711  if (win->sizex != sizex || win->sizey != sizey || win->posx != posx || win->posy != posy) {
712  win->sizex = sizex;
713  win->sizey = sizey;
714  win->posx = posx;
715  win->posy = posy;
716  return true;
717  }
718  return false;
719 }
720 
722  const char *title,
723  int x,
724  int y,
725  int sizex,
726  int sizey,
727  int space_type,
728  bool toplevel,
729  bool dialog,
730  bool temp,
731  eWindowAlignment alignment)
732 {
733  Main *bmain = CTX_data_main(C);
735  wmWindow *win_prev = CTX_wm_window(C);
737  ViewLayer *view_layer = CTX_data_view_layer(C);
738  rcti rect;
739 
740  const float native_pixel_size = GHOST_GetNativePixelSize(win_prev->ghostwin);
741  /* convert to native OS window coordinates */
742  rect.xmin = win_prev->posx + (x / native_pixel_size);
743  rect.ymin = win_prev->posy + (y / native_pixel_size);
744  sizex /= native_pixel_size;
745  sizey /= native_pixel_size;
746 
747  if (alignment == WIN_ALIGN_LOCATION_CENTER) {
748  /* Window centered around x,y location. */
749  rect.xmin -= sizex / 2;
750  rect.ymin -= sizey / 2;
751  }
752  else if (alignment == WIN_ALIGN_PARENT_CENTER) {
753  /* Centered within parent. X,Y as offsets from there. */
754  rect.xmin += (win_prev->sizex - sizex) / 2;
755  rect.ymin += (win_prev->sizey - sizey) / 2;
756  }
757  else {
758  /* Positioned absolutely within parent bounds. */
759  }
760 
761  rect.xmax = rect.xmin + sizex;
762  rect.ymax = rect.ymin + sizey;
763 
764  /* changes rect to fit within desktop */
765  wm_window_check_size(&rect);
766 
767  /* Reuse temporary windows when they share the same single area. */
768  wmWindow *win = NULL;
769  if (temp) {
770  LISTBASE_FOREACH (wmWindow *, win_iter, &wm->windows) {
771  const bScreen *screen = WM_window_get_active_screen(win_iter);
772  if (screen && screen->temp && BLI_listbase_is_single(&screen->areabase)) {
773  ScrArea *area = screen->areabase.first;
774  if (space_type == (area->butspacetype ? area->butspacetype : area->spacetype)) {
775  win = win_iter;
776  break;
777  }
778  }
779  }
780  }
781 
782  /* add new window? */
783  if (win == NULL) {
784  win = wm_window_new(bmain, wm, toplevel ? NULL : win_prev, dialog);
785  win->posx = rect.xmin;
786  win->posy = rect.ymin;
787  win->sizex = BLI_rcti_size_x(&rect);
788  win->sizey = BLI_rcti_size_y(&rect);
789  *win->stereo3d_format = *win_prev->stereo3d_format;
790  }
791 
792  bScreen *screen = WM_window_get_active_screen(win);
793 
794  if (WM_window_get_active_workspace(win) == NULL) {
795  WorkSpace *workspace = WM_window_get_active_workspace(win_prev);
796  BKE_workspace_active_set(win->workspace_hook, workspace);
797  }
798 
799  if (screen == NULL) {
800  /* add new screen layout */
801  WorkSpace *workspace = WM_window_get_active_workspace(win);
802  WorkSpaceLayout *layout = ED_workspace_layout_add(bmain, workspace, win, "temp");
803 
804  screen = BKE_workspace_layout_screen_get(layout);
805  WM_window_set_active_layout(win, workspace, layout);
806  }
807 
808  /* Set scene and view layer to match original window. */
809  STRNCPY(win->view_layer_name, view_layer->name);
810  if (WM_window_get_active_scene(win) != scene) {
811  /* No need to refresh the tool-system as the window has not yet finished being setup. */
812  ED_screen_scene_change(C, win, scene, false);
813  }
814 
815  screen->temp = temp;
816 
817  /* make window active, and validate/resize */
818  CTX_wm_window_set(C, win);
819  const bool new_window = (win->ghostwin == NULL);
820  if (new_window) {
821  wm_window_ghostwindow_ensure(wm, win, dialog);
822  }
823  WM_check(C);
824 
825  /* It's possible `win->ghostwin == NULL`.
826  * instead of attempting to cleanup here (in a half finished state),
827  * finish setting up the screen, then free it at the end of the function,
828  * to avoid having to take into account a partially-created window.
829  */
830 
831  /* ensure it shows the right spacetype editor */
832  if (space_type != SPACE_EMPTY) {
833  ScrArea *area = screen->areabase.first;
835  ED_area_newspace(C, area, space_type, false);
836  }
837 
838  ED_screen_change(C, screen);
839 
840  if (!new_window) {
841  /* Set size in GHOST window and then update size and position from GHOST,
842  * in case they where changed by GHOST to fit the monitor/screen. */
843  wm_window_set_size(win, win->sizex, win->sizey);
845  }
846 
847  /* Refresh screen dimensions, after the effective window size is known. */
848  ED_screen_refresh(wm, win);
849 
850  if (win->ghostwin) {
851  wm_window_raise(win);
852  GHOST_SetTitle(win->ghostwin, title);
853  return win;
854  }
855 
856  /* very unlikely! but opening a new window can fail */
857  wm_window_close(C, wm, win);
858  CTX_wm_window_set(C, win_prev);
859 
860  return NULL;
861 }
862 
863 /* ****************** Operators ****************** */
864 
866 {
868  wmWindow *win = CTX_wm_window(C);
869  wm_window_close(C, wm, win);
870  return OPERATOR_FINISHED;
871 }
872 
874 {
875  wmWindow *win_src = CTX_wm_window(C);
877 
878  bool ok = (WM_window_open(C,
879  IFACE_("Blender"),
880  0,
881  0,
882  win_src->sizex * 0.95f,
883  win_src->sizey * 0.9f,
884  area->spacetype,
885  false,
886  false,
887  false,
889 
890  if (!ok) {
891  BKE_report(op->reports, RPT_ERROR, "Failed to create window");
892  return OPERATOR_CANCELLED;
893  }
894  return OPERATOR_FINISHED;
895 }
896 
898 {
899  wmWindow *win_src = CTX_wm_window(C);
900 
901  bool ok = (wm_window_copy_test(C, win_src, true, false) != NULL);
902  if (!ok) {
903  BKE_report(op->reports, RPT_ERROR, "Failed to create window");
904  return OPERATOR_CANCELLED;
905  }
906  return OPERATOR_FINISHED;
907 }
908 
910 {
911  wmWindow *window = CTX_wm_window(C);
912 
913  if (G.background) {
914  return OPERATOR_CANCELLED;
915  }
916 
920  }
921  else {
923  }
924 
925  return OPERATOR_FINISHED;
926 }
927 
928 /* ************ events *************** */
929 
931 {
932  float fac = GHOST_GetNativePixelSize(win->ghostwin);
933  *x *= fac;
934 
935  *y = (win->sizey - 1) - *y;
936  *y *= fac;
937 }
938 
940 {
941  float fac = GHOST_GetNativePixelSize(win->ghostwin);
942 
943  *x /= fac;
944  *y /= fac;
945  *y = win->sizey - *y - 1;
946 }
947 
949 {
950  GHOST_ScreenToClient(win->ghostwin, *x, *y, x, y);
952 }
953 
955 {
957  GHOST_ClientToScreen(win->ghostwin, *x, *y, x, y);
958 }
959 
960 void wm_cursor_position_get(wmWindow *win, int *r_x, int *r_y)
961 {
962  if (UNLIKELY(G.f & G_FLAG_EVENT_SIMULATE)) {
963  *r_x = win->eventstate->xy[0];
964  *r_y = win->eventstate->xy[1];
965  return;
966  }
967  GHOST_GetCursorPosition(g_system, win->ghostwin, r_x, r_y);
969 }
970 
971 typedef enum {
972  SHIFT = 's',
973  CONTROL = 'c',
974  ALT = 'a',
975  OS = 'C',
977 
978 /* check if specified modifier key type is pressed */
979 static int query_qual(modifierKeyType qual)
980 {
982  switch (qual) {
983  case SHIFT:
986  break;
987  case CONTROL:
990  break;
991  case OS:
993  break;
994  case ALT:
995  default:
998  break;
999  }
1000 
1001  bool val = false;
1003  if (!val) {
1005  }
1006 
1007  return val;
1008 }
1009 
1011 {
1012  BLI_assert(ELEM(wm->windrawable, NULL, win));
1013 
1014  wm->windrawable = win;
1015  if (activate) {
1017  }
1019 }
1020 
1022 {
1023  if (wm->windrawable) {
1024  wm->windrawable = NULL;
1025  }
1026 }
1027 
1029 {
1031 
1032  if (win != wm->windrawable && win->ghostwin) {
1033  // win->lmbut = 0; /* Keeps hanging when mouse-pressed while other window opened. */
1035 
1036  if (G.debug & G_DEBUG_EVENTS) {
1037  printf("%s: set drawable %d\n", __func__, win->winid);
1038  }
1039 
1040  wm_window_set_drawable(wm, win, true);
1041  }
1042 
1043  if (win->ghostwin) {
1044  /* this can change per window */
1045  WM_window_set_dpi(win);
1046  }
1047 }
1048 
1050 {
1053  wmWindowManager *wm = G_MAIN->wm.first;
1054 
1055  if (wm == NULL) {
1056  return;
1057  }
1058  wmWindow *win = wm->windrawable;
1059 
1060  if (win && win->ghostwin) {
1062  wm_window_set_drawable(wm, win, true);
1063  }
1064 }
1065 
1071 static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr)
1072 {
1073  bContext *C = C_void_ptr;
1076 #if 0
1077  /* We may want to use time from ghost, currently `PIL_check_seconds_timer` is used instead. */
1079 #endif
1080 
1081  if (type == GHOST_kEventQuitRequest) {
1082  /* Find an active window to display quit dialog in. */
1083  GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
1084 
1085  wmWindow *win;
1086  if (ghostwin && GHOST_ValidWindow(g_system, ghostwin)) {
1087  win = GHOST_GetWindowUserData(ghostwin);
1088  }
1089  else {
1090  win = wm->winactive;
1091  }
1092 
1093  /* Display quit dialog or quit immediately. */
1094  if (win) {
1096  }
1097  else {
1099  }
1100  }
1101  else {
1102  GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
1104 
1105  /* Ghost now can call this function for life resizes,
1106  * but it should return if WM didn't initialize yet.
1107  * Can happen on file read (especially full size window). */
1108  if ((wm->initialized & WM_WINDOW_IS_INIT) == 0) {
1109  return true;
1110  }
1111  if (!ghostwin) {
1112  /* XXX: should be checked, why are we getting an event here, and what is it? */
1113  puts("<!> event has no window");
1114  return true;
1115  }
1116  if (!GHOST_ValidWindow(g_system, ghostwin)) {
1117  /* XXX: should be checked, why are we getting an event here, and what is it? */
1118  puts("<!> event has invalid window");
1119  return true;
1120  }
1121  wmWindow *win = GHOST_GetWindowUserData(ghostwin);
1122 
1123  switch (type) {
1125  wm_event_add_ghostevent(wm, win, type, data);
1126  win->active = 0; /* XXX */
1127 
1128  /* clear modifiers for inactive windows */
1129  win->eventstate->modifier = 0;
1130  win->eventstate->keymodifier = 0;
1131 
1132  break;
1134  const int keymodifier = ((query_qual(SHIFT) ? KM_SHIFT : 0) |
1135  (query_qual(CONTROL) ? KM_CTRL : 0) |
1136  (query_qual(ALT) ? KM_ALT : 0) | (query_qual(OS) ? KM_OSKEY : 0));
1137 
1138  /* Win23/GHOST modifier bug, see T40317 */
1139 #ifndef WIN32
1140 //# define USE_WIN_ACTIVATE
1141 #endif
1142 
1143  /* No context change! C->wm->windrawable is drawable, or for area queues. */
1144  wm->winactive = win;
1145 
1146  win->active = 1;
1147  // window_handle(win, INPUTCHANGE, win->active);
1148 
1149  /* bad ghost support for modifier keys... so on activate we set the modifiers again */
1150 
1151  /* TODO: This is not correct since a modifier may be held when a window is activated...
1152  * better solve this at ghost level. attempted fix r54450 but it caused bug T34255.
1153  *
1154  * For now don't send GHOST_kEventKeyDown events, just set the 'eventstate'.
1155  */
1156  GHOST_TEventKeyData kdata = {
1158  .utf8_buf = {'\0'},
1159  .is_repeat = false,
1160  };
1161  if (win->eventstate->modifier & KM_SHIFT) {
1162  if ((keymodifier & KM_SHIFT) == 0) {
1163  kdata.key = GHOST_kKeyLeftShift;
1164  wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, &kdata);
1165  }
1166  }
1167 #ifdef USE_WIN_ACTIVATE
1168  else {
1169  if (keymodifier & KM_SHIFT) {
1170  win->eventstate->modifier |= KM_SHIFT;
1171  }
1172  }
1173 #endif
1174  if (win->eventstate->modifier & KM_CTRL) {
1175  if ((keymodifier & KM_CTRL) == 0) {
1176  kdata.key = GHOST_kKeyLeftControl;
1177  wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, &kdata);
1178  }
1179  }
1180 #ifdef USE_WIN_ACTIVATE
1181  else {
1182  if (keymodifier & KM_CTRL) {
1183  win->eventstate->modifier |= KM_CTRL;
1184  }
1185  }
1186 #endif
1187  if (win->eventstate->modifier & KM_ALT) {
1188  if ((keymodifier & KM_ALT) == 0) {
1189  kdata.key = GHOST_kKeyLeftAlt;
1190  wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, &kdata);
1191  }
1192  }
1193 #ifdef USE_WIN_ACTIVATE
1194  else {
1195  if (keymodifier & KM_ALT) {
1196  win->eventstate->modifier |= KM_ALT;
1197  }
1198  }
1199 #endif
1200  if (win->eventstate->modifier & KM_OSKEY) {
1201  if ((keymodifier & KM_OSKEY) == 0) {
1202  kdata.key = GHOST_kKeyOS;
1203  wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, &kdata);
1204  }
1205  }
1206 #ifdef USE_WIN_ACTIVATE
1207  else {
1208  if (keymodifier & KM_OSKEY) {
1209  win->eventstate->modifier |= KM_OSKEY;
1210  }
1211  }
1212 #endif
1213 
1214 #undef USE_WIN_ACTIVATE
1215 
1216  /* keymodifier zero, it hangs on hotkeys that open windows otherwise */
1217  win->eventstate->keymodifier = 0;
1218 
1219  /* entering window, update mouse pos. but no event */
1221 
1222  win->addmousemove = 1; /* enables highlighted buttons */
1223 
1224  wm_window_make_drawable(wm, win);
1225 
1226  /* window might be focused by mouse click in configuration of window manager
1227  * when focus is not following mouse
1228  * click could have been done on a button and depending on window manager settings
1229  * click would be passed to blender or not, but in any case button under cursor
1230  * should be activated, so at max next click on button without moving mouse
1231  * would trigger its handle function
1232  * currently it seems to be common practice to generate new event for, but probably
1233  * we'll need utility function for this? (sergey)
1234  */
1235  wmEvent event;
1236  wm_event_init_from_window(win, &event);
1237  event.type = MOUSEMOVE;
1238  event.val = KM_NOTHING;
1239  copy_v2_v2_int(event.prev_xy, event.xy);
1240  event.flag = 0;
1241 
1242  wm_event_add(win, &event);
1243 
1244  break;
1245  }
1246  case GHOST_kEventWindowClose: {
1247  wm_window_close(C, wm, win);
1248  break;
1249  }
1250  case GHOST_kEventWindowUpdate: {
1251  if (G.debug & G_DEBUG_EVENTS) {
1252  printf("%s: ghost redraw %d\n", __func__, win->winid);
1253  }
1254 
1255  wm_window_make_drawable(wm, win);
1257 
1258  break;
1259  }
1261  case GHOST_kEventWindowMove: {
1263  win->windowstate = state;
1264 
1265  WM_window_set_dpi(win);
1266 
1267  /* win32: gives undefined window size when minimized */
1269  /*
1270  * Ghost sometimes send size or move events when the window hasn't changed.
1271  * One case of this is using compiz on linux. To alleviate the problem
1272  * we ignore all such event here.
1273  *
1274  * It might be good to eventually do that at Ghost level, but that is for
1275  * another time.
1276  */
1277  if (wm_window_update_size_position(win)) {
1278  const bScreen *screen = WM_window_get_active_screen(win);
1279 
1280  /* debug prints */
1281  if (G.debug & G_DEBUG_EVENTS) {
1282  const char *state_str;
1284 
1286  state_str = "normal";
1287  }
1288  else if (state == GHOST_kWindowStateMinimized) {
1289  state_str = "minimized";
1290  }
1291  else if (state == GHOST_kWindowStateMaximized) {
1292  state_str = "maximized";
1293  }
1294  else if (state == GHOST_kWindowStateFullScreen) {
1295  state_str = "fullscreen";
1296  }
1297  else {
1298  state_str = "<unknown>";
1299  }
1300 
1301  printf("%s: window %d state = %s\n", __func__, win->winid, state_str);
1302 
1303  if (type != GHOST_kEventWindowSize) {
1304  printf("win move event pos %d %d size %d %d\n",
1305  win->posx,
1306  win->posy,
1307  win->sizex,
1308  win->sizey);
1309  }
1310  }
1311 
1312  wm_window_make_drawable(wm, win);
1313  BKE_icon_changed(screen->id.icon_id);
1316 
1317 #if defined(__APPLE__) || defined(WIN32)
1318  /* OSX and Win32 don't return to the mainloop while resize */
1319  wm_window_timer(C);
1322  wm_draw_update(C);
1323 #endif
1324  }
1325  }
1326  break;
1327  }
1328 
1330  WM_window_set_dpi(win);
1331  /* font's are stored at each DPI level, without this we can easy load 100's of fonts */
1332  BLF_cache_clear();
1333 
1334  WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */
1335  WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
1336  break;
1337  }
1338 
1339  case GHOST_kEventOpenMainFile: {
1340  const char *path = GHOST_GetEventData(evt);
1341 
1342  if (path) {
1343  wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
1344  /* operator needs a valid window in context, ensures
1345  * it is correctly set */
1346  CTX_wm_window_set(C, win);
1347 
1348  PointerRNA props_ptr;
1350  RNA_string_set(&props_ptr, "filepath", path);
1351  RNA_boolean_set(&props_ptr, "display_file_selector", false);
1353  WM_operator_properties_free(&props_ptr);
1354 
1356  }
1357  break;
1358  }
1361 
1362  /* entering window, update mouse pos */
1364 
1365  wmEvent event;
1366  wm_event_init_from_window(win, &event); /* copy last state, like mouse coords */
1367 
1368  /* activate region */
1369  event.type = MOUSEMOVE;
1370  event.val = KM_NOTHING;
1371  copy_v2_v2_int(event.prev_xy, event.xy);
1372 
1373  wm_cursor_position_from_ghost_screen_coords(win, &ddd->x, &ddd->y);
1374  event.xy[0] = ddd->x;
1375  event.xy[1] = ddd->y;
1376 
1377  event.flag = 0;
1378 
1379  /* No context change! C->wm->windrawable is drawable, or for area queues. */
1380  wm->winactive = win;
1381 
1382  win->active = 1;
1383 
1384  wm_event_add(win, &event);
1385 
1386  /* make blender drop event with custom data pointing to wm drags */
1387  event.type = EVT_DROP;
1388  event.val = KM_RELEASE;
1389  event.custom = EVT_DATA_DRAGDROP;
1390  event.customdata = &wm->drags;
1391  event.customdata_free = true;
1392 
1393  wm_event_add(win, &event);
1394 
1395  // printf("Drop detected\n");
1396 
1397  /* add drag data to wm for paths: */
1398 
1400  GHOST_TStringArray *stra = ddd->data;
1401 
1402  for (int a = 0; a < stra->count; a++) {
1403  printf("drop file %s\n", stra->strings[a]);
1404  /* try to get icon type from extension */
1405  int icon = ED_file_extension_icon((char *)stra->strings[a]);
1406 
1407  WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0, WM_DRAG_NOP);
1408  /* void poin should point to string, it makes a copy */
1409  break; /* only one drop element supported now */
1410  }
1411  }
1412 
1413  break;
1414  }
1416  /* Only update if the actual pixel size changes. */
1417  float prev_pixelsize = U.pixelsize;
1418  WM_window_set_dpi(win);
1419 
1420  if (U.pixelsize != prev_pixelsize) {
1422 
1423  /* Close all popups since they are positioned with the pixel
1424  * size baked in and it's difficult to correct them. */
1425  CTX_wm_window_set(C, win);
1428 
1429  wm_window_make_drawable(wm, win);
1430 
1433  }
1434 
1435  break;
1436  }
1437  case GHOST_kEventTrackpad: {
1439 
1441  wm_event_add_ghostevent(wm, win, type, data);
1442  break;
1443  }
1444  case GHOST_kEventCursorMove: {
1446 
1448  wm_event_add_ghostevent(wm, win, type, data);
1449  break;
1450  }
1452  case GHOST_kEventButtonUp: {
1453  if (win->active == 0) {
1454  /* Entering window, update cursor and tablet state.
1455  * (ghost sends win-activate *after* the mouse-click in window!) */
1457  }
1458 
1459  wm_event_add_ghostevent(wm, win, type, data);
1460  break;
1461  }
1462  default: {
1463  wm_event_add_ghostevent(wm, win, type, data);
1464  break;
1465  }
1466  }
1467  }
1468  return true;
1469 }
1470 
1477 static bool wm_window_timer(const bContext *C)
1478 {
1479  Main *bmain = CTX_data_main(C);
1481  double time = PIL_check_seconds_timer();
1482  bool has_event = false;
1483 
1484  /* Mutable in case the timer gets removed. */
1485  LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
1486  if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
1487  continue;
1488  }
1489  wmWindow *win = wt->win;
1490 
1491  if (wt->sleep != 0) {
1492  continue;
1493  }
1494 
1495  if (time > wt->ntime) {
1496  wt->delta = time - wt->ltime;
1497  wt->duration += wt->delta;
1498  wt->ltime = time;
1499 
1500  wt->ntime = wt->stime;
1501  if (wt->timestep != 0.0f) {
1502  wt->ntime += wt->timestep * ceil(wt->duration / wt->timestep);
1503  }
1504 
1505  if (wt->event_type == TIMERJOBS) {
1506  wm_jobs_timer(wm, wt);
1507  }
1508  else if (wt->event_type == TIMERAUTOSAVE) {
1509  wm_autosave_timer(bmain, wm, wt);
1510  }
1511  else if (wt->event_type == TIMERNOTIFIER) {
1512  WM_main_add_notifier(POINTER_AS_UINT(wt->customdata), NULL);
1513  }
1514  else if (win) {
1515  wmEvent event;
1516  wm_event_init_from_window(win, &event);
1517 
1518  event.type = wt->event_type;
1519  event.val = KM_NOTHING;
1520  event.keymodifier = 0;
1521  event.flag = 0;
1522  event.custom = EVT_DATA_TIMER;
1523  event.customdata = wt;
1524  wm_event_add(win, &event);
1525 
1526  has_event = true;
1527  }
1528  }
1529  }
1530 
1531  /* Effectively delete all timers marked for removal. */
1533 
1534  return has_event;
1535 }
1536 
1538 {
1540 
1541  bool has_event = GHOST_ProcessEvents(g_system, false); /* `false` is no wait. */
1542 
1543  if (has_event) {
1545  }
1546  has_event |= wm_window_timer(C);
1547 #ifdef WITH_XR_OPENXR
1548  /* XR events don't use the regular window queues. So here we don't only trigger
1549  * processing/dispatching but also handling. */
1550  has_event |= wm_xr_events_handle(CTX_wm_manager(C));
1551 #endif
1552 
1553  /* When there is no event, sleep 5 milliseconds not to use too much CPU when idle.
1554  *
1555  * Skip sleeping when simulating events so tests don't idle unnecessarily as simulated
1556  * events are typically generated from a timer that runs in the main loop. */
1557  if ((has_event == false) && !(G.f & G_FLAG_EVENT_SIMULATE)) {
1558  PIL_sleep_ms(5);
1559  }
1560 }
1561 
1562 /* -------------------------------------------------------------------- */
1567 {
1568  if (!g_system) {
1569  GHOST_EventConsumerHandle consumer;
1570 
1571  if (C != NULL) {
1573  }
1574 
1576 
1578 
1579  GHOST_Debug debug = {0};
1580  if (G.debug & G_DEBUG_GHOST) {
1581  debug.flags |= GHOST_kDebugDefault;
1582  }
1583  if (G.debug & G_DEBUG_WINTAB) {
1584  debug.flags |= GHOST_kDebugWintab;
1585  }
1587 
1588  if (C != NULL) {
1589  GHOST_AddEventConsumer(g_system, consumer);
1590  }
1591 
1594  }
1595 
1597  }
1598 }
1599 
1600 void wm_ghost_exit(void)
1601 {
1602  if (g_system) {
1604  }
1605  g_system = NULL;
1606 }
1607 
1610 /* -------------------------------------------------------------------- */
1615  wmWindow *UNUSED(win),
1616  wmTimer *timer,
1617  bool do_sleep)
1618 {
1619  LISTBASE_FOREACH (wmTimer *, wt, &wm->timers) {
1620  if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
1621  continue;
1622  }
1623  if (wt == timer) {
1624  wt->sleep = do_sleep;
1625  break;
1626  }
1627  }
1628 }
1629 
1630 wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
1631 {
1632  wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
1633  BLI_assert(timestep >= 0.0f);
1634 
1635  wt->event_type = event_type;
1637  wt->ntime = wt->ltime + timestep;
1638  wt->stime = wt->ltime;
1639  wt->timestep = timestep;
1640  wt->win = win;
1641 
1642  BLI_addtail(&wm->timers, wt);
1643 
1644  return wt;
1645 }
1646 
1648  wmWindow *win,
1649  unsigned int type,
1650  double timestep)
1651 {
1652  wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
1653  BLI_assert(timestep >= 0.0f);
1654 
1655  wt->event_type = TIMERNOTIFIER;
1657  wt->ntime = wt->ltime + timestep;
1658  wt->stime = wt->ltime;
1659  wt->timestep = timestep;
1660  wt->win = win;
1663 
1664  BLI_addtail(&wm->timers, wt);
1665 
1666  return wt;
1667 }
1668 
1670 {
1671  LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
1672  if ((wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) == 0) {
1673  continue;
1674  }
1675 
1676  /* Actual removal and freeing of the timer. */
1677  BLI_remlink(&wm->timers, wt);
1678  MEM_freeN(wt);
1679  }
1680 }
1681 
1683 {
1684  /* Extra security check. */
1685  if (BLI_findindex(&wm->timers, timer) < 0) {
1686  return;
1687  }
1688 
1690 
1691  /* Clear existing references to the timer. */
1692  if (wm->reports.reporttimer == timer) {
1693  wm->reports.reporttimer = NULL;
1694  }
1695  /* There might be events in queue with this timer as customdata. */
1696  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
1697  LISTBASE_FOREACH (wmEvent *, event, &win->event_queue) {
1698  if (event->customdata == timer) {
1699  event->customdata = NULL;
1700  event->type = EVENT_NONE; /* Timer users customdata, don't want `NULL == NULL`. */
1701  }
1702  }
1703  }
1704 
1705  /* Immediately free customdata if requested, so that invalid usages of that data after
1706  * calling `WM_event_remove_timer` can be easily spotted (through ASAN errors e.g.). */
1707  if (timer->customdata != NULL && (timer->flags & WM_TIMER_NO_FREE_CUSTOM_DATA) == 0) {
1708  MEM_freeN(timer->customdata);
1709  timer->customdata = NULL;
1710  }
1711 }
1712 
1714 {
1715  timer->customdata = NULL;
1716  WM_event_remove_timer(wm, win, timer);
1717 }
1718 
1721 /* -------------------------------------------------------------------- */
1725 static char *wm_clipboard_text_get_ex(bool selection, int *r_len, bool firstline)
1726 {
1727  if (G.background) {
1728  *r_len = 0;
1729  return NULL;
1730  }
1731 
1732  char *buf = GHOST_getClipboard(selection);
1733  if (!buf) {
1734  *r_len = 0;
1735  return NULL;
1736  }
1737 
1738  /* always convert from \r\n to \n */
1739  char *newbuf = MEM_mallocN(strlen(buf) + 1, __func__);
1740  char *p2 = newbuf;
1741 
1742  if (firstline) {
1743  /* will return an over-alloc'ed value in the case there are newlines */
1744  for (char *p = buf; *p; p++) {
1745  if (!ELEM(*p, '\n', '\r')) {
1746  *(p2++) = *p;
1747  }
1748  else {
1749  break;
1750  }
1751  }
1752  }
1753  else {
1754  for (char *p = buf; *p; p++) {
1755  if (*p != '\r') {
1756  *(p2++) = *p;
1757  }
1758  }
1759  }
1760 
1761  *p2 = '\0';
1762 
1763  free(buf); /* ghost uses regular malloc */
1764 
1765  *r_len = (p2 - newbuf);
1766 
1767  return newbuf;
1768 }
1769 
1770 char *WM_clipboard_text_get(bool selection, int *r_len)
1771 {
1772  return wm_clipboard_text_get_ex(selection, r_len, false);
1773 }
1774 
1775 char *WM_clipboard_text_get_firstline(bool selection, int *r_len)
1776 {
1777  return wm_clipboard_text_get_ex(selection, r_len, true);
1778 }
1779 
1780 void WM_clipboard_text_set(const char *buf, bool selection)
1781 {
1782  if (!G.background) {
1783 #ifdef _WIN32
1784  /* do conversion from \n to \r\n on Windows */
1785  const char *p;
1786  char *p2, *newbuf;
1787  int newlen = 0;
1788 
1789  for (p = buf; *p; p++) {
1790  if (*p == '\n') {
1791  newlen += 2;
1792  }
1793  else {
1794  newlen++;
1795  }
1796  }
1797 
1798  newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set");
1799 
1800  for (p = buf, p2 = newbuf; *p; p++, p2++) {
1801  if (*p == '\n') {
1802  *(p2++) = '\r';
1803  *p2 = '\n';
1804  }
1805  else {
1806  *p2 = *p;
1807  }
1808  }
1809  *p2 = '\0';
1810 
1811  GHOST_putClipboard(newbuf, selection);
1812  MEM_freeN(newbuf);
1813 #else
1814  GHOST_putClipboard(buf, selection);
1815 #endif
1816  }
1817 }
1818 
1821 /* -------------------------------------------------------------------- */
1825 void WM_progress_set(wmWindow *win, float progress)
1826 {
1827  /* In background mode we may have windows, but not actual GHOST windows. */
1828  if (win->ghostwin) {
1829  GHOST_SetProgressBar(win->ghostwin, progress);
1830  }
1831 }
1832 
1834 {
1835  if (win->ghostwin) {
1837  }
1838 }
1839 
1842 /* -------------------------------------------------------------------- */
1846 void wm_window_get_position(wmWindow *win, int *r_pos_x, int *r_pos_y)
1847 {
1848  *r_pos_x = win->posx;
1849  *r_pos_y = win->posy;
1850 }
1851 
1853 {
1855 }
1856 
1859 /* -------------------------------------------------------------------- */
1864 {
1866 }
1867 
1869 {
1870  /* Restore window if minimized */
1873  }
1875 }
1876 
1879 /* -------------------------------------------------------------------- */
1884 {
1886 }
1887 
1888 void wm_window_set_swap_interval(wmWindow *win, int interval)
1889 {
1890  GHOST_SetSwapInterval(win->ghostwin, interval);
1891 }
1892 
1893 bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut)
1894 {
1895  return GHOST_GetSwapInterval(win->ghostwin, intervalOut);
1896 }
1897 
1900 /* -------------------------------------------------------------------- */
1904 wmWindow *WM_window_find_under_cursor(wmWindow *win, const int mval[2], int r_mval[2])
1905 {
1906  int tmp[2];
1907  copy_v2_v2_int(tmp, mval);
1908  wm_cursor_position_to_ghost_screen_coords(win, &tmp[0], &tmp[1]);
1909 
1910  GHOST_WindowHandle ghostwin = GHOST_GetWindowUnderCursor(g_system, tmp[0], tmp[1]);
1911 
1912  if (!ghostwin) {
1913  return NULL;
1914  }
1915 
1916  wmWindow *win_other = GHOST_GetWindowUserData(ghostwin);
1917  wm_cursor_position_from_ghost_screen_coords(win_other, &tmp[0], &tmp[1]);
1918  copy_v2_v2_int(r_mval, tmp);
1919  return win_other;
1920 }
1921 
1923  const wmWindow *win,
1924  const int pos[2],
1925  float r_col[3])
1926 {
1927  bool setup_context = wm->windrawable != win;
1928 
1929  if (setup_context) {
1932  }
1933 
1934  GPU_frontbuffer_read_pixels(pos[0], pos[1], 1, 1, 3, GPU_DATA_FLOAT, r_col);
1935 
1936  if (setup_context) {
1937  if (wm->windrawable) {
1940  }
1941  }
1942 }
1943 
1946 /* -------------------------------------------------------------------- */
1954 {
1955  bool setup_context = wm->windrawable != win;
1956 
1957  if (setup_context) {
1960  }
1961 
1962  r_size[0] = WM_window_pixels_x(win);
1963  r_size[1] = WM_window_pixels_y(win);
1964  const uint rect_len = r_size[0] * r_size[1];
1965  uint *rect = MEM_mallocN(sizeof(*rect) * rect_len, __func__);
1966 
1967  GPU_frontbuffer_read_pixels(0, 0, r_size[0], r_size[1], 4, GPU_DATA_UBYTE, rect);
1968 
1969  if (setup_context) {
1970  if (wm->windrawable) {
1973  }
1974  }
1975 
1976  /* Clear alpha, it is not set to a meaningful value in OpenGL. */
1977  uchar *cp = (uchar *)rect;
1978  uint i;
1979  for (i = 0, cp += 3; i < rect_len; i++, cp += 4) {
1980  *cp = 0xff;
1981  }
1982  return (uint *)rect;
1983 }
1984 
1987 /* -------------------------------------------------------------------- */
1991 void WM_init_state_size_set(int stax, int stay, int sizx, int sizy)
1992 {
1993  wm_init_state.start_x = stax; /* left hand pos */
1994  wm_init_state.start_y = stay; /* bottom pos */
1995  wm_init_state.size_x = sizx < 640 ? 640 : sizx;
1996  wm_init_state.size_y = sizy < 480 ? 480 : sizy;
1998 }
1999 
2001 {
2004 }
2005 
2007 {
2010 }
2011 
2013 {
2016 }
2017 
2019 {
2020  wm_init_state.window_focus = do_it;
2021 }
2022 
2023 void WM_init_native_pixels(bool do_it)
2024 {
2025  wm_init_state.native_pixels = do_it;
2026 }
2027 
2030 /* -------------------------------------------------------------------- */
2035 {
2036  if (g_system) {
2038 
2039  switch (U.tablet_api) {
2040  case USER_TABLET_NATIVE:
2042  break;
2043  case USER_TABLET_WINTAB:
2045  break;
2046  case USER_TABLET_AUTOMATIC:
2047  default:
2049  break;
2050  }
2051  }
2052 }
2053 
2054 void WM_cursor_warp(wmWindow *win, int x, int y)
2055 {
2056  if (win && win->ghostwin) {
2057  int oldx = x, oldy = y;
2058 
2061 
2062  win->eventstate->prev_xy[0] = oldx;
2063  win->eventstate->prev_xy[1] = oldy;
2064 
2065  win->eventstate->xy[0] = oldx;
2066  win->eventstate->xy[1] = oldy;
2067  }
2068 }
2069 
2072 /* -------------------------------------------------------------------- */
2077 {
2078  float f = GHOST_GetNativePixelSize(win->ghostwin);
2079 
2080  return (int)(f * (float)win->sizex);
2081 }
2083 {
2084  float f = GHOST_GetNativePixelSize(win->ghostwin);
2085 
2086  return (int)(f * (float)win->sizey);
2087 }
2088 
2089 void WM_window_rect_calc(const wmWindow *win, rcti *r_rect)
2090 {
2091  BLI_rcti_init(r_rect, 0, WM_window_pixels_x(win), 0, WM_window_pixels_y(win));
2092 }
2093 void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
2094 {
2095  rcti window_rect, screen_rect;
2096 
2097  WM_window_rect_calc(win, &window_rect);
2098  screen_rect = window_rect;
2099 
2100  /* Subtract global areas from screen rectangle. */
2101  LISTBASE_FOREACH (ScrArea *, global_area, &win->global_areas.areabase) {
2102  int height = ED_area_global_size_y(global_area) - 1;
2103 
2104  if (global_area->global->flag & GLOBAL_AREA_IS_HIDDEN) {
2105  continue;
2106  }
2107 
2108  switch (global_area->global->align) {
2109  case GLOBAL_AREA_ALIGN_TOP:
2110  screen_rect.ymax -= height;
2111  break;
2113  screen_rect.ymin += height;
2114  break;
2115  default:
2117  break;
2118  }
2119  }
2120 
2121  BLI_assert(BLI_rcti_is_valid(&screen_rect));
2122 
2123  *r_rect = screen_rect;
2124 }
2125 
2127 {
2129 }
2130 
2132 {
2134 }
2135 
2138 /* -------------------------------------------------------------------- */
2143 {
2144  LISTBASE_FOREACH (wmWindow *, win, win_lb) {
2145  if (WM_window_get_active_scene(win) == scene) {
2146  ED_workspace_scene_data_sync(win->workspace_hook, scene);
2147  }
2148  }
2149 }
2150 
2152 {
2153  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
2154  if (WM_window_get_active_screen(win) == screen) {
2155  return WM_window_get_active_scene(win);
2156  }
2157  }
2158 
2159  return NULL;
2160 }
2161 
2163 {
2164  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
2165  if (WM_window_get_active_screen(win) == screen) {
2166  return WM_window_get_active_view_layer(win);
2167  }
2168  }
2169 
2170  return NULL;
2171 }
2172 
2174 {
2175  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
2176  if (WM_window_get_active_screen(win) == screen) {
2177  return WM_window_get_active_workspace(win);
2178  }
2179  }
2180  return NULL;
2181 }
2182 
2184 {
2185  return win->scene;
2186 }
2187 
2189 {
2191  wmWindow *win_parent = (win->parent) ? win->parent : win;
2192  bool changed = false;
2193 
2194  /* Set scene in parent and its child windows. */
2195  if (win_parent->scene != scene) {
2196  ED_screen_scene_change(C, win_parent, scene, true);
2197  changed = true;
2198  }
2199 
2200  LISTBASE_FOREACH (wmWindow *, win_child, &wm->windows) {
2201  if (win_child->parent == win_parent && win_child->scene != scene) {
2202  ED_screen_scene_change(C, win_child, scene, true);
2203  changed = true;
2204  }
2205  }
2206 
2207  if (changed) {
2208  /* Update depsgraph and renderers for scene change. */
2209  ViewLayer *view_layer = WM_window_get_active_view_layer(win_parent);
2210  ED_scene_change_update(bmain, scene, view_layer);
2211 
2212  /* Complete redraw. */
2214  }
2215 }
2216 
2218 {
2220  if (scene == NULL) {
2221  return NULL;
2222  }
2223 
2224  ViewLayer *view_layer = BKE_view_layer_find(scene, win->view_layer_name);
2225  if (view_layer) {
2226  return view_layer;
2227  }
2228 
2229  view_layer = BKE_view_layer_default_view(scene);
2230  if (view_layer) {
2231  WM_window_set_active_view_layer((wmWindow *)win, view_layer);
2232  }
2233 
2234  return view_layer;
2235 }
2236 
2238 {
2240  Main *bmain = G_MAIN;
2241 
2242  wmWindowManager *wm = bmain->wm.first;
2243  wmWindow *win_parent = (win->parent) ? win->parent : win;
2244 
2245  /* Set view layer in parent and child windows. */
2246  LISTBASE_FOREACH (wmWindow *, win_iter, &wm->windows) {
2247  if ((win_iter == win_parent) || (win_iter->parent == win_parent)) {
2248  STRNCPY(win_iter->view_layer_name, view_layer->name);
2249  bScreen *screen = BKE_workspace_active_screen_get(win_iter->workspace_hook);
2250  ED_render_view_layer_changed(bmain, screen);
2251  }
2252  }
2253 }
2254 
2256 {
2257  /* Update layer name is correct after scene changes, load without UI, etc. */
2259 
2260  if (scene && BKE_view_layer_find(scene, win->view_layer_name) == NULL) {
2262  STRNCPY(win->view_layer_name, view_layer->name);
2263  }
2264 }
2265 
2267 {
2269 }
2270 
2272 {
2274  wmWindow *win_parent = (win->parent) ? win->parent : win;
2275 
2276  ED_workspace_change(workspace, C, wm, win);
2277 
2278  LISTBASE_FOREACH (wmWindow *, win_child, &wm->windows) {
2279  if (win_child->parent == win_parent) {
2280  bScreen *screen = WM_window_get_active_screen(win_child);
2281  /* Don't change temporary screens, they only serve a single purpose. */
2282  if (screen->temp) {
2283  continue;
2284  }
2285  ED_workspace_change(workspace, C, wm, win_child);
2286  }
2287  }
2288 }
2289 
2291 {
2292  const WorkSpace *workspace = WM_window_get_active_workspace(win);
2293  return (LIKELY(workspace != NULL) ? BKE_workspace_active_layout_get(win->workspace_hook) : NULL);
2294 }
2296 {
2297  BKE_workspace_active_layout_set(win->workspace_hook, win->winid, workspace, layout);
2298 }
2299 
2301 {
2302  const WorkSpace *workspace = WM_window_get_active_workspace(win);
2303  /* May be NULL in rare cases like closing Blender */
2304  return (LIKELY(workspace != NULL) ? BKE_workspace_active_screen_get(win->workspace_hook) : NULL);
2305 }
2307 {
2308  BKE_workspace_active_screen_set(win->workspace_hook, win->winid, workspace, screen);
2309 }
2310 
2312 {
2313  const bScreen *screen = WM_window_get_active_screen(win);
2314  return (screen && screen->temp != 0);
2315 }
2316 
2319 /* -------------------------------------------------------------------- */
2323 #ifdef WITH_INPUT_IME
2327 void wm_window_IME_begin(wmWindow *win, int x, int y, int w, int h, bool complete)
2328 {
2329  BLI_assert(win);
2330 
2331  /* Convert to native OS window coordinates. */
2332  float fac = GHOST_GetNativePixelSize(win->ghostwin);
2333  x /= fac;
2334  y /= fac;
2335  GHOST_BeginIME(win->ghostwin, x, win->sizey - y, w, h, complete);
2336 }
2337 
2338 void wm_window_IME_end(wmWindow *win)
2339 {
2340  BLI_assert(win && win->ime_data);
2341 
2342  GHOST_EndIME(win->ghostwin);
2343  win->ime_data = NULL;
2344 }
2345 #endif /* WITH_INPUT_IME */
2346 
2349 /* -------------------------------------------------------------------- */
2354 {
2355  /* On Windows there is a problem creating contexts that share resources (almost any object,
2356  * including legacy display lists, but also textures) with a context which is current in another
2357  * thread. This is a documented and behavior of both `::wglCreateContextAttribsARB()` and
2358  * `::wglShareLists()`.
2359  *
2360  * Other platforms might successfully share resources from context which is active somewhere
2361  * else, but to keep our code behave the same on all platform we expect contexts to only be
2362  * created from the main thread. */
2363 
2366 
2367  GHOST_GLSettings glSettings = {0};
2368  if (G.debug & G_DEBUG_GPU) {
2369  glSettings.flags |= GHOST_glDebugContext;
2370  }
2371  return GHOST_CreateOpenGLContext(g_system, glSettings);
2372 }
2373 
2375 {
2377  GHOST_DisposeOpenGLContext(g_system, (GHOST_ContextHandle)context);
2378 }
2379 
2381 {
2383  GHOST_ActivateOpenGLContext((GHOST_ContextHandle)context);
2384 }
2385 
2387 {
2389  GHOST_ReleaseOpenGLContext((GHOST_ContextHandle)context);
2390 }
2391 
2392 void WM_ghost_show_message_box(const char *title,
2393  const char *message,
2394  const char *help_label,
2395  const char *continue_label,
2396  const char *link,
2397  GHOST_DialogOptions dialog_options)
2398 {
2400  GHOST_ShowMessageBox(g_system, title, message, help_label, continue_label, link, dialog_options);
2401 }
2402 
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:733
void CTX_wm_window_set(bContext *C, struct wmWindow *win)
Definition: context.c:966
void CTX_wm_area_set(bContext *C, struct ScrArea *area)
Definition: context.c:997
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
#define G_MAIN
Definition: BKE_global.h:267
@ G_DEBUG_GPU
Definition: BKE_global.h:193
@ G_DEBUG_GHOST
Definition: BKE_global.h:199
@ G_DEBUG_WINTAB
Definition: BKE_global.h:200
@ G_DEBUG_EVENTS
Definition: BKE_global.h:177
@ G_FLAG_EVENT_SIMULATE
Definition: BKE_global.h:151
void BKE_icon_changed(int icon_id)
Definition: icons.cc:637
struct ViewLayer * BKE_view_layer_default_view(const struct Scene *scene)
struct ViewLayer * BKE_view_layer_find(const struct Scene *scene, const char *layer_name)
const char * BKE_main_blendfile_path_from_global(void)
Definition: main.c:562
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
void BKE_screen_area_map_free(struct ScrAreaMap *area_map) ATTR_NONNULL()
Definition: screen.c:686
struct ARegion struct ARegion struct ScrArea struct ScrArea * BKE_screen_find_big_area(struct bScreen *screen, int spacetype, short min)
Definition: screen.c:937
void BKE_workspace_layout_remove(struct Main *bmain, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL()
Definition: workspace.c:383
struct WorkSpace * BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition: workspace.c:516
void BKE_workspace_active_screen_set(struct WorkSpaceInstanceHook *hook, int winid, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS
Definition: workspace.c:570
void BKE_workspace_instance_hook_free(const struct Main *bmain, struct WorkSpaceInstanceHook *hook)
struct bScreen * BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook, int winid, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) SETTER_ATTRS
Activate a layout.
Definition: workspace.c:557
struct WorkSpaceInstanceHook * BKE_workspace_instance_hook_create(const struct Main *bmain, int winid)
void BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS
Definition: workspace.c:520
struct WorkSpaceLayout * BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
struct bScreen * BKE_workspace_layout_screen_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS
void BLF_cache_clear(void)
Definition: blf.c:83
void BLF_default_dpi(int dpi)
Definition: blf_default.c:27
#define BLI_assert_unreachable()
Definition: BLI_assert.h:93
#define BLI_assert(a)
Definition: BLI_assert.h:46
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
void void BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb)
Definition: BLI_listbase.h:265
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int max_ii(int a, int b)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
bool BLI_rcti_is_valid(const struct rcti *rect)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:417
void BLI_rcti_resize_y(struct rcti *rect, int y)
Definition: rct.c:593
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
void BLI_rcti_resize_x(struct rcti *rect, int x)
Definition: rct.c:587
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
void BLI_system_backtrace(FILE *fp)
Definition: system.c:62
int BLI_thread_is_main(void)
Definition: threads.cc:207
#define POINTER_AS_UINT(i)
#define UNUSED(x)
#define UNLIKELY(x)
#define ELEM(...)
#define POINTER_FROM_UINT(i)
#define LIKELY(x)
#define IFACE_(msgid)
These structs are the foundation for all linked lists in the library system.
@ S3D_DISPLAY_PAGEFLIP
@ GLOBAL_AREA_IS_HIDDEN
@ GLOBAL_AREA_ALIGN_BOTTOM
@ GLOBAL_AREA_ALIGN_TOP
@ SPACE_EMPTY
#define SPACE_TYPE_ANY
@ USER_SAVE_PROMPT
@ USER_NO_MULTITOUCH_GESTURES
@ USER_TABLET_NATIVE
@ USER_TABLET_AUTOMATIC
@ USER_TABLET_WINTAB
@ VIRTUAL_PIXEL_NATIVE
@ VIRTUAL_PIXEL_DOUBLE
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ WM_WINDOW_IS_INIT
int ED_file_extension_icon(const char *path)
Definition: filelist.c:2837
void ED_render_view_layer_changed(struct Main *bmain, struct bScreen *screen)
void ED_scene_change_update(struct Main *bmain, struct Scene *scene, struct ViewLayer *layer) ATTR_NONNULL()
Definition: scene_edit.c:160
void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen)
Definition: screen_edit.c:736
void ED_workspace_scene_data_sync(struct WorkSpaceInstanceHook *hook, Scene *scene) ATTR_NONNULL()
int ED_area_global_size_y(const ScrArea *area)
Definition: area.c:3433
struct WorkSpaceLayout * ED_workspace_layout_add(struct Main *bmain, struct WorkSpace *workspace, struct wmWindow *win, const char *name) ATTR_NONNULL()
void ED_screen_scene_change(struct bContext *C, struct wmWindow *win, struct Scene *scene, bool refresh_toolsystem)
Definition: screen_edit.c:1195
struct WorkSpaceLayout * ED_workspace_layout_duplicate(struct Main *bmain, struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, struct wmWindow *win) ATTR_NONNULL()
bool ED_workspace_change(struct WorkSpace *workspace_new, struct bContext *C, struct wmWindowManager *wm, struct wmWindow *win) ATTR_NONNULL()
Change the active workspace.
void ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win)
Definition: screen_edit.c:611
void ED_area_newspace(struct bContext *C, ScrArea *area, int type, bool skip_region_exit)
Definition: area.c:2427
void ED_screen_global_areas_refresh(struct wmWindow *win)
Definition: screen_edit.c:1070
bool ED_screen_change(struct bContext *C, struct bScreen *screen)
Change the active screen.
Definition: screen_edit.c:1135
GHOST C-API function and type declarations.
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle, uint32_t *width, uint32_t *height)
int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TSuccess GHOST_GetCursorPosition(const GHOST_SystemHandle systemhandle, const GHOST_WindowHandle windowhandle, int32_t *x, int32_t *y)
GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, GHOST_TWindowOrder order)
GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle, uint32_t width, uint32_t height)
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle, int32_t x, int32_t y)
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle, const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options)
Definition: GHOST_C-api.cpp:47
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
GHOST_WindowHandle GHOST_GetWindowUnderCursor(GHOST_SystemHandle systemhandle, int32_t x, int32_t y)
GHOST_SystemHandle GHOST_CreateSystem(void)
Definition: GHOST_C-api.cpp:25
GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
void GHOST_UseWindowFocus(bool use_focus)
bool GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, bool waitForEvent)
void GHOST_SetTitle(GHOST_WindowHandle windowhandle, const char *title)
void GHOST_BeginIME(GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete)
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle)
GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress)
GHOST_TSuccess GHOST_ReleaseOpenGLContext(GHOST_ContextHandle contexthandle)
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, bool isUnsavedChanges)
GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *intervalOut)
GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle, GHOST_ContextHandle contexthandle)
GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWindowState state)
void GHOST_SetBacktraceHandler(GHOST_TBacktraceFn backtrace_fn)
GHOST_TSuccess GHOST_ActivateOpenGLContext(GHOST_ContextHandle contexthandle)
int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle, uint32_t *width, uint32_t *height)
void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
char * GHOST_getClipboard(bool selection)
void GHOST_SetMultitouchGestures(GHOST_SystemHandle systemhandle, const bool use)
GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle, GHOST_TModifierKey mask, bool *r_is_down)
bool GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
bool GHOST_IsDialogWindow(GHOST_WindowHandle windowhandle)
void GHOST_SystemInitDebug(GHOST_SystemHandle systemhandle, GHOST_Debug debug)
Definition: GHOST_C-api.cpp:33
void GHOST_putClipboard(const char *buffer, bool selection)
GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
void GHOST_EndIME(GHOST_WindowHandle windowhandle)
bool GHOST_UseNativePixels(void)
void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle, GHOST_GLSettings glSettings)
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle parent_windowhandle, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, bool is_dialog, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings)
GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr userdata)
Definition: GHOST_C-api.cpp:59
GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval)
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
Definition: GHOST_C-api.cpp:40
GHOST_TWindowState
Definition: GHOST_Types.h:129
@ GHOST_kWindowStateMinimized
Definition: GHOST_Types.h:132
@ GHOST_kWindowStateMaximized
Definition: GHOST_Types.h:131
@ GHOST_kWindowStateNormal
Definition: GHOST_Types.h:130
@ GHOST_kWindowStateFullScreen
Definition: GHOST_Types.h:133
void * GHOST_TUserDataPtr
Definition: GHOST_Types.h:72
GHOST_TEventType
Definition: GHOST_Types.h:169
@ GHOST_kEventWindowClose
Definition: GHOST_Types.h:189
@ GHOST_kEventWindowMove
Definition: GHOST_Types.h:194
@ GHOST_kEventWindowSize
Definition: GHOST_Types.h:193
@ GHOST_kEventDraggingDropDone
Definition: GHOST_Types.h:200
@ GHOST_kEventNativeResolutionChange
Definition: GHOST_Types.h:203
@ GHOST_kEventCursorMove
Definition: GHOST_Types.h:172
@ GHOST_kEventOpenMainFile
Definition: GHOST_Types.h:202
@ GHOST_kEventButtonUp
Definition: GHOST_Types.h:174
@ GHOST_kEventWindowActivate
Definition: GHOST_Types.h:190
@ GHOST_kEventTrackpad
Definition: GHOST_Types.h:176
@ GHOST_kEventWindowUpdate
Definition: GHOST_Types.h:192
@ GHOST_kEventWindowDeactivate
Definition: GHOST_Types.h:191
@ GHOST_kEventButtonDown
Definition: GHOST_Types.h:173
@ GHOST_kEventWindowDPIHintChanged
Definition: GHOST_Types.h:195
@ GHOST_kEventKeyUp
Definition: GHOST_Types.h:184
@ GHOST_kEventQuitRequest
Definition: GHOST_Types.h:187
@ GHOST_kDebugDefault
Definition: GHOST_Types.h:586
@ GHOST_kDebugWintab
Definition: GHOST_Types.h:587
@ GHOST_glStereoVisual
Definition: GHOST_Types.h:62
@ GHOST_glDebugContext
Definition: GHOST_Types.h:63
void * GHOST_TEventDataPtr
Definition: GHOST_Types.h:427
@ GHOST_kKeyLeftAlt
Definition: GHOST_Types.h:328
@ GHOST_kKeyLeftControl
Definition: GHOST_Types.h:326
@ GHOST_kKeyOS
Definition: GHOST_Types.h:330
@ GHOST_kKeyUnknown
Definition: GHOST_Types.h:260
@ GHOST_kKeyLeftShift
Definition: GHOST_Types.h:324
@ GHOST_kDrawingContextTypeOpenGL
Definition: GHOST_Types.h:150
@ GHOST_kWindowOrderTop
Definition: GHOST_Types.h:146
@ GHOST_kWindowOrderBottom
Definition: GHOST_Types.h:146
GHOST_TModifierKey
Definition: GHOST_Types.h:118
@ GHOST_kModifierKeyRightControl
Definition: GHOST_Types.h:124
@ GHOST_kModifierKeyLeftControl
Definition: GHOST_Types.h:123
@ GHOST_kModifierKeyRightAlt
Definition: GHOST_Types.h:122
@ GHOST_kModifierKeyOS
Definition: GHOST_Types.h:125
@ GHOST_kModifierKeyRightShift
Definition: GHOST_Types.h:120
@ GHOST_kModifierKeyLeftAlt
Definition: GHOST_Types.h:121
@ GHOST_kModifierKeyLeftShift
Definition: GHOST_Types.h:119
void(* GHOST_TBacktraceFn)(void *file_handle)
Definition: GHOST_Types.h:45
@ GHOST_kDragnDropTypeFilenames
Definition: GHOST_Types.h:476
@ GHOST_kTabletAutomatic
Definition: GHOST_Types.h:90
@ GHOST_kTabletWinPointer
Definition: GHOST_Types.h:93
@ GHOST_kTabletWintab
Definition: GHOST_Types.h:94
GHOST_DialogOptions
Definition: GHOST_Types.h:67
void GPU_context_discard(GPUContext *)
Definition: gpu_context.cc:110
GPUContext * GPU_context_create(void *ghost_window)
Definition: gpu_context.cc:93
void GPU_context_active_set(GPUContext *)
Definition: gpu_context.cc:127
GPUFrameBuffer * GPU_framebuffer_back_get(void)
GPUFrameBuffer * GPU_framebuffer_active_get(void)
void GPU_init(void)
Definition: gpu_init_exit.c:24
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble right
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
@ GPU_DATA_UBYTE
Definition: GPU_texture.h:174
@ GPU_DATA_FLOAT
Definition: GPU_texture.h:171
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Platform independent time functions.
#define C
Definition: RandGen.cpp:25
void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers)
eWindowAlignment
Definition: WM_api.h:216
@ WIN_ALIGN_LOCATION_CENTER
Definition: WM_api.h:218
@ WIN_ALIGN_PARENT_CENTER
Definition: WM_api.h:219
@ KM_NOTHING
Definition: WM_types.h:266
@ KM_RELEASE
Definition: WM_types.h:268
#define NC_WINDOW
Definition: WM_types.h:325
#define WM_DRAG_PATH
Definition: WM_types.h:1050
@ WM_DRAG_NOP
Definition: WM_types.h:1058
#define NC_SCREEN
Definition: WM_types.h:327
#define NA_ADDED
Definition: WM_types.h:525
#define NA_EDITED
Definition: WM_types.h:523
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
@ KM_CTRL
Definition: WM_types.h:239
@ KM_ALT
Definition: WM_types.h:240
@ KM_OSKEY
Definition: WM_types.h:242
@ KM_SHIFT
Definition: WM_types.h:238
@ WM_TIMER_TAGGED_FOR_REMOVAL
Definition: WM_types.h:853
@ WM_TIMER_NO_FREE_CUSTOM_DATA
Definition: WM_types.h:848
#define ND_LAYOUTDELETE
Definition: WM_types.h:371
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void activate(bool forceActivation=false) const
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
double time
Scene scene
void * user_data
#define str(s)
uint pos
void GPU_clear_color(float red, float green, float blue, float alpha)
void GPU_frontbuffer_read_pixels(int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data)
const int state
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
static int left
#define G(x, y, z)
static unsigned a[3]
Definition: RandGen.cpp:78
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:4874
unsigned __int64 uint64_t
Definition: stdint.h:90
GHOST_TEventDataPtr data
Definition: GHOST_Types.h:489
GHOST_TDragnDropTypes dataType
Definition: GHOST_Types.h:487
uint8_t ** strings
Definition: GHOST_Types.h:508
int icon_id
Definition: DNA_ID.h:389
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase wm
Definition: BKE_main.h:197
struct wmTimer * reporttimer
ListBase areabase
char name[64]
eWinOverrideFlag override_flag
Definition: wm_window.c:106
bool window_focus
Definition: wm_window.c:108
int windowstate
Definition: wm_window.c:105
bool native_pixels
Definition: wm_window.c:109
Wrapper for bScreen.
ListBase areabase
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
int xy[2]
Definition: WM_types.h:682
int prev_xy[2]
Definition: WM_types.h:728
short keymodifier
Definition: WM_types.h:702
uint8_t modifier
Definition: WM_types.h:693
wmGenericCallbackFn exec
Definition: WM_types.h:136
struct ReportList * reports
double timestep
Definition: WM_types.h:863
double stime
Definition: WM_types.h:881
int event_type
Definition: WM_types.h:865
double ltime
Definition: WM_types.h:877
wmTimerFlags flags
Definition: WM_types.h:867
void * customdata
Definition: WM_types.h:869
struct wmWindow * win
Definition: WM_types.h:860
double ntime
Definition: WM_types.h:879
struct wmKeyConfig * defaultconf
struct ReportList reports
struct wmWindow * winactive
struct wmWindow * windrawable
struct wmWindow * parent
struct wmEvent * eventstate
struct wmEvent * event_last_handled
struct Scene * scene
struct wmIMEData * ime_data
char view_layer_name[64]
struct wmWindow * next
ScrAreaMap global_areas
struct WorkSpaceInstanceHook * workspace_hook
struct Stereo3dFormat * stereo3d_format
void PIL_sleep_ms(int ms)
Definition: time.c:84
double PIL_check_seconds_timer(void)
Definition: time.c:64
void WM_check(bContext *C)
Definition: wm.c:472
@ WM_CURSOR_DEFAULT
Definition: wm_cursors.h:18
void WM_event_start_drag(bContext *C, int icon, int type, void *poin, double value, unsigned int flags)
Definition: wm_dragdrop.cc:237
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
Definition: wm_dragdrop.cc:76
int winid
Definition: wm_draw.c:134
void wm_draw_update(bContext *C)
Definition: wm_draw.c:1302
wmEventHandler_Dropbox * WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
void wm_event_do_handlers(bContext *C)
void WM_main_add_notifier(unsigned int type, void *reference)
wmEvent * wm_event_add(wmWindow *win, const wmEvent *event_to_add)
void WM_event_add_notifier_ex(wmWindowManager *wm, const wmWindow *win, uint type, void *reference)
void wm_event_free_all(wmWindow *win)
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
void wm_event_do_notifiers(bContext *C)
void wm_event_init_from_window(wmWindow *win, wmEvent *event)
void WM_event_remove_handlers(bContext *C, ListBase *handlers)
@ TIMERNOTIFIER
@ TIMERJOBS
@ TIMERAUTOSAVE
@ EVENT_NONE
@ MOUSEMOVE
@ EVT_DROP
@ EVT_DATA_DRAGDROP
@ EVT_DATA_TIMER
bool wm_file_or_session_data_has_unsaved_changes(const Main *bmain, const wmWindowManager *wm)
Definition: wm_files.c:160
void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt))
Definition: wm_files.c:1989
wmOperatorType * ot
Definition: wm_files.c:3479
void wm_close_file_dialog(bContext *C, wmGenericCallback *post_action)
Definition: wm_files.c:4038
void WM_gestures_free_all(wmWindow *win)
Definition: wm_gesture.c:94
void wm_exit_schedule_delayed(const bContext *C)
Definition: wm_init_exit.c:421
void wm_jobs_timer_end(wmWindowManager *wm, wmTimer *wt)
Definition: wm_jobs.c:605
void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt)
Definition: wm_jobs.c:615
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
Definition: wm_operators.c:661
void WM_operator_properties_free(PointerRNA *ptr)
Definition: wm_operators.c:783
modifierKeyType
Definition: wm_window.c:971
@ SHIFT
Definition: wm_window.c:972
@ OS
Definition: wm_window.c:975
@ ALT
Definition: wm_window.c:974
@ CONTROL
Definition: wm_window.c:973
eWinOverrideFlag
Definition: wm_window.c:89
@ WIN_OVERRIDE_WINSTATE
Definition: wm_window.c:91
@ WIN_OVERRIDE_GEOM
Definition: wm_window.c:90
int wm_window_new_main_exec(bContext *C, wmOperator *op)
Definition: wm_window.c:897
static void wm_window_ghostwindow_ensure(wmWindowManager *wm, wmWindow *win, bool is_dialog)
Definition: wm_window.c:599
wmWindow * WM_window_find_under_cursor(wmWindow *win, const int mval[2], int r_mval[2])
Definition: wm_window.c:1904
void WM_window_set_active_scene(Main *bmain, bContext *C, wmWindow *win, Scene *scene)
Definition: wm_window.c:2188
void wm_cursor_position_from_ghost_screen_coords(wmWindow *win, int *x, int *y)
Definition: wm_window.c:948
static GHOST_SystemHandle g_system
Definition: wm_window.c:87
int wm_window_close_exec(bContext *C, wmOperator *UNUSED(op))
Definition: wm_window.c:865
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
Definition: wm_window.c:1682
void * WM_opengl_context_create(void)
Definition: wm_window.c:2353
void WM_clipboard_text_set(const char *buf, bool selection)
Definition: wm_window.c:1780
void wm_window_raise(wmWindow *win)
Definition: wm_window.c:1868
void WM_window_ensure_active_view_layer(wmWindow *win)
Definition: wm_window.c:2255
Scene * WM_windows_scene_get_from_screen(const wmWindowManager *wm, const bScreen *screen)
Definition: wm_window.c:2151
void wm_ghost_exit(void)
Definition: wm_window.c:1600
int WM_window_pixels_y(const wmWindow *win)
Definition: wm_window.c:2082
static void wm_window_check_size(rcti *rect)
Definition: wm_window.c:144
void wm_window_swap_buffers(wmWindow *win)
Push rendered buffer to the screen.
Definition: wm_window.c:1883
#define GHOST_WINDOW_STATE_DEFAULT
Definition: wm_window.c:94
void wm_window_reset_drawable(void)
Definition: wm_window.c:1049
void WM_window_set_active_workspace(bContext *C, wmWindow *win, WorkSpace *workspace)
Definition: wm_window.c:2271
wmWindow * wm_window_copy(Main *bmain, wmWindowManager *wm, wmWindow *win_src, const bool duplicate_layout, const bool child)
Definition: wm_window.c:267
void wm_cursor_position_to_ghost_client_coords(wmWindow *win, int *x, int *y)
Definition: wm_window.c:939
void WM_init_state_normal_set(void)
Definition: wm_window.c:2006
void wm_cursor_position_from_ghost_client_coords(wmWindow *win, int *x, int *y)
Definition: wm_window.c:930
void wm_cursor_position_to_ghost_screen_coords(wmWindow *win, int *x, int *y)
Definition: wm_window.c:954
char * WM_clipboard_text_get_firstline(bool selection, int *r_len)
Definition: wm_window.c:1775
void WM_opengl_context_activate(void *context)
Definition: wm_window.c:2380
static struct WMInitStruct wm_init_state
static int query_qual(modifierKeyType qual)
Definition: wm_window.c:979
ViewLayer * WM_windows_view_layer_get_from_screen(const wmWindowManager *wm, const bScreen *screen)
Definition: wm_window.c:2162
static void wm_window_ensure_eventstate(wmWindow *win)
Definition: wm_window.c:504
void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win)
Definition: wm_window.c:339
static bool wm_window_timer(const bContext *C)
Definition: wm_window.c:1477
void wm_window_title(wmWindowManager *wm, wmWindow *win)
Definition: wm_window.c:417
void WM_cursor_warp(wmWindow *win, int x, int y)
Definition: wm_window.c:2054
wmWindow * wm_window_new(const Main *bmain, wmWindowManager *wm, wmWindow *parent, bool dialog)
Definition: wm_window.c:252
static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wmWindow *win, bool is_dialog)
Definition: wm_window.c:515
bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut)
Definition: wm_window.c:1893
WorkSpaceLayout * WM_window_get_active_layout(const wmWindow *win)
Definition: wm_window.c:2290
static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win)
Definition: wm_window.c:156
void WM_opengl_context_release(void *context)
Definition: wm_window.c:2386
bool WM_window_is_fullscreen(const wmWindow *win)
Definition: wm_window.c:2126
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
Definition: wm_window.c:366
uint * WM_window_pixels_read(wmWindowManager *wm, wmWindow *win, int r_size[2])
Definition: wm_window.c:1953
void wm_window_set_swap_interval(wmWindow *win, int interval)
Definition: wm_window.c:1888
wmTimer * WM_event_add_timer_notifier(wmWindowManager *wm, wmWindow *win, unsigned int type, double timestep)
Definition: wm_window.c:1647
void WM_window_set_active_screen(wmWindow *win, WorkSpace *workspace, bScreen *screen)
Definition: wm_window.c:2306
static void wm_confirm_quit(bContext *C)
Definition: wm_window.c:332
void wm_get_desktopsize(int *r_width, int *r_height)
Definition: wm_window.c:133
void WM_init_native_pixels(bool do_it)
Definition: wm_window.c:2023
void wm_window_set_size(wmWindow *win, int width, int height)
Definition: wm_window.c:1852
void WM_init_state_maximized_set(void)
Definition: wm_window.c:2012
void WM_window_set_dpi(const wmWindow *win)
Definition: wm_window.c:447
void wm_window_delete_removed_timers(wmWindowManager *wm)
Definition: wm_window.c:1669
void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, bool do_sleep)
Definition: wm_window.c:1614
void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm)
Definition: wm_window.c:684
char * WM_clipboard_text_get(bool selection, int *r_len)
Definition: wm_window.c:1770
static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr)
Definition: wm_window.c:1071
void wm_window_clear_drawable(wmWindowManager *wm)
Definition: wm_window.c:1021
void wm_window_process_events(const bContext *C)
Definition: wm_window.c:1537
bScreen * WM_window_get_active_screen(const wmWindow *win)
Definition: wm_window.c:2300
static int find_free_winid(wmWindowManager *wm)
Definition: wm_window.c:240
void wm_get_screensize(int *r_width, int *r_height)
Definition: wm_window.c:123
void WM_progress_clear(wmWindow *win)
Definition: wm_window.c:1833
void WM_init_state_size_set(int stax, int stay, int sizx, int sizy)
Definition: wm_window.c:1991
void WM_opengl_context_dispose(void *context)
Definition: wm_window.c:2374
void WM_progress_set(wmWindow *win, float progress)
Definition: wm_window.c:1825
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
Definition: wm_window.c:1028
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2217
int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Definition: wm_window.c:909
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
Definition: wm_window.c:2266
static bool wm_window_update_size_position(wmWindow *win)
Definition: wm_window.c:696
bool WM_window_is_temp_screen(const wmWindow *win)
Definition: wm_window.c:2311
void WM_window_rect_calc(const wmWindow *win, rcti *r_rect)
Definition: wm_window.c:2089
bool WM_window_is_maximized(const wmWindow *win)
Definition: wm_window.c:2131
void WM_window_set_active_layout(wmWindow *win, WorkSpace *workspace, WorkSpaceLayout *layout)
Definition: wm_window.c:2295
void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
Definition: wm_window.c:2093
void WM_window_pixel_sample_read(const wmWindowManager *wm, const wmWindow *win, const int pos[2], float r_col[3])
Definition: wm_window.c:1922
void WM_window_set_active_view_layer(wmWindow *win, ViewLayer *view_layer)
Definition: wm_window.c:2237
void wm_window_get_position(wmWindow *win, int *r_pos_x, int *r_pos_y)
Definition: wm_window.c:1846
static char * wm_clipboard_text_get_ex(bool selection, int *r_len, bool firstline)
Definition: wm_window.c:1725
static void wm_window_update_eventstate(wmWindow *win)
Definition: wm_window.c:498
int WM_window_pixels_x(const wmWindow *win)
Definition: wm_window.c:2076
wmWindow * wm_window_copy_test(bContext *C, wmWindow *win_src, const bool duplicate_layout, const bool child)
Definition: wm_window.c:297
void WM_event_remove_timer_notifier(wmWindowManager *wm, wmWindow *win, wmTimer *timer)
Definition: wm_window.c:1713
void WM_init_input_devices(void)
Definition: wm_window.c:2034
static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool activate)
Definition: wm_window.c:1010
void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
Definition: wm_window.c:182
int wm_window_new_exec(bContext *C, wmOperator *op)
Definition: wm_window.c:873
WorkSpace * WM_windows_workspace_get_from_screen(const wmWindowManager *wm, const bScreen *screen)
Definition: wm_window.c:2173
void wm_ghost_init(bContext *C)
Definition: wm_window.c:1566
static void wm_save_file_on_quit_dialog_callback(bContext *C, void *UNUSED(user_data))
Definition: wm_window.c:323
void WM_init_state_fullscreen_set(void)
Definition: wm_window.c:2000
void WM_windows_scene_data_sync(const ListBase *win_lb, Scene *scene)
Definition: wm_window.c:2142
void wm_window_ghostwindows_ensure(wmWindowManager *wm)
Definition: wm_window.c:661
wmWindow * WM_window_open(bContext *C, const char *title, int x, int y, int sizex, int sizey, int space_type, bool toplevel, bool dialog, bool temp, eWindowAlignment alignment)
Definition: wm_window.c:721
void WM_init_window_focus_set(bool do_it)
Definition: wm_window.c:2018
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2183
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
Definition: wm_window.c:1630
void wm_cursor_position_get(wmWindow *win, int *r_x, int *r_y)
Definition: wm_window.c:960
void wm_window_lower(wmWindow *win)
Definition: wm_window.c:1863
void WM_ghost_show_message_box(const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options)
Definition: wm_window.c:2392
bool wm_xr_events_handle(wmWindowManager *wm)
Definition: wm_xr.c:122