Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
gtk
Commits
fa33839d
Commit
fa33839d
authored
Dec 15, 2010
by
Matthias Clasen
Browse files
Consistently use per-display error traps in the X11 backend
parent
2d7583c0
Changes
9
Hide whitespace changes
Inline
Side-by-side
gdk/x11/gdkasync.c
View file @
fa33839d
...
...
@@ -653,12 +653,12 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
state
.
children
=
NULL
;
state
.
nchildren
=
0
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
result
=
list_children_and_wm_state
(
dpy
,
window
,
win_has_wm_state
?
wm_state_atom
:
None
,
&
has_wm_state
,
&
state
.
children
,
&
state
.
nchildren
);
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
if
(
!
result
)
{
g_free
(
state
.
children
);
...
...
gdk/x11/gdkdevice-xi.c
View file @
fa33839d
...
...
@@ -151,11 +151,11 @@ gdk_device_xi_constructed (GObject *object)
device
=
GDK_DEVICE_XI
(
object
);
display
=
gdk_device_get_display
(
GDK_DEVICE
(
object
));
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
device
->
xdevice
=
XOpenDevice
(
GDK_DISPLAY_XDISPLAY
(
display
),
device
->
device_id
);
if
(
gdk_error_trap_pop
())
if
(
gdk_
x11_display_
error_trap_pop
(
display
))
g_warning
(
"Device %s can't be opened"
,
gdk_device_get_name
(
GDK_DEVICE
(
device
)));
...
...
gdk/x11/gdkdisplay-x11.c
View file @
fa33839d
...
...
@@ -255,14 +255,14 @@ gdk_check_wm_desktop_changed (GdkWindow *window)
gulong
*
desktop
;
type
=
None
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
GDK_WINDOW_XID
(
window
),
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_NET_WM_DESKTOP"
),
0
,
G_MAXLONG
,
False
,
XA_CARDINAL
,
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
data
);
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
if
(
type
!=
None
)
{
...
...
@@ -298,12 +298,12 @@ gdk_check_wm_state_changed (GdkWindow *window)
toplevel
->
have_fullscreen
=
FALSE
;
type
=
None
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
GDK_WINDOW_XID
(
window
),
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_NET_WM_STATE"
),
0
,
G_MAXLONG
,
False
,
XA_ATOM
,
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
data
);
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
if
(
type
!=
None
)
{
...
...
@@ -709,7 +709,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
gint
ty
=
0
;
Window
child_window
=
0
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
if
(
XTranslateCoordinates
(
GDK_WINDOW_XDISPLAY
(
window
),
GDK_WINDOW_XID
(
window
),
screen_x11
->
xroot_window
,
...
...
@@ -720,7 +720,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event
->
configure
.
x
=
tx
;
event
->
configure
.
y
=
ty
;
}
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
}
else
{
...
...
@@ -1346,11 +1346,11 @@ _gdk_x11_display_open (const gchar *display_name)
int
rootx
,
rooty
,
winx
,
winy
;
unsigned
int
xmask
;
gdk_error_trap_push
();
XQueryPointer
(
display_x11
->
xdisplay
,
gdk_
x11_display_
error_trap_push
(
display
);
XQueryPointer
(
display_x11
->
xdisplay
,
GDK_SCREEN_X11
(
display_x11
->
default_screen
)
->
xroot_window
,
&
root
,
&
child
,
&
rootx
,
&
rooty
,
&
winx
,
&
winy
,
&
xmask
);
if
(
G_UNLIKELY
(
gdk_error_trap_pop
()
==
BadWindow
))
if
(
G_UNLIKELY
(
gdk_
x11_display_
error_trap_pop
(
display
)
==
BadWindow
))
{
g_warning
(
"Connection to display %s appears to be untrusted. Pointer and keyboard grabs and inter-client communication may not work as expected."
,
gdk_display_get_name
(
display
));
display_x11
->
trusted_client
=
FALSE
;
...
...
@@ -2144,14 +2144,14 @@ gdk_x11_display_store_clipboard (GdkDisplay *display,
clipboard_manager
=
gdk_x11_get_xatom_by_name_for_display
(
display
,
"CLIPBOARD_MANAGER"
);
save_targets
=
gdk_x11_get_xatom_by_name_for_display
(
display
,
"SAVE_TARGETS"
);
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
if
(
XGetSelectionOwner
(
display_x11
->
xdisplay
,
clipboard_manager
)
!=
None
)
{
Atom
property_name
=
None
;
Atom
*
xatoms
;
int
i
;
if
(
n_targets
>
0
)
{
property_name
=
gdk_x11_atom_to_xatom_for_display
(
display
,
_gdk_selection_property
);
...
...
@@ -2166,13 +2166,13 @@ gdk_x11_display_store_clipboard (GdkDisplay *display,
g_free
(
xatoms
);
}
XConvertSelection
(
display_x11
->
xdisplay
,
clipboard_manager
,
save_targets
,
property_name
,
GDK_WINDOW_XID
(
clipboard_window
),
time_
);
clipboard_manager
,
save_targets
,
property_name
,
GDK_WINDOW_XID
(
clipboard_window
),
time_
);
}
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
}
...
...
gdk/x11/gdkdnd-x11.c
View file @
fa33839d
...
...
@@ -567,6 +567,7 @@ static void
gdk_window_cache_destroy
(
GdkWindowCache
*
cache
)
{
GdkWindow
*
root_window
=
gdk_screen_get_root_window
(
cache
->
screen
);
GdkDisplay
*
display
;
XSelectInput
(
GDK_WINDOW_XDISPLAY
(
root_window
),
GDK_WINDOW_XID
(
root_window
),
...
...
@@ -574,12 +575,11 @@ gdk_window_cache_destroy (GdkWindowCache *cache)
gdk_window_remove_filter
(
root_window
,
gdk_window_cache_filter
,
cache
);
gdk_window_remove_filter
(
NULL
,
gdk_window_cache_shape_filter
,
cache
);
gdk_error_trap_push
();
g_list_foreach
(
cache
->
children
,
(
GFunc
)
free_cache_child
,
gdk_screen_get_display
(
cache
->
screen
));
display
=
gdk_screen_get_display
(
cache
->
screen
);
gdk_error_trap_pop_ignored
();
gdk_x11_display_error_trap_push
(
display
);
g_list_foreach
(
cache
->
children
,
(
GFunc
)
free_cache_child
,
display
);
gdk_x11_display_error_trap_pop_ignored
(
display
);
g_list_free
(
cache
->
children
);
g_hash_table_destroy
(
cache
->
child_hash
);
...
...
@@ -682,7 +682,7 @@ get_client_window_at_coords_recurse (GdkDisplay *display,
return
None
;
}
static
Window
static
Window
get_client_window_at_coords
(
GdkWindowCache
*
cache
,
Window
ignore
,
gint
x_root
,
...
...
@@ -690,9 +690,12 @@ get_client_window_at_coords (GdkWindowCache *cache,
{
GList
*
tmp_list
;
Window
retval
=
None
;
GdkDisplay
*
display
;
display
=
gdk_screen_get_display
(
cache
->
screen
);
gdk_x11_display_error_trap_push
(
display
);
gdk_error_trap_push
();
tmp_list
=
cache
->
children
;
while
(
tmp_list
&&
!
retval
)
...
...
@@ -704,8 +707,6 @@ get_client_window_at_coords (GdkWindowCache *cache,
if
((
x_root
>=
child
->
x
)
&&
(
x_root
<
child
->
x
+
child
->
width
)
&&
(
y_root
>=
child
->
y
)
&&
(
y_root
<
child
->
y
+
child
->
height
))
{
GdkDisplay
*
display
=
gdk_screen_get_display
(
cache
->
screen
);
if
(
!
is_pointer_within_shape
(
display
,
child
,
x_root
-
child
->
x
,
y_root
-
child
->
y
))
...
...
@@ -725,7 +726,7 @@ get_client_window_at_coords (GdkWindowCache *cache,
tmp_list
=
tmp_list
->
next
;
}
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
if
(
retval
)
return
retval
;
...
...
@@ -1028,36 +1029,38 @@ motif_read_target_table (GdkDisplay *display)
guchar
*
p
;
gboolean
success
=
FALSE
;
gdk_error_trap_push
();
XGetWindowProperty
(
display_x11
->
xdisplay
,
display_x11
->
motif_drag_window
,
motif_drag_targets_atom
,
0
,
(
sizeof
(
MotifTargetTableHeader
)
+
3
)
/
4
,
FALSE
,
motif_drag_targets_atom
,
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
data
);
gdk_
x11_display_
error_trap_push
(
display
);
XGetWindowProperty
(
display_x11
->
xdisplay
,
display_x11
->
motif_drag_window
,
motif_drag_targets_atom
,
0
,
(
sizeof
(
MotifTargetTableHeader
)
+
3
)
/
4
,
FALSE
,
motif_drag_targets_atom
,
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
data
);
if
(
gdk_error_trap_pop
()
||
(
format
!=
8
)
||
(
nitems
<
sizeof
(
MotifTargetTableHeader
)))
goto
error
;
if
(
gdk_x11_display_error_trap_pop
(
display
)
||
(
format
!=
8
)
||
(
nitems
<
sizeof
(
MotifTargetTableHeader
)))
goto
error
;
header
=
(
MotifTargetTableHeader
*
)
data
;
header
->
n_lists
=
card16_to_host
(
header
->
n_lists
,
header
->
byte_order
);
header
->
total_size
=
card32_to_host
(
header
->
total_size
,
header
->
byte_order
);
gdk_error_trap_push
();
XGetWindowProperty
(
display_x11
->
xdisplay
,
display_x11
->
motif_drag_window
,
motif_drag_targets_atom
,
(
sizeof
(
MotifTargetTableHeader
)
+
3
)
/
4
,
(
header
->
total_size
+
3
)
/
4
-
(
sizeof
(
MotifTargetTableHeader
)
+
3
)
/
4
,
FALSE
,
motif_drag_targets_atom
,
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
target_bytes
);
if
(
gdk_error_trap_pop
()
||
(
format
!=
8
)
||
(
bytes_after
!=
0
)
||
(
nitems
!=
header
->
total_size
-
sizeof
(
MotifTargetTableHeader
)))
goto
error
;
gdk_x11_display_error_trap_push
(
display
);
XGetWindowProperty
(
display_x11
->
xdisplay
,
display_x11
->
motif_drag_window
,
motif_drag_targets_atom
,
(
sizeof
(
MotifTargetTableHeader
)
+
3
)
/
4
,
(
header
->
total_size
+
3
)
/
4
-
(
sizeof
(
MotifTargetTableHeader
)
+
3
)
/
4
,
FALSE
,
motif_drag_targets_atom
,
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
target_bytes
);
if
(
gdk_x11_display_error_trap_pop
(
display
)
||
(
format
!=
8
)
||
(
bytes_after
!=
0
)
||
(
nitems
!=
header
->
total_size
-
sizeof
(
MotifTargetTableHeader
)))
goto
error
;
display_x11
->
motif_n_target_lists
=
header
->
n_lists
;
display_x11
->
motif_target_lists
=
g_new0
(
GList
*
,
display_x11
->
motif_n_target_lists
);
...
...
@@ -1067,7 +1070,7 @@ motif_read_target_table (GdkDisplay *display)
{
gint
n_targets
;
guint32
*
targets
;
if
(
p
+
sizeof
(
guint16
)
-
target_bytes
>
nitems
)
goto
error
;
...
...
@@ -1384,14 +1387,14 @@ motif_check_dest (GdkDisplay *display,
unsigned
long
nitems
,
after
;
Atom
motif_drag_receiver_info_atom
=
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_MOTIF_DRAG_RECEIVER_INFO"
);
gdk_error_trap_push
();
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
win
,
motif_drag_receiver_info_atom
,
0
,
(
sizeof
(
*
info
)
+
3
)
/
4
,
False
,
AnyPropertyType
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
);
gdk_
x11_display_
error_trap_push
(
display
);
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
win
,
motif_drag_receiver_info_atom
,
0
,
(
sizeof
(
*
info
)
+
3
)
/
4
,
False
,
AnyPropertyType
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
);
if
(
gdk_error_trap_pop
(
)
==
0
)
if
(
gdk_
x11_display_
error_trap_pop
(
display
)
==
0
)
{
if
(
type
!=
None
)
{
...
...
@@ -1583,17 +1586,19 @@ motif_read_initiator_info (GdkDisplay *display,
gulong
bytes_after
;
guchar
*
data
;
MotifDragInitiatorInfo
*
initiator_info
;
GdkDisplayX11
*
display_x11
=
GDK_DISPLAY_X11
(
display
);
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
source_window
,
atom
,
0
,
sizeof
(
*
initiator_info
),
FALSE
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_MOTIF_DRAG_INITIATOR_INFO"
),
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
data
);
0
,
sizeof
(
*
initiator_info
),
FALSE
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_MOTIF_DRAG_INITIATOR_INFO"
),
&
type
,
&
format
,
&
nitems
,
&
bytes_after
,
&
data
);
if
(
gdk_error_trap_pop
()
||
(
format
!=
8
)
||
(
nitems
!=
sizeof
(
MotifDragInitiatorInfo
))
||
(
bytes_after
!=
0
))
if
(
gdk_x11_display_error_trap_pop
(
display
)
||
(
format
!=
8
)
||
(
nitems
!=
sizeof
(
MotifDragInitiatorInfo
))
||
(
bytes_after
!=
0
))
{
g_warning
(
"Error reading initiator info
\n
"
);
return
FALSE
;
...
...
@@ -2533,13 +2538,12 @@ xdnd_check_dest (GdkDisplay *display,
proxy
=
None
;
gdk_error_trap_push
();
gdk_x11_display_error_trap_push
(
display
);
if
(
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
win
,
xdnd_proxy_atom
,
0
,
1
,
False
,
AnyPropertyType
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
)
==
Success
)
xdnd_proxy_atom
,
0
,
1
,
False
,
AnyPropertyType
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
)
==
Success
)
{
if
(
type
!=
None
)
{
...
...
@@ -2582,7 +2586,7 @@ xdnd_check_dest (GdkDisplay *display,
}
}
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
return
retval
?
(
proxy
?
proxy
:
win
)
:
None
;
}
...
...
@@ -2607,20 +2611,19 @@ xdnd_read_actions (GdkDragContextX11 *context_x11)
{
/* Get the XdndActionList, if set */
gdk_error_trap_push
();
gdk_x11_display_error_trap_push
(
display
);
if
(
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
GDK_WINDOW_XID
(
context
->
source_window
),
gdk_x11_get_xatom_by_name_for_display
(
display
,
"XdndActionList"
),
0
,
65536
,
False
,
XA_ATOM
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
)
==
Success
&&
type
==
XA_ATOM
)
{
atoms
=
(
Atom
*
)
data
;
context
->
actions
=
0
;
GDK_WINDOW_XID
(
context
->
source_window
),
gdk_x11_get_xatom_by_name_for_display
(
display
,
"XdndActionList"
),
0
,
65536
,
False
,
XA_ATOM
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
)
==
Success
&&
type
==
XA_ATOM
)
{
atoms
=
(
Atom
*
)
data
;
context
->
actions
=
0
;
for
(
i
=
0
;
i
<
nitems
;
i
++
)
context
->
actions
|=
xdnd_action_from_atom
(
display
,
atoms
[
i
]);
...
...
@@ -2647,9 +2650,9 @@ xdnd_read_actions (GdkDragContextX11 *context_x11)
}
if
(
data
)
XFree
(
data
);
gdk_error_trap_pop_ignored
();
XFree
(
data
);
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
}
else
{
...
...
@@ -2703,7 +2706,7 @@ xdnd_manage_source_filter (GdkDragContext *context,
if
(
!
GDK_WINDOW_DESTROYED
(
window
)
&&
gdk_window_get_window_type
(
window
)
==
GDK_WINDOW_FOREIGN
)
{
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
GDK_WINDOW_DISPLAY
(
window
)
);
if
(
add_filter
)
{
...
...
@@ -2723,7 +2726,7 @@ xdnd_manage_source_filter (GdkDragContext *context,
*/
}
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
GDK_WINDOW_DISPLAY
(
window
)
);
}
}
...
...
@@ -2861,7 +2864,7 @@ xdnd_enter_filter (GdkXEvent *xev,
context
->
targets
=
NULL
;
if
(
get_types
)
{
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
XGetWindowProperty
(
GDK_WINDOW_XDISPLAY
(
event
->
any
.
window
),
source_window
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"XdndTypeList"
),
...
...
@@ -2869,7 +2872,7 @@ xdnd_enter_filter (GdkXEvent *xev,
False
,
XA_ATOM
,
&
type
,
&
format
,
&
nitems
,
&
after
,
&
data
);
if
(
gdk_error_trap_pop
()
||
(
format
!=
32
)
||
(
type
!=
XA_ATOM
))
if
(
gdk_
x11_display_
error_trap_pop
(
display
)
||
(
format
!=
32
)
||
(
type
!=
XA_ATOM
))
{
g_object_unref
(
context
);
...
...
gdk/x11/gdkmain-x11.c
View file @
fa33839d
...
...
@@ -488,12 +488,12 @@ _gdk_send_xevent (GdkDisplay *display,
if
(
gdk_display_is_closed
(
display
))
return
FALSE
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
result
=
XSendEvent
(
GDK_DISPLAY_XDISPLAY
(
display
),
window
,
propagate
,
event_mask
,
event_send
);
XSync
(
GDK_DISPLAY_XDISPLAY
(
display
),
False
);
if
(
gdk_error_trap_pop
())
if
(
gdk_
x11_display_
error_trap_pop
(
display
))
return
FALSE
;
return
result
;
...
...
gdk/x11/gdkproperty-x11.c
View file @
fa33839d
...
...
@@ -355,9 +355,9 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
* we take precautions
*/
char
*
name
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
name
=
XGetAtomName
(
GDK_DISPLAY_XDISPLAY
(
display
),
xatom
);
if
(
gdk_error_trap_pop
())
if
(
gdk_
x11_display_
error_trap_pop
(
display
))
{
g_warning
(
G_STRLOC
" invalid X atom: %ld"
,
xatom
);
}
...
...
gdk/x11/gdkscreen-x11.c
View file @
fa33839d
...
...
@@ -1104,7 +1104,7 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
gboolean
result
=
FALSE
;
int
i
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
if
(
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
xid
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"WM_STATE"
),
...
...
@@ -1141,7 +1141,7 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
result
=
send
||
found
;
out:
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
return
result
;
}
...
...
@@ -1333,12 +1333,12 @@ fetch_net_wm_check_window (GdkScreen *screen)
return
;
}
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
display
);
/* Find out if this WM goes away, so we can reset everything. */
XSelectInput
(
screen_x11
->
xdisplay
,
*
xwindow
,
StructureNotifyMask
);
error
=
gdk_error_trap_pop
();
error
=
gdk_
x11_display_
error_trap_pop
(
display
);
if
(
!
error
)
{
screen_x11
->
wmspec_check_window
=
*
xwindow
;
...
...
@@ -1625,10 +1625,12 @@ const char*
gdk_x11_screen_get_window_manager_name
(
GdkScreen
*
screen
)
{
GdkScreenX11
*
screen_x11
;
GdkDisplay
*
display
;
screen_x11
=
GDK_SCREEN_X11
(
screen
);
display
=
screen_x11
->
display
;
if
(
!
G_LIKELY
(
GDK_DISPLAY_X11
(
screen_x11
->
display
)
->
trusted_client
))
if
(
!
G_LIKELY
(
GDK_DISPLAY_X11
(
display
)
->
trusted_client
))
return
screen_x11
->
window_manager_name
;
fetch_net_wm_check_window
(
screen
);
...
...
@@ -1651,20 +1653,20 @@ gdk_x11_screen_get_window_manager_name (GdkScreen *screen)
name
=
NULL
;
gdk
_error_trap_push
();
gdk_x11_display
_error_trap_push
(
display
);
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
screen_x11
->
display
),
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
screen_x11
->
wmspec_check_window
,
gdk_x11_get_xatom_by_name_for_display
(
screen_x11
->
display
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_NET_WM_NAME"
),
0
,
G_MAXLONG
,
False
,
gdk_x11_get_xatom_by_name_for_display
(
screen_x11
->
display
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"UTF8_STRING"
),
&
type
,
&
format
,
&
n_items
,
&
bytes_after
,
(
guchar
**
)
&
name
);
gdk_error_trap_pop_ignored
();
gdk_
x11_display_
error_trap_pop_ignored
(
display
);
if
(
name
!=
NULL
)
{
...
...
gdk/x11/gdktestutils-x11.c
View file @
fa33839d
...
...
@@ -147,7 +147,7 @@ gdk_test_simulate_key (GdkWindow *window,
g_free
(
keys
);
if
(
!
success
)
return
FALSE
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
GDK_WINDOW_DISPLAY
(
window
)
);
xev
.
same_screen
=
XTranslateCoordinates
(
xev
.
display
,
xev
.
window
,
xev
.
root
,
xev
.
x
,
xev
.
y
,
&
xev
.
x_root
,
&
xev
.
y_root
,
&
xev
.
subwindow
);
...
...
@@ -158,7 +158,7 @@ gdk_test_simulate_key (GdkWindow *window,
success
&=
0
!=
XWarpPointer
(
xev
.
display
,
None
,
xev
.
window
,
0
,
0
,
0
,
0
,
xev
.
x
,
xev
.
y
);
success
&=
0
!=
XSendEvent
(
xev
.
display
,
xev
.
window
,
True
,
key_pressrelease
==
GDK_KEY_PRESS
?
KeyPressMask
:
KeyReleaseMask
,
(
XEvent
*
)
&
xev
);
XSync
(
xev
.
display
,
False
);
success
&=
0
==
gdk_error_trap_pop
(
);
success
&=
0
==
gdk_
x11_display_
error_trap_pop
(
GDK_WINDOW_DISPLAY
(
window
)
);
return
success
;
}
...
...
@@ -235,7 +235,7 @@ gdk_test_simulate_button (GdkWindow *window,
xev
.
y_root
=
0
;
xev
.
state
=
modifiers
;
xev
.
button
=
button
;
gdk_error_trap_push
();
gdk_
x11_display_
error_trap_push
(
GDK_WINDOW_DISPLAY
(
window
)
);
xev
.
same_screen
=
XTranslateCoordinates
(
xev
.
display
,
xev
.
window
,
xev
.
root
,
xev
.
x
,
xev
.
y
,
&
xev
.
x_root
,
&
xev
.
y_root
,
&
xev
.
subwindow
);
...
...
@@ -245,6 +245,6 @@ gdk_test_simulate_button (GdkWindow *window,
success
&=
0
!=
XWarpPointer
(
xev
.
display
,
None
,
xev
.
window
,
0
,
0
,
0
,
0
,
xev
.
x
,
xev
.
y
);
success
&=
0
!=
XSendEvent
(
xev
.
display
,
xev
.
window
,
True
,
button_pressrelease
==
GDK_BUTTON_PRESS
?
ButtonPressMask
:
ButtonReleaseMask
,
(
XEvent
*
)
&
xev
);
XSync
(
xev
.
display
,
False
);
success
&=
0
==
gdk_error_trap_pop
();
success
&=
0
==
gdk_
x11_display_
error_trap_pop
(
GDK_WINDOW_DISPLAY
(
window
)
);
return
success
;
}
gdk/x11/gdkwindow-x11.c
View file @
fa33839d
...
...
@@ -2620,7 +2620,7 @@ gdk_x11_window_get_root_origin (GdkWindow *window,
static
void
gdk_x11_window_get_frame_extents
(
GdkWindow
*
window
,
GdkRectangle
*
rect
)
GdkRectangle
*
rect
)
{
GdkDisplay
*
display
;
GdkWindowImplX11
*
impl
;
...
...
@@ -2641,14 +2641,14 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
guint
ww
,
wh
,
wb
,
wd
;
gint
wx
,
wy
;
gboolean
got_frame_extents
=
FALSE
;
g_return_if_fail
(
rect
!=
NULL
);
rect
->
x
=
0
;
rect
->
y
=
0
;
rect
->
width
=
1
;
rect
->
height
=
1
;
while
(
window
->
parent
&&
(
window
->
parent
)
->
parent
)
window
=
window
->
parent
;
...
...
@@ -2665,18 +2665,19 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
nvroots
=
0
;
vroots
=
NULL
;
gdk_error_trap_push
();
display
=
gdk_window_get_display
(
window
);
gdk_x11_display_error_trap_push
(
display
);
xwindow
=
GDK_WINDOW_XID
(
window
);
/* first try: use _NET_FRAME_EXTENTS */
if
(
XGetWindowProperty
(
GDK_DISPLAY_XDISPLAY
(
display
),
xwindow
,
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_NET_FRAME_EXTENTS"
),
0
,
G_MAXLONG
,
False
,
XA_CARDINAL
,
&
type_return
,
&
format_return
,
&
nitems_return
,
&
bytes_after_return
,
&
data
)
gdk_x11_get_xatom_by_name_for_display
(
display
,
"_NET_FRAME_EXTENTS"
),
0
,
G_MAXLONG
,
False
,
XA_CARDINAL
,
&
type_return
,
&
format_return
,
&
nitems_return
,
&
bytes_after_return
,
&
data
)
==
Success
)
{
if
((
type_return
==
XA_CARDINAL
)
&&
(
format_return
==
32
)
&&
...
...
@@ -2758,8 +2759,8 @@ gdk_x11_window_get_frame_extents (GdkWindow *window,
}
}
while
(
xparent
!=
root
);
if
(
XGetGeometry
(
GDK_DISPLAY_XDISPLAY
(
display
),
xwindow
,
if
(
XGetGeometry
(
GDK_DISPLAY_XDISPLAY
(
display
),
xwindow
,
&