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

Da Gambas-it.org - Wikipedia.
Riga 7: Riga 7:
 
  Library "libX11:6.3.0"
 
  Library "libX11:6.3.0"
 
   
 
   
  <FONT Color=gray>' ''Display *XOpenDisplay(display_name)''
+
  <FONT Color=gray>' ''Display *XOpenDisplay(char *display_name)''
 
  ' ''Opens a connection to the X server that controls a display.''</font>
 
  ' ''Opens a connection to the X server that controls a display.''</font>
 
  Private Extern XOpenDisplay(display$ As String) As Pointer
 
  Private Extern XOpenDisplay(display$ As String) As Pointer
 
   
 
   
  <FONT Color=gray>' ''XMoveResizeWindow(display, w, x, y, width, height)''
+
  <FONT Color=gray>' ''XMoveResizeWindow(Display *display, Window w, int x, int y, unsigned int width, unsigned int height)''
 
  ' ''Changes the size and location of the specified window without raising it.''</font>
 
  ' ''Changes the size and location of the specified window without raising it.''</font>
 
  Private Extern XMoveResizeWindow(displayP As Pointer, w As Integer, x As Integer, y As Integer, width As Integer, height As Integer)
 
  Private Extern XMoveResizeWindow(displayP As Pointer, w As Integer, x As Integer, y As Integer, width As Integer, height As Integer)
 
    
 
    
  <FONT Color=gray>' ''XCloseDisplay(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(displayP As Pointer)

Versione delle 09:53, 24 nov 2014

Per spostare e modificare le dimensioni della finestra di un programma esterno si può utilizzare la funzione XMoveResizeWindow() della libreria condivisa (nella sua attuale versione) 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$ As String) As Pointer

' XMoveResizeWindow(Display *display, Window w, int x, int y, unsigned int width, unsigned int height)
' Changes the size and location of the specified window without raising it.
Private Extern XMoveResizeWindow(displayP As Pointer, w As Integer, x As Integer, y As Integer, 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(displayP As Pointer)


Public Sub Main()

 Dim disp As Pointer

' Connessione al server X ed impostazione di default:
  disp = XOpenDisplay(Null)

  XMoveResizeWindow(disp, num_ID_della_finestra, 50, 200, 600, 100)

' Chiude la libreria:
  XCloseDisplay(disp)

End



Riferimenti