LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-02-2017, 10:26 AM   #1
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,670

Rep: Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864
display = XOpenDisplay (NULL);


when one uses that call to just get some information does it have and or even need to be closed again when done?
Code:
void getScreenDimentions(int *screenW, int *screenH)
{

int W, H;

Display *display;
display = XOpenDisplay (NULL);
 W = DisplayWidth (display, 0);
 H = DisplayHeight (display, 0);

 *screenW = W;
 *screenH = H;

 printf("In getScreenDimentions W=%d, H=%d\n", W,H);

}
tried how to close an display X11 linux in google but didn't get anything useful.
 
Old 08-02-2017, 10:28 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,235

Rep: Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979Reputation: 979
You might want to consult the manual, it does mention a function called XCloseDisplay
 
Old 08-02-2017, 10:47 AM   #3
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,670

Original Poster
Rep: Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864
I knew it was called something like that, plus if one opens data stream should be closed when done. I just didn't want it to shut down everything.
Code:
void getScreenDimentions(int *screenW, int *screenH)
{

int W, H;

Display *infodisplay;
infodisplay = XOpenDisplay (NULL);
 W = DisplayWidth (infodisplay, 0);
 H = DisplayHeight (infodisplay, 0);

 *screenW = W;
 *screenH = H;
 XCloseDisplay(infodisplay);

 printf("In getScreenDim W=%d, H=%d\n", W,H);

}
so I just changed the var name to be sure it is just that one.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] xdotool Error: Can't open display: (null) tonj Linux - Software 1 12-26-2014 06:27 AM
ATI Drivers Radeon HD 4600 AGP - Error: unable to open display (NULL) guarousb Slackware 1 09-05-2011 10:56 AM
X11 XOpenDisplay Problem poehli *BSD 2 03-05-2011 03:43 PM
cannot open display: (null) jhwilliams Linux - Software 6 07-13-2007 05:54 PM
XOpenDisplay() fails JohnCain Programming 1 01-26-2005 10:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration