LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-01-2012, 12:05 AM   #1
sunveer
Member
 
Registered: Jul 2012
Posts: 139

Rep: Reputation: Disabled
Creating Window in X Windows Programming


I have written a program to create a Window in X Windows.

It displays a window but with minimize, maximize and close buttons. And I want that it should display only close button and not the rest. How can I achieve this?

My code:

Code:
#include <X11/Xlib.h>

#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>

void main(int argc, char* argv[])
{
Display* display;
int screen_num;
Window win;
unsigned int display_width, display_height;
unsigned int width, height;
unsigned int win_x, win_y;
unsigned int win_border_width;
char *display_name = getenv("DISPLAY");

display = XOpenDisplay(display_name);
if(display == NULL) {
        fprintf(stderr, "%s: cannot connect to X server '%s'\n", argv[0], display_name);
exit(1);
}

screen_num = DefaultScreen(display);
display_width = DisplayWidth(display, screen_num);
display_height = DisplayHeight(display, screen_num);

width = (display_width/3);
height = (display_height/3);

win_x = 0;
win_y = 0;
win_border_width = 2;

win = XCreateSimpleWindow(display, RootWindow(display, screen_num), win_x, win_y, width, height, win_border_width, BlackPixel(display, screen_num), WhitePixel(display, screen_num));

XMapWindow(display, win);

XSync(display, False);
sleep(4);

XCloseDisplay(display);
}
 
Old 12-02-2012, 06:19 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
AFAIK The window decorations are contolled by the window manager not the Xlib application.
Your window is the rectangle within the borders etc.

I could of course be wrong
 
  


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
Creating a Fixed Window Size in a Window Manager (Odd Question) Stupac Programming 3 06-30-2011 04:04 AM
Cygwin/X Window in Microsoft Windows. X Window forwarding of MS Windows programs? roystonlodge Other *NIX 7 10-14-2009 02:19 PM
creating a window in java lemon09 Programming 5 10-01-2009 05:26 AM
creating a window in linux with a 'window' variable??! (openCV) vmok82 Programming 1 02-28-2005 03:38 PM
C programming help... about creating files borgy_t Programming 2 02-08-2005 04:35 AM

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

All times are GMT -5. The time now is 08:12 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
Open Source Consulting | Domain Registration