+
Skip to content

ta/xfixes cursor barrier #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/fvwm3_manpage_source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4305,6 +4305,10 @@ Pick CursorBarrier coords $[w.x]p $[w.y]p \
CursorBarrier destroy
....
+
Note that if the CURSOR_BARRIER limit is hit, _all_ defined CursorBarriers
are undefined. In pratice, this is unlikely to happen though. If it does, a
message is printed to fvwm3's debug logs.
+
_CursorBarrier_ only works if fvwm is complied with the XFixes extension.

*CursorMove* _horizontal_[p] _vertical_[p]::
Expand Down
9 changes: 8 additions & 1 deletion fvwm/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
#ifdef HAVE_XFIXES
#include <X11/extensions/Xfixes.h>
#define MAX_BARRIERS 16
void create_barrier(int, int, int, int);
void destroy_barrier(int);
void destroy_all_barriers(void);
void destroy_barrier_n(int);

PointerBarrier barriers_l[MAX_BARRIERS];
PointerBarrier barriers_r[MAX_BARRIERS];
PointerBarrier barriers_t[MAX_BARRIERS];
Expand All @@ -50,7 +55,8 @@ int num_barriers = 0;
void create_barrier(int x1, int y1, int x2, int y2)
{
if (num_barriers >= MAX_BARRIERS) {
fvwm_debug(__func__, "Too many barriers. Aborting.");
fvwm_debug(__func__, "Too many barriers. Freeing previous...");
destroy_all_barriers();
Comment on lines +58 to +59
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your reasoning here? If they reach max barriers do you just want a reset? Since you are destroying all of the barriers first, should you remove the return bellow this so the current one they are trying to create gets created?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to document this behavior in the manual page.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's odd either way.

No one's going to reach this limit.

return;
}

Expand Down Expand Up @@ -110,6 +116,7 @@ void destroy_barrier_n(int n)

#else
#define create_barrier(a, b, c, d)
#define destroy_barrier(n);
#define destroy_all_barriers()
#define destroy_barrier_n(a)
#endif
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载