cannot create window on right place using XCreateSimpleWindow


 
Thread Tools Search this Thread
Top Forums Programming cannot create window on right place using XCreateSimpleWindow
# 1  
Old 07-30-2010
cannot create window on right place using XCreateSimpleWindow

Greetings everyone. Please excuse me for my english.

I am trying to show a simple X window on a position on my coordinates,
but it always shows in center (XFCE), left-bottom corner(KDE) or top-right corner(GNOME). What i am doing wrong?

Here is the code:
Code:
  • #include <X11/Xlib.h> #include <stdio.h> int main() { Display* main_display; main_display = XOpenDisplay( NULL ); if( !main_display ) { printf( "Cannot open main display!\n" ); return 1; } int display_num = XDefaultScreen( main_display ); Window main_wnd = XCreateSimpleWindow( main_display, RootWindow( main_display, display_num ), 0, 0, 100, 100, 1, BlackPixel(main_display, display_num), WhitePixel(main_display, display_num ) ); Atom wm_delete_window = XInternAtom( main_display, "WM_DELETE_WINDOW", False ); Atom wm_protocols = XInternAtom( main_display, "WM_PROTOCOLS", False ); XSetWMProtocols( main_display, main_wnd, &wm_delete_window, 1 ); XMapWindow( main_display, main_wnd ); XEvent e; bool done = false; while( !done ) { XNextEvent( main_display, &e ); switch( e.type ) { case ClientMessage: if( e.xclient.message_type == wm_protocols && e.xclient.data.l[0] == (long)wm_delete_window ) { printf( "WM_DELETE_WINDOW\n" ); done = true; } break; default : printf( "Unknown event #%d\n", e.type ); } } XDestroyWindow( main_display, main_wnd ); XCloseDisplay( main_display ); printf( "done\n" ); return 0; }

In this manual (Xlib Programming Manual: Windows: Creating) i can read that i "must never fight with the window manager for the size or placement" of my windows. But i want to control position of my windows!

How can i do it? Could you help me?

My OS is Ubuntu 10.04, all libraries are from ubuntu repositories.
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

2. UNIX for Beginners Questions & Answers

Toggle between xterm window and standard terminal window

Is it possible to toggle back and forth between an xterm invoked from one tty, and a shell invoked from a different tty? I am running Centos 7 with KDE and booting in non-graphic mode. After logging in on the default window (/dev/tty1) , I can then use ALT-F2 to access a new window (/dev/tty2),... (1 Reply)
Discussion started by: rhgscty
1 Replies

3. Shell Programming and Scripting

How to create multiple input box in same window using dialog

Hi All, I was trying to generate GUI using shell script. After long search I found the utility called “dialog”. Using this utility I am able to generate window to collect the input. dialog --inputbox "Input 1" 10 45 dialog --inputbox "Input 2" 10 45 dialog --inputbox "Input 3" 10 45 Using... (2 Replies)
Discussion started by: kalpeer
2 Replies

4. UNIX for Dummies Questions & Answers

What would take the Place of X Window System if X was not installed?

If X was not installed, what would print data onto the display? Does it include applications form Gpl/Gnu or is it a daemon only? Thanks in advance!:wall: (2 Replies)
Discussion started by: theKbStockpiler
2 Replies

5. Red Hat

Maximizing X window without Window Switcher

Hi everyone! I have a strange situation. I'm running an NX remote Gnome desktop session. On the remote machine, there is a whole load of unsaved data in a window. A problem that I've been having with this NX session is that I can't load Gnome Applets, including the Window Switcher. So.. when I... (0 Replies)
Discussion started by: alexandicity
0 Replies

6. Solaris

What is the best way to copy data from place to another place?

Dear Gurus, I need you to advice or suggestion about the best solution to copy data around 200-300G from serverA(location A) to serverB(location B). Normally, I will share folder and then copy but it takes too long time(about 2 days). Do you have any suggestion or which way should be... (9 Replies)
Discussion started by: unitipon
9 Replies

7. Solaris

When does LK actually take place?

I appologize in advance, my question would be easly for me to research if I actually had a Solaris server that I had access to. And I am googled out. I am auditing a solaris 9.0 server's passwords (I was sent the passwd and shadow files) and need to know when the *LK*actually happens. In... (0 Replies)
Discussion started by: lerdahl
0 Replies

8. Programming

How to create a floating window in GTK

Hi all I use SuSE linux 9.3 and I want to create a floating window in my main desktop, but have not good idea yet, can anybody give me some advice? Thanks. (1 Reply)
Discussion started by: bleem1998
1 Replies

9. Windows & DOS: Issues & Discussions

window 2000 professional not pinging my window 98 system.

Hello, We someone help me resolve this problem. I have window 2000 professional, windows 98 and Unixware 7.0.1 on the network. I was able to establish connection with all. However, l was unable to ping window 98 from window 2000 professional. I was able to ping the window 2000 from the window... (10 Replies)
Discussion started by: kayode
10 Replies

10. UNIX Desktop Questions & Answers

How do I create desktop icons for the shell programs I create???

I am a bash shell programmer and I create programs on occasional basis. Now, I dont want my programs to be run by typing out its name at a command line. I want to make it as user friendly as possible. I want to create icons on the desktop so users can click on it. mind you, I said "desktop... (7 Replies)
Discussion started by: TRUEST
7 Replies
Login or Register to Ask a Question