[Bf-blender-cvs] [15bb6e63e8f] master: Fix errors from conflicts in last merge

Julian Eisel noreply at git.blender.org
Tue Feb 4 20:23:20 CET 2020


Commit: 15bb6e63e8f7a04cbfc50d51466ddc19253bc52b
Author: Julian Eisel
Date:   Tue Feb 4 20:21:30 2020 +0100
Branches: master
https://developer.blender.org/rB15bb6e63e8f7a04cbfc50d51466ddc19253bc52b

Fix errors from conflicts in last merge

Handled merge conflicts wrong apparently. When checking changes before
committing, everything seemed fine...

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

M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ebcdef47eee..4b525189368 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1,4 +1,4 @@
-/*
+/*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
@@ -70,7 +70,6 @@
 #include "RNA_access.h"
 
 #include "UI_interface.h"
-#include "UI_view2d.h"
 
 #include "PIL_time.h"
 
@@ -84,8 +83,6 @@
 #include "wm_event_system.h"
 #include "wm_event_types.h"
 
-#include "RNA_enum_types.h"
-
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
 
@@ -104,7 +101,6 @@
 #define USE_GIZMO_MOUSE_PRIORITY_HACK
 
 static void wm_notifier_clear(wmNotifier *note);
-static void update_tablet_data(wmWindow *win, wmEvent *event);
 
 static int wm_operator_call_internal(bContext *C,
                                      wmOperatorType *ot,
@@ -114,6 +110,8 @@ static int wm_operator_call_internal(bContext *C,
                                      const bool poll_only,
                                      wmEvent *event);
 
+static bool wm_operator_check_locked_interface(bContext *C, wmOperatorType *ot);
+
 /* -------------------------------------------------------------------- */
 /** \name Event Management
  * \{ */
@@ -126,14 +124,6 @@ wmEvent *wm_event_add_ex(wmWindow *win,
 
   *event = *event_to_add;
 
-  update_tablet_data(win, event);
-
-  if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
-    /* We could have a preference to support relative tablet motion (we can't detect that). */
-    event->is_motion_absolute = ((event->tablet_data != NULL) &&
-                                 (event->tablet_data->Active != GHOST_kTabletModeNone));
-  }
-
   if (event_to_add_after == NULL) {
     BLI_addtail(&win->queue, event);
   }
@@ -177,10 +167,6 @@ void wm_event_free(wmEvent *event)
     }
   }
 
-  if (event->tablet_data) {
-    MEM_freeN((void *)event->tablet_data);
-  }
-
   MEM_freeN(event);
 }
 
@@ -195,9 +181,6 @@ void wm_event_free_all(wmWindow *win)
 
 void wm_event_init_from_window(wmWindow *win, wmEvent *event)
 {
-  /* make sure we don't copy any owned pointers */
-  BLI_assert(win->eventstate->tablet_data == NULL);
-
   *event = *(win->eventstate);
 }
 
@@ -716,16 +699,6 @@ void WM_report_banners_cancel(Main *bmain)
   WM_event_remove_timer(wm, NULL, wm->reports.reporttimer);
 }
 
-bool WM_event_is_last_mousemove(const wmEvent *event)
-{
-  while ((event = event->next)) {
-    if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
-      return false;
-    }
-  }
-  return true;
-}
-
 #ifdef WITH_INPUT_NDOF
 void WM_ndof_deadzone_set(float deadzone)
 {
@@ -1239,105 +1212,6 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
   }
 }
 
-#if 1 /* may want to disable operator remembering previous state for testing */
-
-static bool operator_last_properties_init_impl(wmOperator *op, IDProperty *last_properties)
-{
-  bool changed = false;
-  IDPropertyTemplate val = {0};
-  IDProperty *replaceprops = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
-  PropertyRNA *iterprop;
-
-  CLOG_INFO(WM_LOG_OPERATORS, 1, "loading previous properties for '%s'", op->type->idname);
-
-  iterprop = RNA_struct_iterator_property(op->type->srna);
-
-  RNA_PROP_BEGIN (op->ptr, itemptr, iterprop) {
-    PropertyRNA *prop = itemptr.data;
-    if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
-      if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
-        const char *identifier = RNA_property_identifier(prop);
-        IDProperty *idp_src = IDP_GetPropertyFromGroup(last_properties, identifier);
-        if (idp_src) {
-          IDProperty *idp_dst = IDP_CopyProperty(idp_src);
-
-          /* note - in the future this may need to be done recursively,
-           * but for now RNA doesn't access nested operators */
-          idp_dst->flag |= IDP_FLAG_GHOST;
-
-          /* add to temporary group instead of immediate replace,
-           * because we are iterating over this group */
-          IDP_AddToGroup(replaceprops, idp_dst);
-          changed = true;
-        }
-      }
-    }
-  }
-  RNA_PROP_END;
-
-  IDP_MergeGroup(op->properties, replaceprops, true);
-  IDP_FreeProperty(replaceprops);
-  return changed;
-}
-
-bool WM_operator_last_properties_init(wmOperator *op)
-{
-  bool changed = false;
-  if (op->type->last_properties) {
-    changed |= operator_last_properties_init_impl(op, op->type->last_properties);
-    for (wmOperator *opm = op->macro.first; opm; opm = opm->next) {
-      IDProperty *idp_src = IDP_GetPropertyFromGroup(op->type->last_properties, opm->idname);
-      if (idp_src) {
-        changed |= operator_last_properties_init_impl(opm, idp_src);
-      }
-    }
-  }
-  return changed;
-}
-
-bool WM_operator_last_properties_store(wmOperator *op)
-{
-  if (op->type->last_properties) {
-    IDP_FreeProperty(op->type->last_properties);
-    op->type->last_properties = NULL;
-  }
-
-  if (op->properties) {
-    CLOG_INFO(WM_LOG_OPERATORS, 1, "storing properties for '%s'", op->type->idname);
-    op->type->last_properties = IDP_CopyProperty(op->properties);
-  }
-
-  if (op->macro.first != NULL) {
-    for (wmOperator *opm = op->macro.first; opm; opm = opm->next) {
-      if (opm->properties) {
-        if (op->type->last_properties == NULL) {
-          op->type->last_properties = IDP_New(
-              IDP_GROUP, &(IDPropertyTemplate){0}, "wmOperatorProperties");
-        }
-        IDProperty *idp_macro = IDP_CopyProperty(opm->properties);
-        STRNCPY(idp_macro->name, opm->type->idname);
-        IDP_ReplaceInGroup(op->type->last_properties, idp_macro);
-      }
-    }
-  }
-
-  return (op->type->last_properties != NULL);
-}
-
-#else
-
-bool WM_operator_last_properties_init(wmOperator *UNUSED(op))
-{
-  return false;
-}
-
-bool WM_operator_last_properties_store(wmOperator *UNUSED(op))
-{
-  return false;
-}
-
-#endif
-
 /**
  * Also used for exec when 'event' is NULL.
  */
@@ -1892,42 +1766,6 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
   }
 }
 
-/* do userdef mappings */
-int WM_userdef_event_map(int kmitype)
-{
-  switch (kmitype) {
-    case WHEELOUTMOUSE:
-      return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
-    case WHEELINMOUSE:
-      return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
-  }
-
-  return kmitype;
-}
-
-/**
- * Use so we can check if 'wmEvent.type' is released in modal operators.
- *
- * An alternative would be to add a 'wmEvent.type_nokeymap'... or similar.
- */
-int WM_userdef_event_type_from_keymap_type(int kmitype)
-{
-  switch (kmitype) {
-    case EVT_TWEAK_L:
-      return LEFTMOUSE;
-    case EVT_TWEAK_M:
-      return MIDDLEMOUSE;
-    case EVT_TWEAK_R:
-      return RIGHTMOUSE;
-    case WHEELOUTMOUSE:
-      return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE;
-    case WHEELINMOUSE:
-      return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE;
-  }
-
-  return kmitype;
-}
-
 static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
 {
   if (kmi->flag & KMI_INACTIVE) {
@@ -1949,19 +1787,16 @@ static bool wm_eventmatch(const wmEvent *winevent, const wmKeyMapItem *kmi)
 
   if (kmitype != KM_ANY) {
     if (ELEM(kmitype, TABLET_STYLUS, TABLET_ERASER)) {
-      const wmTabletData *wmtab = winevent->tablet_data;
+      const wmTabletData *wmtab = &winevent->tablet;
 
-      if (wmtab == NULL) {
-        return false;
-      }
-      else if (winevent->type != LEFTMOUSE) {
+      if (winevent->type != LEFTMOUSE) {
         /* tablet events can occur on hover + keypress */
         return false;
       }
-      else if ((kmitype == TABLET_STYLUS) && (wmtab->Active != EVT_TABLET_STYLUS)) {
+      else if ((kmitype == TABLET_STYLUS) && (wmtab->active != EVT_TABLET_STYLUS)) {
         return false;
       }
-      else if ((kmitype == TABLET_ERASER) && (wmtab->Active != EVT_TABLET_ERASER)) {
+      else if ((kmitype == TABLET_ERASER) && (wmtab->active != EVT_TABLET_ERASER)) {
         return false;
       }
     }
@@ -2041,10 +1876,10 @@ static wmKeyMapItem *wm_eventmatch_modal_keymap_items(const wmKeyMap *keymap,
  *   This is done since we only want to use double click events to match key-map items,
  *   allowing modal functions to check for press/release events without having to interpret them.
  */
-static void wm_event_modalkeymap(const bContext *C,
-                                 wmOperator *op,
-                                 wmEvent *event,
-                                 bool *dbl_click_disabled)
+static void wm_event_modalkeymap_begin(const bContext *C,
+                                       wmOperator *op,
+                                       wmEvent *event,
+                                       bool *dbl_click_disabled)
 {
   BLI_assert(event->type != EVT_MODAL_MAP);
 
@@ -2097,25 +1932,13 @@ static void wm_event_modalkeymap(const bContext *C,
 }
 
 /**
- * Check whether operator is allowed to run in case interface is locked,
- * If interface is unlocked, will always return truth.
+ * Restore changes from #wm_event_modalkeymap_begin
+ *
+ * \warning bad hacking event system...
+ * better restore event type for checking of #KM_CLICK for example.
+ * Modal maps could use different method (ton).
  */
-static bool wm_operator_check_locked_interface(bContext *C, wmOperatorType *ot)
-{
-  wmWindowManager *wm = CTX_wm_manager(C);
-
-  if (wm->is_interface_locked) {
-    if ((ot->flag & OPTYPE_LOCK_BYPASS) == 0) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-/* bad hacking event system... better restore event type for checking of KM_CLICK for example */
-/* XXX modal maps could use different method (ton) */
-static void wm_event_modalmap_end(wmEvent *event, bool dbl_click_disabled)
+static void wm_event_modalkeymap_end(wmEvent *event, bool dbl_click_disabled)
 {
   if (event->type == EVT_MODAL_MAP) {
     event->type = event->prevtype;
@@ -2134,7 +1957,8 @@ static int wm_h

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list