Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
from: http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
note: GUI
requires:
- Graphics

View file

@ -0,0 +1,18 @@
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling.
This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations and menubars.
The idea is to determine the physical display parameters for the maximum height and width of the usable display area in pixels (without scrolling).
The values calculated should represent the usable desktop area of a window maximized to fit the the screen.
;Considerations:
;--- Multiple Monitors:
For multiple monitors, the values calculated should represent the size of the usable display area on the monitor which is related to the task (i.e.:   the monitor which would display a window if such instructions were given).
;--- Tiling Window Managers
For a tiling window manager, the values calculated should represent the maximum height and width of the display area of the maximum size a window can be created (without scrolling). This would typically be a full screen window (minus any areas occupied by desktop bars), unless the window manager has restrictions that prevents the creation of a full screen window, in which case the values represent the usable area of the desktop that occupies the maximum permissible window size (without scrolling).
<br><br>

View file

@ -0,0 +1,27 @@
with Gtk.Main;
with Glib;
with Gtk.Window; use Gtk.Window;
with Gtk.Enums; use Gtk.Enums;
with Ada.Text_IO; use Ada.Text_IO;
procedure Max_Size is
Win : Gtk_Window;
Win_W, Win_H : Glib.Gint;
package Int_Io is new Integer_IO (Glib.Gint);
Hid : Gtk.Main.Quit_Handler_Id;
begin
Gtk.Main.Init;
Gtk_New (Win);
Initialize (Win, Window_Toplevel);
Maximize (Win);
Show (Win);
Get_Size (Win, Win_W, Win_H);
Put ("Maximum dimensions of window : W ");
Int_Io.Put (Win_W, Width => 4);
Put (" x H ");
Int_Io.Put (Win_H, Width => 4);
New_Line;
Hid := Gtk.Main.Quit_Add_Destroy (0, Win);
end Max_Size;

View file

@ -0,0 +1,15 @@
SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary%
Loop, %MonitorCount%
{
SysGet, MonitorName, MonitorName, %A_Index%
SysGet, Monitor, Monitor, %A_Index%
SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
MsgBox, % "Monitor:`t#" A_Index
. "`nName:`t" MonitorName
. "`nLeft:`t" MonitorLeft "(" MonitorWorkAreaLeft " work)"
. "`nTop:`t" MonitorTop " (" MonitorWorkAreaTop " work)"
. "`nRight:`t" MonitorRight " (" MonitorWorkAreaRight " work)"
. "`nBottom:`t" MonitorBottom " (" MonitorWorkAreaBottom " work)"
}

View file

@ -0,0 +1,5 @@
SPI_GETWORKAREA = 48
DIM rc{l%,t%,r%,b%}
SYS "SystemParametersInfo", SPI_GETWORKAREA, 0, rc{}, 0
PRINT "Maximum width = " ; rc.r% - rc.l%
PRINT "Maximum height = " ; rc.b% - rc.t%

View file

@ -0,0 +1,28 @@
OPTION GUI TRUE
PRAGMA GUI gtk3
FUNCTION Define_Window
LOCAL (*max)() = gtk_window_maximize TYPE void
LOCAL id
id = GUIDEFINE("{ type=WINDOW name=window }")
CALL GUIFN(id, "window", max)
RETURN id
ENDFUNCTION
SUB Print_Dimensions
LOCAL (*size)() = gtk_window_get_size TYPE void
LOCAL x, y
CALL GUIFN(gui, "window", size, &x, &y)
PRINT x, "-", y
END
ENDSUB
gui = Define_Window()
ALARM Print_Dimensions, 500
event$ = GUIEVENT$(gui)

View file

@ -0,0 +1,15 @@
using System;
using System.Drawing;
using System.Windows.Forms;
static class Program
{
static void Main()
{
Rectangle bounds = Screen.PrimaryScreen.Bounds;
Console.WriteLine($"Primary screen bounds: {bounds.Width}x{bounds.Height}");
Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
Console.WriteLine($"Primary screen working area: {workingArea.Width}x{workingArea.Height}");
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Drawing;
using System.Windows.Forms;
static class Program
{
static void Main()
{
using (var f = new Form() { FormBorderStyle = FormBorderStyle.None, WindowState = FormWindowState.Maximized })
{
f.Show();
Console.WriteLine($"Size of maximized borderless form: {f.Width}x{f.Height}");
}
}
}

View file

@ -0,0 +1,8 @@
#include<windows.h>
#include<stdio.h>
int main()
{
printf("Dimensions of the screen are (w x h) : %d x %d pixels",GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
return 0;
}

View file

@ -0,0 +1,34 @@
DEF Win:WINDOW
DEF Close:CHAR
DEF ScreenSizeX,ScreenSizeY:INT
DEF L,T,ClientWidth,ClientHeight:INT
GETSCREENSIZE(ScreenSizeX,ScreenSizeY)
WINDOW Win,0,0,ScreenSizeX,ScreenSizeY,@MINBOX|@MAXBOX|@SIZE|@MAXIMIZED,0,"Get Client Size",MainHandler
'Left and top are always zero for this function.
GETCLIENTSIZE(Win,L,T,ClientWidth,ClientHeight)
PRINT Win,"Maximum drawing area values: width is"+STR$(ClientWidth)+" and height is"+STR$(ClientHeight)+"."
WAITUNTIL Close=1
CLOSEWINDOW Win
END
SUB MainHandler
SELECT @CLASS
CASE @IDCLOSEWINDOW
Close=1
ENDSELECT
RETURN
Output: Maximum drawing area values: width is 1280 and height is 749.

View file

@ -0,0 +1,30 @@
unit Main;
interface
uses
Winapi.Windows, System.SysUtils, Vcl.Forms;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
w,h:Integer;
begin
w := Screen.Monitors[0].WorkareaRect.Width;
h := Screen.Monitors[0].WorkareaRect.Height;
Caption:= format('%d x %d',[w,h]);
SetBounds(0,0,w,h);
end;
end.

View file

@ -0,0 +1,3 @@
object Form1: TForm1
OnCreate = FormCreate
end

View file

@ -0,0 +1,5 @@
browser Browser{};
bvh int = browser.getViewportHeight();
bvw int = browser.getViewportWidth();
SysLib.writeStdout("ViewportHeight: " + bvh);
SysLib.writeStdout("ViewportWidth: " + bvw);

View file

@ -0,0 +1,4 @@
#INCLUDE <Include\Windows.inc>
ShowWindow(ME, SW_MAXIMIZE)
BEGIN EVENTS
END EVENTS

View file

@ -0,0 +1,15 @@
#APPTYPE CONSOLE
#INCLUDE <Include\Windows.inc>
TYPE RECT
%Left
%Top
%Right
%Bottom
END TYPE
DIM rc AS RECT
SystemParametersInfo(SPI_GETWORKAREA, 0, @rc, 0)
PRINT "width = ", rc.Right - rc.Left, ", height = ", rc.Bottom - rc.Top
PAUSE

View file

@ -0,0 +1,19 @@
' FB 1.05.0 Win64
' Using SystemParametersInfo function in Win32 API
Dim As Any Ptr library = DyLibLoad("user32")
Dim Shared SystemParametersInfo As Function (ByVal As ULong, ByVal As ULong, ByVal As Any Ptr, ByVal As ULong) As Long
SystemParametersInfo = DyLibSymbol(library, "SystemParametersInfoA")
Type Rect
As Long left, top, right, bottom
End Type
#Define SPI_GETWORKAREA &H30
Dim r As Rect
SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0)
DyLibFree(library)
Print "Maximum usable desktop area : W" ; r.right - r.left; " x H"; r.bottom - r.top; " pixels"
Print
Print "Press any key to quit"
Sleep

View file

@ -0,0 +1,7 @@
include "NSLog.incl"
CGRect r
r = fn ScreenVisibleFrame( fn ScreenMainScreen )
NSLog(@"x:%.0f, y:%.0f, w:%.0f, h:%.0f",r.origin.x,r.origin.y,r.size.width,r.size.height)
HandleEvents

View file

@ -0,0 +1,2 @@
FMain.Maximized = True
FMain.Visible = False ' The form can be invisible

View file

@ -0,0 +1,7 @@
PUBLIC SUB _new()
END
PUBLIC SUB Form_Open()
END

View file

@ -0,0 +1,3 @@
PUBLIC SUB Form_Resize()
PRINT "The maximum window size that can be used without scrolling is "; FMain.Width; " x "; FMain.Height
END

View file

@ -0,0 +1,6 @@
Public Sub Form_Open()
Print Desktop.Width
Print Desktop.Height
End

View file

@ -0,0 +1,19 @@
package main
import (
"fmt"
"github.com/go-vgo/robotgo"
)
func main() {
w, h := robotgo.GetScreenSize()
fmt.Printf("Screen size: %d x %d\n", w, h)
fpid, err := robotgo.FindIds("firefox")
if err == nil && len(fpid) > 0 {
pid := fpid[0]
robotgo.ActivePID(pid)
robotgo.MaxWindow(pid)
_, _, w, h = robotgo.GetBounds(pid)
fmt.Printf("Max usable : %d x %d\n", w, h)
}
}

View file

@ -0,0 +1,3 @@
def window = java.awt.GraphicsEnvironment.localGraphicsEnvironment.maximumWindowBounds
println "width: $window.width, height: $window.height"

View file

@ -0,0 +1,52 @@
import Graphics.UI.Gtk
import Control.Monad (when)
import Control.Monad.Trans (liftIO)
maximumWindowDimensions :: IO ()
maximumWindowDimensions = do
-- initialize the internal state of the GTK toolkit
initGUI
-- create a window
window <- windowNew
-- quit the application when the window is closed
on window objectDestroy mainQuit
-- query the size of the window when its dimensions change
on window configureEvent printSize
-- get the screen the window will be drawn upon
screen <- windowGetScreen window
-- get the size of the screen
x <- screenGetWidth screen
y <- screenGetHeight screen
-- print the dimensions of the screen
putStrLn ("The screen is " ++ show x ++ " pixels wide and " ++
show y ++ " pixels tall for an undecorated fullscreen window.")
-- maximize the window and show it. printSize will then be called
windowMaximize window
widgetShowAll window
-- run the main GTK loop.
-- close the window manually.
mainGUI
-- On my Xfce4 desktop, the configure_event is called three times when a
-- top level window is maximized. The first time, the window size
-- returned is the size prior to maximizing, and the last two times
-- it is the size after maximizing.
-- If the window is (un)maximized manually, the size returned is always
-- the size of the unmaximized window.
-- That means: either GTK or Xfce4 does not handle window maximization
-- correctly, or the GTK bindings for Haskell are buggy, or there is an
-- error in this program.
printSize :: EventM EConfigure Bool
printSize = do
-- get the window that has been resized
w <- eventWindow
-- is the window maximized?
s <- liftIO $ drawWindowGetState w
when (WindowStateMaximized `elem` s) $ do
-- get the size of the window that has been resized
(x, y) <- eventSize
-- print the dimensions out
liftIO $ putStrLn ("The inner window region is now " ++ show x ++
" pixels wide and " ++ show y ++ " pixels tall.")
return True

View file

@ -0,0 +1,35 @@
DEF Win:WINDOW
DEF Close:CHAR
DEF ScreenSizeX,ScreenSizeY:UINT
DEF L,T,ClientWidth,ClientHeight:INT
GETSCREENSIZE(ScreenSizeX,ScreenSizeY)
OPENWINDOW Win,0,0,ScreenSizeX,ScreenSizeY,@MAXBOX|@MINBOX|@SIZE|@MAXIMIZED,NULL,"Get client area",&MainHandler
'Left and top are always zero for this function.
GETCLIENTSIZE (Win,L,T,ClientWidth,ClientHeight)
PRINT Win,"Maximum drawing area values: width is"+STR$(ClientWidth)+" and height is"+STR$(ClientHeight)+"."
WAITUNTIL Close=1
CLOSEWINDOW WIN
END
SUB MainHandler
SELECT @MESSAGE
CASE @IDCLOSEWINDOW
Close=1
ENDSELECT
RETURN
ENDSUB
Output: Maximum drawing area values: width is 1280 and height is 749.

View file

@ -0,0 +1,11 @@
link graphics
procedure main() # Window size
W := WOpen("canvas=hidden")
dh := WAttrib("displayheight")
dw := WAttrib("displaywidth")
WClose(W)
write("The display size is w=",dw,", h=",dh)
end

View file

@ -0,0 +1,2 @@
(".wd 'qscreen') -&(2 3&{) (wd'pclose') ]-/".'qform',:&wd 'pc a; cc g isidraw; pshow; qchildxywh g'
1348 750

View file

@ -0,0 +1,23 @@
import java.awt.*;
import javax.swing.JFrame;
public class Test extends JFrame {
public static void main(String[] args) {
new Test();
}
Test() {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
System.out.println("Physical screen size: " + screenSize);
Insets insets = toolkit.getScreenInsets(getGraphicsConfiguration());
System.out.println("Insets: " + insets);
screenSize.width -= (insets.left + insets.right);
screenSize.height -= (insets.top + insets.bottom);
System.out.println("Max available: " + screenSize);
}
}

View file

@ -0,0 +1,5 @@
win = GtkWindow("hello", 100, 100)
fullscreen(win)
sleep(10)
println(width(win), " ", height(win))
destroy(win)

View file

@ -0,0 +1,24 @@
// version 1.1
import java.awt.Toolkit
import javax.swing.JFrame
class Test : JFrame() {
init {
val r = Regex("""\[.*\]""")
val toolkit = Toolkit.getDefaultToolkit()
val screenSize = toolkit.screenSize
println("Physical screen size : ${formatOutput(screenSize, r)}")
val insets = toolkit.getScreenInsets(graphicsConfiguration)
println("Insets : ${formatOutput(insets, r)}")
screenSize.width -= (insets.left + insets.right)
screenSize.height -= (insets.top + insets.bottom)
println("Max available : ${formatOutput(screenSize, r)}")
}
private fun formatOutput(output: Any, r: Regex) = r.find(output.toString())!!.value.replace(",", ", ")
}
fun main(args: Array<String>) {
Test()
}

View file

@ -0,0 +1,2 @@
put _system.desktopRectList
-- [rect(0, 0, 1360, 768), rect(1360, 0, 2960, 1024)]

View file

@ -0,0 +1,6 @@
nw = require("nw")
win = nw:app():window(320, 240)
win:show()
win:maximize()
cw, ch = win:client_size()
print(cw .. " x " .. ch)

View file

@ -0,0 +1,73 @@
Module CheckAllMonitors {
mode 16 ' font size
i=-1
Flush
Do {
i++
Window mode, i
Print Window=i
Wait 100
Form ; ' expand Background to fill monitor (form without arguments cut that frame)
if window=i Then {
Background {
Cls 0, 0
data i, scale.x, scale.y, motion.x, motion.y
}
} else exit
} Always
Dim Scrx(i), ScrY(i), ScrLeft(i), ScrTop(i)
While Not Empty {
Read i
Read Scrx(i), ScrY(i), ScrLeft(i), ScrTop(i)
}
\\ check if we have same left top point
For i=0 to Len(Scrx())-1 {
Print "Monitor:", i, "left top (";ScrLeft(i);",";ScrTop(i);") size: (";Scrx(i);",";ScrY(i);")"
}
A=ScrLeft(0)
B=ScrTop(0)
LeftMargin=A
TopMargin=B
RightMargin=Scrx(0)+A
BottomMargin=Scry(0)+B
MaxArea=Scrx(0)*Scry(0)
ChooseMonitor=0
Out=True
If Len(Scrx())>1 then {
For i=1 to Len(Scrx())-1 {
LeftMargin=Min.Data(A, ScrLeft(i))
TopMargin=Min.Data(B, ScrTop(i))
RightMargin=Max.Data(RightMargin, Scrx(i)+Scrleft(i))
BottomMargin=Max.Data(BottomMargin, Scry(i)+ScrTop(i))
Out=Out and (A=ScrLeft(i) and B=ScrTop(i))
if MaxArea<Scrx(i)*Scry(i) then MaxArea=Scrx(i)*Scry(i) : ChooseMonitor=i
}
}
If Len(Scrx())=1 then {
Print "One Monitor"
} else Print If$(Out ->"Clone Monitors", "Multiple Monitors ")
Print "Left Top Corner:", LeftMargin, TopMargin
Print "Width, Height", RightMargin-LeftMargin, BottomMargin-TopMargin
Declare Form1 Form
\\ After 100ms Form1 expand to all monitors
After 100 {
Method Form1,"Move", LeftMargin, TopMargin, RightMargin-LeftMargin, BottomMargin-TopMargin
}
\\ After 2000-100ms Form1 move to montior ChooseMonitor, and has same width and height
After 2000 {
Try {
Method Form1,"Move", ScrLeft(ChooseMonitor),ScrTop(ChooseMonitor), Scrx(ChooseMonitor), Scry(ChooseMonitor)
}
}
\\ after 4000 ms from other threads, form1 close
After 4000 {
Try {
Method Form1, "CloseNow"
}
}
Method Form1, "Show", 1
Declare Form1 Nothing
Threads Erase
}
CheckAllMonitors

View file

@ -0,0 +1,2 @@
Differences@Transpose@SystemInformation["Devices"][[1, 2, 1, 1, 2]]
->{{1260, 951}}

View file

@ -0,0 +1,7 @@
import
gtk2, gdk2
nim_init()
var w = gdk2.screen_width()
var h = gdk2.screen_height()
echo("WxH=",w,"x",h)

View file

@ -0,0 +1,17 @@
import glib2, gtk2
proc printSize(window: PWindow): guint {.cdecl.} =
var width, height: gint
window.get_size(addr(width), addr(height))
echo "W x H = ", width, " x ", height
main_quit()
nim_init()
let window = window_new(WINDOW_TOPLEVEL)
window.maximize()
window.show_all()
discard g_timeout_add(100, printSize, addr(window[]))
main()

View file

@ -0,0 +1,28 @@
import gintro/[glib, gobject, gtk, gio]
var window: ApplicationWindow
#---------------------------------------------------------------------------------------------------
proc printSize(data: pointer): gboolean {.cdecl.} =
var width, height: int
window.getSize(width, height)
echo "W x H = ", width, " x ", height
window.destroy()
#---------------------------------------------------------------------------------------------------
proc activate(app: Application) =
## Activate the application.
window = app.newApplicationWindow()
window.maximize()
window.showAll()
discard timeoutAdd(PRIORITY_DEFAULT, 100, SourceFunc(printSize), nil, nil)
#———————————————————————————————————————————————————————————————————————————————————————————————————
let app = newApplication(Application, "Rosetta.ScreenSize")
discard app.connect("activate", activate)
discard app.run()

View file

@ -0,0 +1,22 @@
import
iup
# assumes you have the iup .dll or .so installed
discard iup.open(nil,nil)
var scrnFullSize = GetGlobal("FULLSIZE")
var scrnSize = GetGlobal("SCREENSIZE")
var scrnMInfo = GetGlobal("MONITORSINFO")
var scrnVScreen = GetGlobal("VIRTUALSCREEN")
var dlg = Dialog(nil)
SetAttribute(dlg, "SIZE", "FULL")
var scrnXSize = GetAttribute(dlg,"MAXSIZE")
echo scrnFullSize, "\n", scrnSize, "\n", scrnMInfo, "\n", scrnVScreen, "\n", scrnXSize
discard iup.Alarm("Screen client size", scrnFullSize ,"Ok",nil, nil)
#discard iup.mainloop()
iup.close()

View file

@ -0,0 +1 @@
plothsizes()[1..2]

View file

@ -0,0 +1,8 @@
use strict;
use warnings;
use Tk;
sub get_size {
my $mw = MainWindow->new();
return ($mw->maxsize);
}

View file

@ -0,0 +1,17 @@
-->
<span style="color: #008080;">include</span> <span style="color: #000000;">pGUI</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #7060A8;">IupOpen</span><span style="color: #0000FF;">()</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnFullSize</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"FULLSIZE"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnSize</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"SCREENSIZE"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnMInfo</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"MONITORSINFO"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnVScreen</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetGlobal</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"VIRTUALSCREEN"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">Ihandle</span> <span style="color: #000000;">dlg</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupDialog</span><span style="color: #0000FF;">(</span><span style="color: #004600;">NULL</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"SIZE=FULL"</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">scrnXSize</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">IupGetAttribute</span><span style="color: #0000FF;">(</span><span style="color: #000000;">dlg</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"MAXSIZE"</span><span style="color: #0000FF;">)</span>
<span style="color: #0000FF;">?{</span><span style="color: #000000;">scrnFullSize</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnSize</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnMInfo</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnVScreen</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">scrnXSize</span><span style="color: #0000FF;">}</span>
<span style="color: #7060A8;">IupClose</span><span style="color: #0000FF;">()</span>
<!--

View file

@ -0,0 +1,9 @@
(let Frame (java "javax.swing.JFrame" T "Window")
(java Frame 'setExtendedState
(java (public "javax.swing.JFrame" 'MAXIMIZED_BOTH)) )
(java Frame 'setVisible T)
(wait 200)
(let Size (java (java Frame 'getContentPane) 'getSize)
(prinl "Width: " (java (public Size 'width)))
(prinl "Height: " (java (public Size 'height))) )
(java Frame 'dispose) )

View file

@ -0,0 +1,7 @@
//Aamrun, 26th June 2022
fullScreen();
fill(0);
textSize(50);
text("Screen Height : " + str(height), 100, 100);
text("Screen Width : " + str(width), 100, 200);

View file

@ -0,0 +1,6 @@
If OpenWindow(0, 0, 0, 5, 5, "", #PB_Window_Maximize + #PB_Window_Invisible)
maxX = WindowWidth(0)
maxY = WindowHeight(0)
CloseWindow(0)
MessageRequester("Result", "Maximum Window Width: " + Str(maxX) + ", Maximum Window Height: " + Str(maxY))
EndIf

View file

@ -0,0 +1,10 @@
#!/usr/bin/env python3
import tkinter as tk # import the module.
root = tk.Tk() # Create an instance of the class.
root.state('zoomed') # Maximized the window.
root.update_idletasks() # Update the display.
tk.Label(root, text=(str(root.winfo_width())+ " x " +str(root.winfo_height())),
font=("Helvetica", 25)).pack() # add a label and set the size to text.
root.mainloop()

View file

@ -0,0 +1,6 @@
#lang racket/gui
(define-values [W H]
(let ([f (new frame% [label "test"])])
(begin0 (send* f (maximize #t) (show #t) (get-client-size))
(send f show #f))))
(printf "~ax~a\n" W H)

View file

@ -0,0 +1,7 @@
use X11::libxdo;
my $xdo = Xdo.new;
my ($dw, $dh) = $xdo.get-desktop-dimensions( 0 );
say "Desktop viewport dimensions: (maximum-fullscreen size) $dw x $dh";

View file

@ -0,0 +1,11 @@
load "guilib.ring"
new qApp {
win1 = new qWidget() {
new qPushButton(win1) {
resize(200,200)
settext("Info")
setclickevent(' win1{ setwindowtitle("Width: " + width() + " Height : " + height() ) }')
}
showMaximized()}
exec()
}

View file

@ -0,0 +1,34 @@
html "<INPUT TYPE='HIDDEN' id='winHigh' name='winHigh' VALUE='";winHigh;"'></input>"
html "<INPUT TYPE='HIDDEN' id='winWide' name='winWide' VALUE='";winWide;"'></input>"
html "<script>
<!--
function winSize()
{
var myWide = 0, myHigh = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWide = window.innerWidth;
myHigh = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWide = document.documentElement.clientWidth;
myHigh = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWide = document.body.clientWidth;
myHigh = document.body.clientHeight;
}
// window.alert( 'Width = ' + myWide + ' Height = ' + myHigh );
document.getElementById('winHigh').value = myHigh;
document.getElementById('winWide').value = myWide;
}
window.onresize = function()
{
var x = winSize();
}
var x = winSize();
//--></script>
"

View file

@ -0,0 +1,20 @@
import java.awt.{Dimension, Insets, Toolkit}
import javax.swing.JFrame
class MaxWindowDims() extends JFrame {
val toolkit: Toolkit = Toolkit.getDefaultToolkit
val (insets0, screenSize) = (toolkit.getScreenInsets(getGraphicsConfiguration), toolkit.getScreenSize)
println("Physical screen size: " + screenSize)
System.out.println("Insets: " + insets0)
screenSize.width -= (insets0.left + insets0.right)
screenSize.height -= (insets0.top + insets0.bottom)
System.out.println("Max available: " + screenSize)
}
object MaxWindowDims {
def main(args: Array[String]): Unit = {
new MaxWindowDims
}
}

View file

@ -0,0 +1,8 @@
require('Tk')
func max_window_size() -> (Number, Number) {
%s'MainWindow'.new.maxsize;
}
var (width, height) = max_window_size();
say (width, 'x', height);

View file

@ -0,0 +1,11 @@
package require Tk
proc maxSize {} {
# Need a dummy window; max window can be changed by scripts
set top .__defaultMaxSize__
if {![winfo exists $top]} {
toplevel $top
wm withdraw $top
}
# Default max size of window is value we want
return [wm maxsize $top]
}

View file

@ -0,0 +1,33 @@
import ui
import gg
import gx
[heap]
struct App {
mut:
window &ui.Window = unsafe {nil}
}
fn main() {
mut app := &App{}
app.window = ui.window(
width: gg.screen_size().width
height: gg.screen_size().height
bg_color: gx.white
title: "Maximum Window"
mode: .resizable
layout: ui.row(
spacing: 5
margin_: 10
widths: ui.stretch
heights: ui.stretch
children: [
ui.label(
id: "info"
text: "Window dimensions: W ${gg.screen_size().width} x H ${gg.screen_size().height}"
),
]
)
)
ui.run(app.window)
}

View file

@ -0,0 +1,12 @@
Imports System.Drawing
Imports System.Windows.Forms
Module Program
Sub Main()
Dim bounds As Rectangle = Screen.PrimaryScreen.Bounds
Console.WriteLine($"Primary screen bounds: {bounds.Width}x{bounds.Height}")
Dim workingArea As Rectangle = Screen.PrimaryScreen.WorkingArea
Console.WriteLine($"Primary screen working area: {workingArea.Width}x{workingArea.Height}")
End Sub
End Module

View file

@ -0,0 +1,15 @@
Imports System.Drawing
Imports System.Windows.Forms
Module Program
Sub Main()
Using f As New Form() With {
.WindowState = FormWindowState.Maximized,
.FormBorderStyle = FormBorderStyle.None
}
f.Show()
Console.WriteLine($"Size of maximized borderless form: {f.Width}x{f.Height}")
End Using
End Sub
End Module

View file

@ -0,0 +1,15 @@
TYPE syswindowstru
screenheight AS INTEGER
screenwidth AS INTEGER
maxheight AS INTEGER
maxwidth AS INTEGER
END TYPE
DIM syswindow AS syswindowstru
' Determine the height and width of the screen
syswindow.screenwidth = Screen.Width / Screen.TwipsPerPixelX
syswindow.screenheight=Screen.Height / Screen.TwipsPerPixelY
' Make adjustments for window decorations and menubars

View file

@ -0,0 +1,18 @@
import "input" for Keyboard
import "dome" for Window, Process
import "graphics" for Canvas, Color
class Game {
static init() {
Canvas.print("Maximize the window and press 'm'", 0, 0, Color.white)
}
static update() {
if (Keyboard.isKeyDown("m") ) {
System.print("Maximum window dimensions are %(Window.width) x %(Window.height)")
Process.exit(0)
}
}
static draw(alpha) {}
}

View file

@ -0,0 +1,5 @@
int A;
[A:= GetFB;
Text(0, "Width = "); IntOut(0, A(0)); CrLf(0);
Text(0, "Height = "); IntOut(0, A(1)); CrLf(0);
]