[Bf-blender-cvs] [78bd155f5c0] master: Cleanup: disambiguate 'queue' struct members

Campbell Barton noreply at git.blender.org
Fri Mar 5 05:00:36 CET 2021


Commit: 78bd155f5c05a2f3147fee22d9b4af341b0a259b
Author: Campbell Barton
Date:   Fri Mar 5 14:54:29 2021 +1100
Branches: master
https://developer.blender.org/rB78bd155f5c05a2f3147fee22d9b4af341b0a259b

Cleanup: disambiguate 'queue' struct members

The term queue isn't very descruptive on it's own, use:

- wmWindow.event_queue
- wmWindowManager.notifier_queue

===================================================================

M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/windowmanager/intern/wm.c
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index ac1fb50d0c2..33b038694cf 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -154,8 +154,8 @@ typedef struct wmWindowManager {
   /** Operator registry. */
   ListBase operators;
 
-  /** Refresh/redraw wmNotifier structs. */
-  ListBase queue;
+  /** Refresh/redraw #wmNotifier structs. */
+  ListBase notifier_queue;
 
   /** Information and error reports. */
   struct ReportList reports;
@@ -292,8 +292,8 @@ typedef struct wmWindow {
    * Currently WIN32, runtime-only data. */
   struct wmIMEData *ime_data;
 
-  /** All events (ghost level events were handled). */
-  ListBase queue;
+  /** All events #wmEvent (ghost level events were handled). */
+  ListBase event_queue;
   /** Window+screen handlers, handled last. */
   ListBase handlers;
   /** Priority handlers, handled first. */
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index a9c0d1dd8fe..f9fb484c055 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -172,7 +172,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
     win->ime_data = NULL;
 #endif
 
-    BLI_listbase_clear(&win->queue);
+    BLI_listbase_clear(&win->event_queue);
     BLI_listbase_clear(&win->handlers);
     BLI_listbase_clear(&win->modalhandlers);
     BLI_listbase_clear(&win->gesture);
@@ -198,7 +198,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
   BLI_listbase_clear(&wm->timers);
   BLI_listbase_clear(&wm->operators);
   BLI_listbase_clear(&wm->paintcursors);
-  BLI_listbase_clear(&wm->queue);
+  BLI_listbase_clear(&wm->notifier_queue);
   BKE_reports_init(&wm->reports, RPT_STORE);
 
   BLI_listbase_clear(&wm->keyconfigs);
@@ -590,7 +590,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
     WM_keyconfig_free(keyconf);
   }
 
-  BLI_freelistN(&wm->queue);
+  BLI_freelistN(&wm->notifier_queue);
 
   if (wm->message_bus != NULL) {
     WM_msgbus_destroy(wm->message_bus);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 749dd11335b..d4ea7b36c9c 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -126,12 +126,12 @@ wmEvent *wm_event_add_ex(wmWindow *win,
   *event = *event_to_add;
 
   if (event_to_add_after == NULL) {
-    BLI_addtail(&win->queue, event);
+    BLI_addtail(&win->event_queue, event);
   }
   else {
     /* Note: strictly speaking this breaks const-correctness,
      * however we're only changing 'next' member. */
-    BLI_insertlinkafter(&win->queue, (void *)event_to_add_after, event);
+    BLI_insertlinkafter(&win->event_queue, (void *)event_to_add_after, event);
   }
   return event;
 }
@@ -205,7 +205,7 @@ void wm_event_free(wmEvent *event)
 
 static void wm_event_free_last(wmWindow *win)
 {
-  wmEvent *event = BLI_poptail(&win->queue);
+  wmEvent *event = BLI_poptail(&win->event_queue);
   if (event != NULL) {
     wm_event_free(event);
   }
@@ -214,7 +214,7 @@ static void wm_event_free_last(wmWindow *win)
 void wm_event_free_all(wmWindow *win)
 {
   wmEvent *event;
-  while ((event = BLI_pophead(&win->queue))) {
+  while ((event = BLI_pophead(&win->event_queue))) {
     wm_event_free(event);
   }
 }
@@ -232,7 +232,7 @@ void wm_event_init_from_window(wmWindow *win, wmEvent *event)
 
 static bool wm_test_duplicate_notifier(const wmWindowManager *wm, uint type, void *reference)
 {
-  LISTBASE_FOREACH (wmNotifier *, note, &wm->queue) {
+  LISTBASE_FOREACH (wmNotifier *, note, &wm->notifier_queue) {
     if ((note->category | note->data | note->subtype | note->action) == type &&
         note->reference == reference) {
       return true;
@@ -250,7 +250,7 @@ void WM_event_add_notifier_ex(wmWindowManager *wm, const wmWindow *win, uint typ
 
   wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier");
 
-  BLI_addtail(&wm->queue, note);
+  BLI_addtail(&wm->notifier_queue, note);
 
   note->window = win;
 
@@ -279,7 +279,7 @@ void WM_main_add_notifier(unsigned int type, void *reference)
 
   wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier");
 
-  BLI_addtail(&wm->queue, note);
+  BLI_addtail(&wm->notifier_queue, note);
 
   note->category = type & NOTE_CATEGORY;
   note->data = type & NOTE_DATA;
@@ -298,7 +298,7 @@ void WM_main_remove_notifier_reference(const void *reference)
   wmWindowManager *wm = bmain->wm.first;
 
   if (wm) {
-    LISTBASE_FOREACH_MUTABLE (wmNotifier *, note, &wm->queue) {
+    LISTBASE_FOREACH_MUTABLE (wmNotifier *, note, &wm->notifier_queue) {
       if (note->reference == reference) {
         /* Don't remove because this causes problems for #wm_event_do_notifiers
          * which may be looping on the data (deleting screens). */
@@ -450,7 +450,7 @@ void wm_event_do_notifiers(bContext *C)
 
     CTX_wm_window_set(C, win);
 
-    LISTBASE_FOREACH_MUTABLE (wmNotifier *, note, &wm->queue) {
+    LISTBASE_FOREACH_MUTABLE (wmNotifier *, note, &wm->notifier_queue) {
       if (note->category == NC_WM) {
         if (ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) {
           wm->file_saved = 1;
@@ -539,7 +539,7 @@ void wm_event_do_notifiers(bContext *C)
 
   /* The notifiers are sent without context, to keep it clean. */
   wmNotifier *note;
-  while ((note = BLI_pophead(&wm->queue))) {
+  while ((note = BLI_pophead(&wm->notifier_queue))) {
     LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
       Scene *scene = WM_window_get_active_scene(win);
       bScreen *screen = WM_window_get_active_screen(win);
@@ -3234,7 +3234,7 @@ static bool wm_event_pie_filter(wmWindow *win, const wmEvent *event)
 /**
  * Account for the special case when events are being handled and a file is loaded.
  * In this case event handling exits early, however when "Load UI" is disabled
- * the even will still be in #wmWindow.queue.
+ * the even will still be in #wmWindow.event_queue.
  *
  * Without this it's possible to continuously handle the same event, see: T76484.
  */
@@ -3242,7 +3242,7 @@ static void wm_event_free_and_remove_from_queue_if_valid(wmEvent *event)
 {
   LISTBASE_FOREACH (wmWindowManager *, wm, &G_MAIN->wm) {
     LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
-      if (BLI_remlink_safe(&win->queue, event)) {
+      if (BLI_remlink_safe(&win->event_queue, event)) {
         wm_event_free(event);
         return;
       }
@@ -3331,7 +3331,7 @@ void wm_event_do_handlers(bContext *C)
     }
 
     wmEvent *event;
-    while ((event = win->queue.first)) {
+    while ((event = win->event_queue.first)) {
       int action = WM_HANDLER_CONTINUE;
 
       /* Active screen might change during handlers, update pointer. */
@@ -3348,7 +3348,7 @@ void wm_event_do_handlers(bContext *C)
         if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
           CLOG_INFO(WM_LOG_HANDLERS, 1, "event filtered due to pie button pressed");
         }
-        BLI_remlink(&win->queue, event);
+        BLI_remlink(&win->event_queue, event);
         wm_event_free(event);
         continue;
       }
@@ -3505,11 +3505,11 @@ void wm_event_do_handlers(bContext *C)
       win->eventstate->prevy = event->y;
 
       /* Unlink and free here, blender-quit then frees all. */
-      BLI_remlink(&win->queue, event);
+      BLI_remlink(&win->event_queue, event);
       wm_event_free(event);
     }
 
-    /* Only add mousemove when queue was read entirely. */
+    /* Only add mouse-move when the event queue was read entirely. */
     if (win->addmousemove && win->eventstate) {
       wmEvent tevent = *(win->eventstate);
       // printf("adding MOUSEMOVE %d %d\n", tevent.x, tevent.y);
@@ -4395,7 +4395,7 @@ static void wm_event_prev_click_set(wmEvent *event, wmEvent *event_state)
 
 static wmEvent *wm_event_add_mousemove(wmWindow *win, const wmEvent *event)
 {
-  wmEvent *event_last = win->queue.last;
+  wmEvent *event_last = win->event_queue.last;
 
   /* Some painting operators want accurate mouse events, they can
    * handle in between mouse move moves, others can happily ignore
@@ -4417,7 +4417,7 @@ static wmEvent *wm_event_add_trackpad(wmWindow *win, const wmEvent *event, int d
 {
   /* Ignore in between trackpad events for performance, we only need high accuracy
    * for painting with mouse moves, for navigation using the accumulated value is ok. */
-  wmEvent *event_last = win->queue.last;
+  wmEvent *event_last = win->event_queue.last;
   if (event_last && event_last->type == event->type) {
     deltax += event_last->x - event_last->prevx;
     deltay += event_last->y - event_last->prevy;
@@ -4434,7 +4434,7 @@ static wmEvent *wm_event_add_trackpad(wmWindow *win, const wmEvent *event, int d
 }
 
 /**
- * Windows store own event queues #wmWindow.queue (no #bContext here).
+ * Windows store own event queues #wmWindow.event_queue (no #bContext here).
  */
 void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata)
 {
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index ada4093080c..f09a9aecb1d 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1691,7 +1691,7 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
 
   /* there might be events in queue with this timer as customdata */
   LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
-    LISTBASE_FOREACH (wmEvent *, event, &win->queue) {
+    LISTBASE_FOREACH (wmEvent *, event, &win->event_queue) {
       if (event->customdata == wt) {
         event->customdata = NULL;
         event->type = EVENT_NONE; /* timer users customdata, dont want NULL == NULL */



More information about the Bf-blender-cvs mailing list