LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-17-2010, 03:22 PM   #1
will_kranz
LQ Newbie
 
Registered: Nov 2004
Location: NH/CT
Distribution: Slackware 10 to 14
Posts: 21

Rep: Reputation: 0
Can I create an Xwin Window from a Console App when Xwin is running?


I'm not new to linux but am fairly new to Xwin. I have a well structured console application to which I'd like to add graphics output. I could port it to Xwin, but that's a pain, I just want to display some graphics. Is this doable? I seem to be able to make the calls, but the window never appears. If I do the same calls (which seem to return the same valid values) from a Xwin application it all works fine. What's going on?

Is it as simple as configuring my console to a different mode? I find I can't execute this application from an X browser either, and I thought I used to be able to do that. IE click on a console application and have it open a console box and run the application.

Thanks, Will
 
Old 06-17-2010, 09:05 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
You're being caught out by X' security (most likely) ...

To make it work on your local machine you'll need to do two things:
a) in the active X11 session (as the user owning the session) permit
local X11 programs to display:
Code:
xhost +localhost
b) from your console:
Code:
export DISPLAY=:0.0

If that doesn't resolve your problem, try running your program under
strace control, and see whether that gives you insight as to why it's
failing to do your bidding.


Cheers,
Tink
 
Old 06-19-2010, 07:52 AM   #3
will_kranz
LQ Newbie
 
Registered: Nov 2004
Location: NH/CT
Distribution: Slackware 10 to 14
Posts: 21

Original Poster
Rep: Reputation: 0
thanks for the tips, afraid I still don't get a) above.
b) I understand, but where would I enter/do config for a)?

I am currently running a KDE style front end to Xwin. I looked at the console configuration options, and see nothing like that.
Can you hold my hand a little more and tell me where to go to set this up?

Again, thanks for the helping hand, it would be much easier if I can get it to work this way...
 
Old 06-19-2010, 07:32 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Maybe we need to clarify terms first. When you say 'console', are
you talking about a full-screen ASCII terminal outside the GUI, or
an xterm llook-alike like konsole?

What *I* thought you meant was that you have a program that you
want to be able to run as any user from any console (the full screen
one) and display on the same machines X11 graphical subsystem.


The a) above grants any process from the local machine to display
graphical content in the current X11 session (or the first one, to
be pedantic - you could obviously have more than one X session going
at the same time). The "xhost +localhost" needs to be issued in
the running X session.



Cheers,
Tink
 
Old 06-20-2010, 08:22 PM   #5
will_kranz
LQ Newbie
 
Registered: Nov 2004
Location: NH/CT
Distribution: Slackware 10 to 14
Posts: 21

Original Poster
Rep: Reputation: 0
Unfortunately you are confusing me more rather than less.

The first question I am trying to ask is where/how am I to
issue the command you suggest:
"The "xhost +localhost" needs to be issued in
the running X session."
Ok I have the KDE desktop up and running, where am I supposed to do this? Its a GUI not a command line interface, puzzled.
Is there a configuration window/screen I should be in, if so where?


Oh wait, maybe I get it, 'xhost' is a program I run in console mode. I'll try that.


Further in my experience, If I run the Xserver with the KDE, or
any other front end, I can not at the same time have any 'real full fledged consoles' at all. All I can have are emulated console boxes which I open from the start menu. These act much like the full screen consoles I can open if X is not running, but are X aware. Its one of these console boxes under Xwin that I want to use to run my text mode application. I think it probably is a kconsole.

Last edited by will_kranz; 06-20-2010 at 08:37 PM.
 
Old 06-20-2010, 08:25 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by will_kranz View Post
Unfortunately you are confusing me more rather than less.

The first question I am trying to ask is where/how am I to
issue the command you suggest:
"The "xhost +localhost" needs to be issued in
the running X session."
Ok I have the KDE desktop up and running, where am I supposed to do this? Its a GUI not a command line interface, puzzled.
Is there a configuration window/screen I should be in, if so where?
Open any terminal (konsole, xterm, rxvt, ... ) and enter
xhost +localhost

Quote:
Originally Posted by will_kranz View Post
Further in my experience, If I run the Xserver with the KDE, or
any other front end, I can not at the same time have any 'real full fledged consoles' at all. All I can have are emulated console boxes which I open from the start menu. These act much like the full screen consoles I can open if X is not running, but are X aware. Its one of these console boxes under Xwin that I want to use to run my text mode application. I think it probably is a kconsole.
That should just work then. If you're running your app
as the user who owns the X-session, and it doesn't change
privileges after you start it it should actually "just work".
 
Old 06-23-2010, 11:10 AM   #7
will_kranz
LQ Newbie
 
Registered: Nov 2004
Location: NH/CT
Distribution: Slackware 10 to 14
Posts: 21

Original Poster
Rep: Reputation: 0
I think I solved it

Tinkster seems to be the only one watching this, but just in case someone else comes along, I was making a big newbie mistake. The xhost and security issue is interesting, but was not my problem.

It was more fundmental. I had not read the manual carefully and did not realize that Xwin queues requests to the server. I did all my setup,
including an XMapRaised() call. But I never called XNextEvent() which has the side effect of sending all the pending requests to the server! Sigh.
Live and learn.

I now have a new problem, namely the new window I have created seems to
have control now and I can't get it to go back to the original console window for input processing which is what I need. But lets consider this solved and I will read the Xlib Ref further before asking more questions!

Thanks.
 
Old 06-23-2010, 02:38 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Well done, and pity my ideas were off on a tangent. I guess
I didn't think of a coding issue on your side :}


Cheers,
Tink
 
  


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
Xwin -query gothrog Fedora 1 01-06-2009 09:39 AM
problem with xwin SkeleToR.cZ Linux - Software 1 03-24-2006 02:12 PM
Xwin on a different vt youngstorm Fedora 0 08-22-2005 04:44 PM
Xwin help needed please vector Linux - General 4 03-17-2002 02:55 AM
Xwin Video Help cronikus Linux - General 0 11-16-2001 02:29 PM


All times are GMT -5. The time now is 03:51 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration