Sponsored Content
Top Forums Programming Linux (Xlib) Application hangs on GetGeometry() Post 303018650 by TMurray77 on Tuesday 12th of June 2018 03:39:45 PM
Old 06-12-2018
Linux (Xlib) Application hangs on GetGeometry()

Hello,

I was just wondering why XGetGeometry() would cause a hang in an application.

In the xlib book it says any of there "Get" functions don't necessarily return immediately.

Is there a way to make a it return immediately or other functions that will give me the same results.


I tried using XFlush() and Xsync() before & after the XGetGeometry() function call. Also I tried using xlib's XGetWindowAttributes() instead of XGetGeometry().

Moderator's Comments:
Mod Comment edit by bakunin: moved to the fitting forum

Last edited by bakunin; 06-12-2018 at 06:28 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

xlib blues (XFree86 - Linux)

My goal is to open a window in the X-server and plot a series of pixels. However, I find many examples I have tried to draw to a window fail and the window remains blank. Therefore, I am here requesting information. I do not know c, and am a beginner. Currently, I am using a mix-match of code,... (1 Reply)
Discussion started by: Alux
1 Replies

2. UNIX for Advanced & Expert Users

Linux machines hangs for a short while.

Hello! I'm managing a SuSE Linux 10 server which alot of users are using as login server and also as a build server.. There is a wierd problem with it cus' it hangs for about 30seconds ever so often and then resumes like before, this is when using SSH. It's not that heavley loaded but there... (2 Replies)
Discussion started by: Esaia
2 Replies

3. UNIX for Advanced & Expert Users

Linux Based Application OID

Hi I am searching for system OID on an application which is linux based. Can any one please let me know, where can I find from Command line? Thanks in advance. (1 Reply)
Discussion started by: sureshcisco
1 Replies

4. Programming

Application Cleanup during Linux Shutdown

I'm trying to do some cleanup (write open files) when Linux shuts down. I thought the right method would be to trap SIGTERM and do the necessary processing. Here's my sample code: #include <stdio.h> // for File I/O #include <signal.h> // for signals #include <unistd.h> // for sleep() void... (6 Replies)
Discussion started by: whatisron
6 Replies

5. Shell Programming and Scripting

Shell script runs fine in Solaris, in Linux hangs at wait command

HI, I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging. here is the core of the script CFG_FILE=tab25.cfg sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c do #echo "jobs output" #jobs #echo "jobs... (13 Replies)
Discussion started by: aksaravanan
13 Replies

6. Red Hat

Linux system hangs giving ntp errors

Hi folks, I am facing issue of my system (host1) getting hanged after throwing following ntpd messages. I am not able to ssh to the server there after. only option is to restart the host: Dec 29 02:58:51 host1 ntpd: time reset -0.207907 s Dec 29 02:58:51 host1 ntpd: synchronisation lost Dec 29... (0 Replies)
Discussion started by: SiddhV
0 Replies

7. Shell Programming and Scripting

Expect script hangs Linux

When I run script listed below it causes my Linux to hang. When it freezes I can do totally nothing, move cursor, switch to another terminal or whatever. Linux is just not responding and the only way out I know is a hard reset of PC. #!/bin/bash if ; then echo "one parameter is needed: IP... (3 Replies)
Discussion started by: mass85
3 Replies

8. UNIX and Linux Applications

Timer application in linux

Hello everyone, It is good to be here. I am a newbie to Linux.Can anyone help me in designing a timer application. The timer has to start.And after certain time interval the program should call a function continuously.It should not be in sleep mode.During the course of that time interval the... (0 Replies)
Discussion started by: Harry443
0 Replies

9. UNIX for Advanced & Expert Users

Xlib: XKeysymToKeycode hangs

Two simple questions related to the following puzzling behaviour: I have the following line of code: const KeyCode kc = XKeysymToKeycode(_display_p, ks); where _display_p is a valid Display* returned from XOpenDisplay() and ks has the value 103 (which was returned by XStringToKeysym(),... (2 Replies)
Discussion started by: N7DR
2 Replies

10. Shell Programming and Scripting

Linux Application Memory usage

Hello We are in the process of migrating few of our applications in our linux boxes to new linux box to streamline our applications . In this context , i would like to know how we can calculate a particular application is used .? This data will then be used to select which applications need... (7 Replies)
Discussion started by: ron5174
7 Replies
XGetWindowAttributes(3) 					  XLIB FUNCTIONS					   XGetWindowAttributes(3)

NAME
XGetWindowAttributes, XGetGeometry, XWindowAttributes - get current window attribute or geometry and current window attributes structure SYNTAX
Status XGetWindowAttributes(Display *display, Window w, XWindowAttributes *window_attributes_return); Status XGetGeometry(Display *display, Drawable d, Window *root_return, int *x_return, int *y_return, unsigned int *width_return, unsigned int *height_return, unsigned int *border_width_return, unsigned int *depth_return); ARGUMENTS
border_width_return Returns the border width in pixels. d Specifies the drawable, which can be a window or a pixmap. depth_return Returns the depth of the drawable (bits per pixel for the object). display Specifies the connection to the X server. root_return Returns the root window. w Specifies the window whose current attributes you want to obtain. width_return height_return Return the drawable's dimensions (width and height). window_attributes_return Returns the specified window's attributes in the XWindowAttributes structure. x_return y_return Return the x and y coordinates that define the location of the drawable. For a window, these coordinates specify the upper-left outer corner relative to its parent's origin. For pixmaps, these coordinates are always zero. DESCRIPTION
The XGetWindowAttributes function returns the current attributes for the specified window to an XWindowAttributes structure. It returns a nonzero status on success; otherwise, it returns a zero status. XGetWindowAttributes can generate BadDrawable and BadWindow errors. The XGetGeometry function returns the root window and the current geometry of the drawable. The geometry of the drawable includes the x and y coordinates, width and height, border width, and depth. These are described in the argument list. It is legal to pass to this func- tion a window whose class is InputOnly. It returns a nonzero status on success; otherwise, it returns a zero status. STRUCTURES
The XWindowAttributes structure contains: typedef struct { int x, y; /* location of window */ int width, height; /* width and height of window */ int border_width; /* border width of window */ int depth; /* depth of window */ Visual *visual; /* the associated visual structure */ Window root; /* root of screen containing window */ int class; /* InputOutput, InputOnly*/ int bit_gravity; /* one of the bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ unsigned long backing_planes; /* planes to be preserved if possible */ unsigned long backing_pixel; /* value to be used when restoring planes */ Bool save_under; /* boolean, should bits under be saved? */ Colormap colormap; /* color map to be associated with window */ Bool map_installed; /* boolean, is color map currently installed*/ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ long all_event_masks; /* set of events all people have interest in*/ long your_event_mask; /* my event mask */ long do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Screen *screen; /* back pointer to correct screen */ } XWindowAttributes; The x and y members are set to the upper-left outer corner relative to the parent window's origin. The width and height members are set to the inside size of the window, not including the border. The border_width member is set to the window's border width in pixels. The depth member is set to the depth of the window (that is, bits per pixel for the object). The visual member is a pointer to the screen's associ- ated Visual structure. The root member is set to the root window of the screen containing the window. The class member is set to the win- dow's class and can be either InputOutput or InputOnly. The bit_gravity member is set to the window's bit gravity and can be one of the following: ForgetGravity EastGravity NorthWestGrav- SouthWestGrav- ity ity NorthGravity SouthGravity NorthEastGrav- SouthEastGrav- ity ity WestGravity StaticGravity CenterGravity The win_gravity member is set to the window's window gravity and can be one of the following: UnmapGravity EastGravity NorthWestGrav- SouthWestGrav- ity ity NorthGravity SouthGravity NorthEastGrav- SouthEastGrav- ity ity WestGravity StaticGravity CenterGravity For additional information on gravity, see section 3.3. The backing_store member is set to indicate how the X server should maintain the contents of a window and can be WhenMapped, Always, or NotUseful. The backing_planes member is set to indicate (with bits set to 1) which bit planes of the window hold dynamic data that must be preserved in backing_stores and during save_unders. The backing_pixel member is set to indicate what values to use for planes not set in backing_planes. The save_under member is set to True or False. The colormap member is set to the colormap for the specified window and can be a colormap ID or None. The map_installed member is set to indicate whether the colormap is currently installed and can be True or False. The map_state member is set to indicate the state of the window and can be IsUnmapped, IsUnviewable, or IsViewable. IsUnviewable is used if the window is mapped but some ancestor is unmapped. The all_event_masks member is set to the bitwise inclusive OR of all event masks selected on the window by all clients. The your_event_mask member is set to the bitwise inclusive OR of all event masks selected by the querying client. The do_not_propagate_mask member is set to the bitwise inclusive OR of the set of events that should not propagate. The override_redirect member is set to indicate whether this window overrides structure control facilities and can be True or False. Win- dow manager clients should ignore the window if this member is True. The screen member is set to a screen pointer that gives you a back pointer to the correct screen. This makes it easier to obtain the screen information without having to loop over the root window fields to see which field matches. DIAGNOSTICS
BadDrawable A value for a Drawable argument does not name a defined Window or Pixmap. BadWindow A value for a Window argument does not name a defined Window. SEE ALSO
XQueryPointer(3), XQueryTree(3) Xlib - C Language X Interface X Version 11 libX11 1.6.0 XGetWindowAttributes(3)
All times are GMT -4. The time now is 02:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy