Please be advised that access to Atari Forum this coming Friday will be sporadic whilst the backend operating system and dependency upgrades are carried out.

[C] calculating GEM window size

C and PASCAL (or any other high-level languages) in here please

Moderators: Zorro 2, Moderator Team

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3361
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

[C] calculating GEM window size

Post by Cyprian »

I use AES wind_get "WF_WORKXYWH" to convert the window size to working size:

Code: Select all

		/* Get window work area*/
		wind_get( WINDOW_handle, WF_WORKXYWH, &WindWork.g_x, &WindWork.g_y, &WindWork.g_w, &WindWork.g_h );
And now I wonder if there is a reverse function that converts the working size to window size.
I have a 100x200px panel and I would like to open a new window that will fit this panel.

I've tried this one but without success:

Code: Select all

		/* set new window size */
		wind_set( WINDOW_handle, WF_WORKXYWH, WindWork.g_x, WindWork.g_y, WindWork.g_w, WindWork.g_h );

		/* get new window size */
		wind_get( WINDOW_handle, WF_CURRXYWH, &WindSize.g_x, &WindSize.g_y, &WindSize.g_w, &WindSize.g_h );

ATW800/2 / V4sa / Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
http://260ste.atari.org
User avatar
Count
Captain Atari
Captain Atari
Posts: 185
Joined: Sat Sep 16, 2017 9:15 am
Location: Germany

Re: [C] calculating GEM window size

Post by Count »

First: You cannot set the working area size of a window. The working area grows/shrinks automatically when you resize the window. It is nothing more than the total size of the window minus borders, title bar, info bar and controls.

Do I understand correctly that you have a window with a working area of 200x100px and now you want to open a second window that covers exactly this working area?

Then you need to pass the working area dimensions of the already opened window to the new window using WF_CURRXYWH. That will move that window to the upper left corner of your panel with exact same size:

Code: Select all

wind_set( WINDOW_handle, WF_CURRXYWH, WindWork.g_x, WindWork.g_y, WindWork.g_w, WindWork.g_h );
User avatar
chronicthehedgehog
Captain Atari
Captain Atari
Posts: 356
Joined: Sun May 08, 2022 5:24 pm
Location: The Midlands

Re: [C] calculating GEM window size

Post by chronicthehedgehog »

wind_calc will give you the total window size required for a given work area size and set of components
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 3361
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: [C] calculating GEM window size

Post by Cyprian »

Count wrote: Tue Feb 13, 2024 1:27 pm First: You cannot set the working area size of a window. The working area grows/shrinks automatically when you resize the window. It is nothing more than the total size of the window minus borders, title bar, info bar and controls.

Do I understand correctly that you have a window with a working area of 200x100px and now you want to open a second window that covers exactly this working area?
based on the required size of working area (my panel) I needed to calculate the window size

chronicthehedgehog wrote: Tue Feb 13, 2024 1:54 pm wind_calc will give you the total window size required for a given work area size and set of components
thanks, wind_calc did the job:

Code: Select all

		wind_calc( WC_BORDER, WI_KIND, WindWork.g_x, WindWork.g_y, WindWork.g_w, WindWork.g_h, &WindSize.g_x, &WindSize.g_y, &WindSize.g_w, &WindSize.g_h );
Last edited by Cyprian on Tue Feb 13, 2024 3:34 pm, edited 1 time in total.
ATW800/2 / V4sa / Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
http://260ste.atari.org

Return to “C / PASCAL etc.”