Differenze tra le versioni di "Modificare le dimensioni della finestra di un programma con le funzioni del API di X11"

Da Gambas-it.org - Wikipedia.
Riga 12: Riga 12:
 
  <FONT Color=gray>' ''XResizeWindow(Display *display, Window w, unsigned int x, unsigned int y)''
 
  <FONT Color=gray>' ''XResizeWindow(Display *display, Window w, unsigned int x, unsigned int y)''
 
  ' ''Changes the inside dimensions of the specified window, not including its borders.''</font>
 
  ' ''Changes the inside dimensions of the specified window, not including its borders.''</font>
  Private Extern XResizeWindow(displayP As Pointer, w As Long, width As Integer, height As Integer)
+
  Private Extern XResizeWindow(display As Pointer, w As Long, width As Integer, height As Integer)
 
    
 
    
 
  <FONT Color=gray>' ''XCloseDisplay(Display *display)''
 
  <FONT Color=gray>' ''XCloseDisplay(Display *display)''
 
  ' ''Closes the connection to the X server for the display specified in the Display structure and destroys all windows.''</font>
 
  ' ''Closes the connection to the X server for the display specified in the Display structure and destroys all windows.''</font>
  Private Extern XCloseDisplay(displayP As Pointer)
+
  Private Extern XCloseDisplay(display As Pointer)
 
   
 
   
 
   
 
   

Versione delle 12:00, 15 dic 2021

Per modificare le dimensioni della finestra di un programma esterno si può utilizzare la funzione XResizeWindow() della libreria condivisa: "libX11.so.6.3.0 ".

Tale funzione esterna non modifica le dimensioni dei bordi della finestra, e richiede, fra l'altro, la specificazione del numero identificativo della finestra del programma da chiudere.

Mostriamo un esempio essenziale:

Library "libX11:6.3.0"

' Display *XOpenDisplay(char *display_name)
' Opens a connection to the X server that controls a display.
Private Extern XOpenDisplay(display_name As Pointer) As Pointer

' XResizeWindow(Display *display, Window w, unsigned int x, unsigned int y)
' Changes the inside dimensions of the specified window, not including its borders.
Private Extern XResizeWindow(display As Pointer, w As Long, width As Integer, height As Integer)
 
' XCloseDisplay(Display *display)
' Closes the connection to the X server for the display specified in the Display structure and destroys all windows.
Private Extern XCloseDisplay(display As Pointer)


Public Sub Main()

 Dim disp As Pointer

' Connessione al server X ed impostazione di default:
 disp = XOpenDisplay(0)
 If disp == 0 Then Error.Raise("Errore !")

 XResizeWindow(disp, num_ID_della_finestra, 50, 200)

' Chiude la libreria:
 XCloseDisplay(disp)

End


Riferimenti