Differenze tra le versioni di "Muovere la finestra di un programma con le funzioni del API di X11"

Da Gambas-it.org - Wikipedia.
Riga 11: Riga 11:
 
  Private Extern XOpenDisplay(display_name As String) As Pointer
 
  Private Extern XOpenDisplay(display_name As String) As Pointer
 
   
 
   
  <FONT Color=gray>' ''XMoveWindow(Display *display, Window w, int x, int y)''
+
  <FONT Color=gray>' ''int XMoveWindow(Display *display, Window w, int x, int y)''
 
  ' ''Moves the specified window to the specified x and y coordinates.''</font>
 
  ' ''Moves the specified window to the specified x and y coordinates.''</font>
  Private Extern XMoveWindow(display As Pointer, w As Long, x As Integer, y As Integer)
+
  Private Extern XMoveWindow(display As Pointer, w As Long, x As Integer, y As Integer) As Integer
 
   
 
   
  <FONT Color=gray>' ''XCloseDisplay(Display *display)''
+
  <FONT Color=gray>' ''int 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(display As Pointer)
+
  Private Extern XCloseDisplay(display As Pointer) As Integer
 
   
 
   
 
   
 
   

Versione delle 18:29, 27 mag 2016

Per muovere all'interno del desktop la finestra di un programma esterno si può utilizzare la funzione XMoveWindow() della libreria condivisa (nella sua attuale versione) libX11.so.6.3.0 .

Tale funzione esterna 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 String) As Pointer

' int XMoveWindow(Display *display, Window w, int x, int y)
' Moves the specified window to the specified x and y coordinates.
Private Extern XMoveWindow(display As Pointer, w As Long, x As Integer, y As Integer) As Integer

' int 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) As Integer


Public Sub Main()

 Dim disp As Pointer

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

  XMoveWindow(disp, num_ID_della_finestra, 300, 400)

' Chiude la libreria:
  XCloseDisplay(disp)

End



Riferimenti