Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BlenderPhi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raas
BlenderPhi
Commits
70648683
Commit
70648683
authored
3 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup: add C++ compatible WL_ARRAY_FOR_EACH macro
parent
cc09661c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.clang-format
+1
-0
1 addition, 0 deletions
.clang-format
intern/ghost/intern/GHOST_WaylandUtils.h
+19
-0
19 additions, 0 deletions
intern/ghost/intern/GHOST_WaylandUtils.h
intern/ghost/intern/GHOST_WindowWayland.cpp
+3
-6
3 additions, 6 deletions
intern/ghost/intern/GHOST_WindowWayland.cpp
with
23 additions
and
6 deletions
.clang-format
+
1
−
0
View file @
70648683
...
@@ -265,6 +265,7 @@ ForEachMacros:
...
@@ -265,6 +265,7 @@ ForEachMacros:
- SET_SLOT_PROBING_BEGIN
- SET_SLOT_PROBING_BEGIN
- MAP_SLOT_PROBING_BEGIN
- MAP_SLOT_PROBING_BEGIN
- VECTOR_SET_SLOT_PROBING_BEGIN
- VECTOR_SET_SLOT_PROBING_BEGIN
- WL_ARRAY_FOR_EACH
StatementMacros:
StatementMacros:
- PyObject_HEAD
- PyObject_HEAD
...
...
This diff is collapsed.
Click to expand it.
intern/ghost/intern/GHOST_WaylandUtils.h
0 → 100644
+
19
−
0
View file @
70648683
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup GHOST
*/
#pragma once
#ifdef __cplusplus
# undef wl_array_for_each
/**
* This macro causes a warning for C++ code, define our own.
* See: https://gitlab.freedesktop.org/wayland/wayland/-/issues/34
*/
# define WL_ARRAY_FOR_EACH(pos, array) \
for (pos = (decltype(pos))((array)->data); \
(const char *)pos < ((const char *)(array)->data + (array)->size); \
(pos)++)
#endif
This diff is collapsed.
Click to expand it.
intern/ghost/intern/GHOST_WindowWayland.cpp
+
3
−
6
View file @
70648683
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include
"GHOST_WindowWayland.h"
#include
"GHOST_WindowWayland.h"
#include
"GHOST_SystemWayland.h"
#include
"GHOST_SystemWayland.h"
#include
"GHOST_WaylandUtils.h"
#include
"GHOST_WindowManager.h"
#include
"GHOST_WindowManager.h"
#include
"GHOST_Event.h"
#include
"GHOST_Event.h"
...
@@ -134,12 +135,8 @@ static void xdg_toplevel_handle_configure(void *data,
...
@@ -134,12 +135,8 @@ static void xdg_toplevel_handle_configure(void *data,
win
->
is_fullscreen
=
false
;
win
->
is_fullscreen
=
false
;
win
->
is_active
=
false
;
win
->
is_active
=
false
;
/* Note that the macro 'wl_array_for_each' would typically be used to simplify this logic,
enum
xdg_toplevel_state
*
state
;
* however it's not compatible with C++, so perform casts instead.
WL_ARRAY_FOR_EACH
(
state
,
states
)
{
* If this needs to be done more often we could define our own C++ compatible macro. */
for
(
enum
xdg_toplevel_state
*
state
=
static_cast
<
xdg_toplevel_state
*>
(
states
->
data
);
reinterpret_cast
<
uint8_t
*>
(
state
)
<
(
static_cast
<
uint8_t
*>
(
states
->
data
)
+
states
->
size
);
state
++
)
{
switch
(
*
state
)
{
switch
(
*
state
)
{
case
XDG_TOPLEVEL_STATE_MAXIMIZED
:
case
XDG_TOPLEVEL_STATE_MAXIMIZED
:
win
->
is_maximised
=
true
;
win
->
is_maximised
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment