CTWM
Toggle main menu visibility
Loading...
Searching...
No Matches
/usr/src/RPM/BUILD/ctwm-4.1.0/functions_captive.c
Go to the documentation of this file.
1
/*
2
* Functions related to captive-mode ctwm.
3
*/
4
5
#include "
ctwm.h
"
6
7
#include <stdlib.h>
8
9
#include "
captive.h
"
10
#include "
cursor.h
"
11
#include "
events.h
"
12
#include "
functions_internal.h
"
13
#include "
screen.h
"
14
15
16
/*
17
* Pulling a window into the ctwm it was invoked from.
18
*/
19
DFHANDLER
(adoptwindow)
20
{
21
AdoptWindow
();
22
}
23
24
25
/*
26
* Interactively moving a window between ctwm's.
27
*/
28
DFHANDLER
(hypermove)
29
{
30
bool
cont
=
true
;
31
Window
root
= RootWindow(
dpy
,
Scr
->screen);
32
Cursor cursor;
33
Window captive_root;
34
35
if
(tmp_win->iswinbox || tmp_win->iswspmgr) {
36
XBell(
dpy
, 0);
37
return
;
38
}
39
40
{
41
CaptiveCTWM
cctwm =
GetCaptiveCTWMUnderPointer
();
42
cursor =
MakeStringCursor
(cctwm.
name
);
43
free(cctwm.
name
);
44
captive_root = cctwm.
root
;
45
}
46
47
XGrabPointer(
dpy
,
root
, True,
48
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask,
49
GrabModeAsync, GrabModeAsync,
root
, cursor, CurrentTime);
50
while
(
cont
) {
51
XMaskEvent(
dpy
, ButtonPressMask | ButtonMotionMask |
52
ButtonReleaseMask, &
Event
);
53
switch
(
Event
.xany.type) {
54
case
ButtonPress:
55
cont
=
false
;
56
break
;
57
58
case
ButtonRelease: {
59
CaptiveCTWM
cctwm =
GetCaptiveCTWMUnderPointer
();
60
cont
=
false
;
61
free(cctwm.
name
);
62
if
(cctwm.
root
==
Scr
->Root) {
63
break
;
64
}
65
if
(cctwm.
root
==
Scr
->XineramaRoot) {
66
break
;
67
}
68
SetNoRedirect
(tmp_win->w);
69
XUngrabButton(
dpy
, AnyButton, AnyModifier, tmp_win->w);
70
XReparentWindow(
dpy
, tmp_win->w, cctwm.
root
, 0, 0);
71
XMapWindow(
dpy
, tmp_win->w);
72
break
;
73
}
74
75
case
MotionNotify: {
76
CaptiveCTWM
cctwm =
GetCaptiveCTWMUnderPointer
();
77
if
(cctwm.
root
!= captive_root) {
78
unsigned
int
chmask;
79
80
XFreeCursor(
dpy
, cursor);
81
cursor =
MakeStringCursor
(cctwm.
name
);
82
captive_root = cctwm.
root
;
83
84
chmask = (ButtonPressMask | ButtonMotionMask
85
| ButtonReleaseMask);
86
XChangeActivePointerGrab(
dpy
, chmask,
87
cursor, CurrentTime);
88
}
89
free(cctwm.
name
);
90
break
;
91
}
92
}
93
}
94
95
ButtonPressed
= -1;
96
XUngrabPointer(
dpy
, CurrentTime);
97
XFreeCursor(
dpy
, cursor);
98
99
return
;
100
}
SetNoRedirect
void SetNoRedirect(Window window)
Definition
captive.c:609
AdoptWindow
void AdoptWindow(void)
Definition
captive.c:690
GetCaptiveCTWMUnderPointer
CaptiveCTWM GetCaptiveCTWMUnderPointer(void)
Definition
captive.c:550
captive.h
ctwm.h
dpy
Display * dpy
Definition
ctwm_main.c:84
Scr
#define Scr
MakeStringCursor
Cursor MakeStringCursor(char *string)
Definition
cursor.c:184
cursor.h
Event
XEvent Event
Definition
event_core.c:66
ButtonPressed
int ButtonPressed
Definition
event_core.c:93
events.h
functions_internal.h
DFHANDLER
#define DFHANDLER(func)
Definition
functions_internal.h:19
root
MenuRoot * root
Definition
parse_yacc.c:26
cont
int cont
Definition
parse_yacc.c:28
screen.h
CaptiveCTWM
Definition
captive.h:14
CaptiveCTWM::root
Window root
Definition
captive.h:15
CaptiveCTWM::name
char * name
Definition
captive.h:16
functions_captive.c
Generated by
1.18.0