LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 06-30-2019, 04:06 AM   #1
Portal
LQ Newbie
 
Registered: Jun 2019
Posts: 27

Rep: Reputation: Disabled
x11 resizing windows


If one creates a window using
Code:
win=XCreateSimpleWindow(dpy,RootWindow(dpy,screen) ,50,50,800,500,10, BlackPixel(dpy,screen), WhitePixel(dpy,screen));
"win" can be moved/resized by default. However, if I do:
Code:
childwin=XCreateSimpleWindow(dpy,win,50,50,200,100,2, BlackPixel(dpy,screen), grey.pixel);
"childwin" cannot be moved/resized by default. Why is this?
 
Old 06-30-2019, 01:44 PM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,900

Rep: Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023
The top level window(s) of applications are usually managed by the Window Manager which does the moving/resizing. Child windows are not. To allow for a child window to be moved/resized, your application will need to handle it itself.

Typically the program needs to listen for configure notify events on the main window and then respond to any resizing events reported by moving and resizing its child windows as appropriate for the new size of the top level window.

Most folks can't be bothered to deal with all the detail this requires and use toolkits such as Qt or GTK that do all this sort of boiler-plate stuff for them.

I like writing programs with libX11, but you typically end up with a couple of hundred lines of code before your program even does anything.
 
1 members found this post helpful.
Old 07-01-2019, 02:33 AM   #3
Portal
LQ Newbie
 
Registered: Jun 2019
Posts: 27

Original Poster
Rep: Reputation: Disabled
oh that makes sense...thanks! I was wondering how Qt layouts work....
I know xlib can be messy, but I really want to start making my own window managers. Do you know any good tutorials on writing window managers?

Last edited by Portal; 07-01-2019 at 02:36 AM.
 
Old 07-01-2019, 03:33 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,900

Rep: Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023
If you don't mind C++ this one seems reasonable, though it looks like the author never completed the full series of articles. Still, what's there is useful.

Personally, I'd rather see it done in pure C as I'm not really a fan of the whole OO thing.

Last edited by GazL; 07-01-2019 at 03:41 AM.
 
Old 07-01-2019, 09:38 AM   #5
Portal
LQ Newbie
 
Registered: Jun 2019
Posts: 27

Original Poster
Rep: Reputation: Disabled
The guy does have the full code on github though. I will probably finish whatever he doesn't cover by reading the source code...
Yeah I also prefer raw C... despite all the fancy features C++ provides.
 
  


Reply



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] /usr/bin/X11/X11/....... 10 X11 subsets & counting walter74 Linux - General 2 06-07-2015 12:36 AM
resizing PV does not work (lvm) after resizing partition deadeyes Red Hat 5 03-11-2011 11:19 AM
LXer: Resizing Linux partitions, Part 2: Advanced resizing LXer Syndicated Linux News 0 09-02-2010 04:41 AM
[SOLVED] Resizing window content when resizing window? (Debian squeeze) mike11 Linux - Newbie 2 03-04-2010 02:14 AM
Roaming X11/Xfree86, X11 proxy zapp Linux - Software 1 09-12-2003 08:06 AM

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

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