FLTK 1.4.0
Loading...
Searching...
No Matches
Screen functions

Fl global screen functions declared in <FL/Fl.H>. More...

Functions

static int Fl::h ()
 Returns the height in pixels of the main screen work area.
 
static void Fl::keyboard_screen_scaling (int value)
 Controls the possibility to scale all windows by ctrl/+/-/0/ or cmd/+/-/0/.
 
static int Fl::screen_count ()
 Gets the total count of available screens.
 
static void Fl::screen_dpi (float &h, float &v, int n=0)
 Gets the screen resolution in dots-per-inch for the given screen.
 
static int Fl::screen_num (int x, int y)
 Gets the screen number of a screen that contains the specified screen position x, y.
 
static int Fl::screen_num (int x, int y, int w, int h)
 Gets the screen number for the screen which intersects the most with the rectangle defined by x, y, w, h.
 
static float Fl::screen_scale (int n)
 Current value of the GUI scaling factor for screen number n (n ∈ [0 , Fl::screen_count()-1])
 
static void Fl::screen_scale (int n, float factor)
 Sets the value of the GUI scaling factor for screen number n (n ∈ [0 , Fl::screen_count()-1]).
 
static int Fl::screen_scaling_supported ()
 See if scaling factors are supported by this platform.
 
static void Fl::screen_work_area (int &X, int &Y, int &W, int &H)
 Gets the bounding box of the work area of the screen that contains the mouse pointer.
 
static void Fl::screen_work_area (int &X, int &Y, int &W, int &H, int mx, int my)
 Gets the bounding box of the work area of a screen that contains the specified screen position mx, my.
 
static void Fl::screen_work_area (int &X, int &Y, int &W, int &H, int n)
 Gets the bounding box of the work area of the given screen.
 
static void Fl::screen_xywh (int &X, int &Y, int &W, int &H)
 Gets the bounding box of a screen that contains the mouse pointer.
 
static void Fl::screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my)
 Gets the bounding box of a screen that contains the specified screen position mx, my.
 
static void Fl::screen_xywh (int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh)
 Gets the screen bounding rect for the screen which intersects the most with the rectangle defined by mx, my, mw, mh.
 
static void Fl::screen_xywh (int &X, int &Y, int &W, int &H, int n)
 Gets the screen bounding rect for the given screen.
 
static int Fl::w ()
 Returns the width in pixels of the main screen work area.
 
static int Fl::x ()
 Returns the leftmost x coordinate of the main screen work area.
 
static int Fl::y ()
 Returns the topmost y coordinate of the main screen work area.
 

Detailed Description

Fl global screen functions declared in <FL/Fl.H>.

FLTK supports high-DPI screens using a screen scaling factor. The scaling factor is initialized by the library to a value based on information obtained from the OS. If this initial value is not satisfactory, the FLTK_SCALING_FACTOR environment variable can be set to a value FLTK will multiply to the OS-given value. The 2 variants of functions Fl::screen_scale() allow to programmatically get and set scaling factor values. The scaling factor value can be further changed at runtime by typing ctrl-/+/-/0/ (cmd-/+/-/0/ under macOS). FLTK sends the FL_ZOOM_EVENT when the factor value is changed, to which a callback can be associated with Fl::add_handler(). By default, FLTK displays the new scaling factor value in a yellow, transient window. This can be changed with option Fl::OPTION_SHOW_SCALING.

Function Documentation

◆ keyboard_screen_scaling()

void Fl::keyboard_screen_scaling ( int  value)
static

Controls the possibility to scale all windows by ctrl/+/-/0/ or cmd/+/-/0/.

This function should be called before fl_open_display() runs. If it is not called, the default is to handle these keys for window scaling.

Note
This function can currently only be used to switch the internal handler off, i.e. value must be 0 (zero) - all other values result in undefined behavior and are reserved for future extension.
Parameters
value0 to stop recognition of ctrl/+/-/0/ (or cmd/+/-/0/ under macOS) keys as window scaling.

◆ screen_count()

int Fl::screen_count ( )
static

Gets the total count of available screens.

Note
Screen numbers range from 0 to Fl::screen_count()-1 in the FLTK API.

◆ screen_dpi()

void Fl::screen_dpi ( float &  h,
float &  v,
int  n = 0 
)
static

Gets the screen resolution in dots-per-inch for the given screen.

Parameters
[out]h,vhorizontal and vertical resolution
[in]nthe screen number (0 to Fl::screen_count() - 1)
See also
void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)

◆ screen_num() [1/2]

int Fl::screen_num ( int  x,
int  y 
)
static

Gets the screen number of a screen that contains the specified screen position x, y.

Parameters
[in]x,ythe absolute screen position
Returns
a screen number ∈ [0 , Fl::screen_count()-1]
Attention
When the running system contains screens with different scaling factor values, this API may become ambiguous because a given value pair (x, y) may belong to distinct screens. In that situation, other APIs should be preferred, e.g., Fl_Window::screen_num() and Fl::screen_scale(int).

◆ screen_num() [2/2]

int Fl::screen_num ( int  x,
int  y,
int  w,
int  h 
)
static

Gets the screen number for the screen which intersects the most with the rectangle defined by x, y, w, h.

Parameters
[in]x,y,w,hthe rectangle to search for intersection with
Returns
a screen number ∈ [0 , Fl::screen_count()-1]

◆ screen_scale()

void Fl::screen_scale ( int  n,
float  factor 
)
static

Sets the value of the GUI scaling factor for screen number n (n ∈ [0 , Fl::screen_count()-1]).

Also sets the scale factor value of all windows mapped to screen number n, if any.

◆ screen_scaling_supported()

int Fl::screen_scaling_supported ( )
static

See if scaling factors are supported by this platform.

Returns
0 if scaling factors are not supported by this platform, 1 if a single scaling factor value is shared by all screens, 2 if each screen can have its own scaling factor value.
See also
Fl::screen_scale(int)

◆ screen_work_area() [1/3]

void Fl::screen_work_area ( int &  X,
int &  Y,
int &  W,
int &  H 
)
static

Gets the bounding box of the work area of the screen that contains the mouse pointer.

Parameters
[out]X,Y,W,Hthe work area bounding box
See also
void screen_work_area(int &x, int &y, int &w, int &h, int mx, int my)

◆ screen_work_area() [2/3]

void Fl::screen_work_area ( int &  X,
int &  Y,
int &  W,
int &  H,
int  mx,
int  my 
)
static

Gets the bounding box of the work area of a screen that contains the specified screen position mx, my.

Parameters
[out]X,Y,W,Hthe work area bounding box
[in]mx,mythe absolute screen position

◆ screen_work_area() [3/3]

void Fl::screen_work_area ( int &  X,
int &  Y,
int &  W,
int &  H,
int  n 
)
static

Gets the bounding box of the work area of the given screen.

Parameters
[out]X,Y,W,Hthe work area bounding box
[in]nthe screen number (0 to Fl::screen_count() - 1)
See also
void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)
Note
Like all quantities accessible via public APIs of FLTK, values of X,Y,W,H are given in FLTK units, that is, in drawing units divided by the scaling factor of screen n.

◆ screen_xywh() [1/4]

void Fl::screen_xywh ( int &  X,
int &  Y,
int &  W,
int &  H 
)
static

Gets the bounding box of a screen that contains the mouse pointer.

Parameters
[out]X,Y,W,Hthe corresponding screen bounding box
See also
void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)

◆ screen_xywh() [2/4]

void Fl::screen_xywh ( int &  X,
int &  Y,
int &  W,
int &  H,
int  mx,
int  my 
)
static

Gets the bounding box of a screen that contains the specified screen position mx, my.

Parameters
[out]X,Y,W,Hthe corresponding screen bounding box
[in]mx,mythe absolute screen position

◆ screen_xywh() [3/4]

void Fl::screen_xywh ( int &  X,
int &  Y,
int &  W,
int &  H,
int  mx,
int  my,
int  mw,
int  mh 
)
static

Gets the screen bounding rect for the screen which intersects the most with the rectangle defined by mx, my, mw, mh.

Parameters
[out]X,Y,W,Hthe corresponding screen bounding box
[in]mx,my,mw,mhthe rectangle to search for intersection with
See also
void screen_xywh(int &X, int &Y, int &W, int &H, int n)

◆ screen_xywh() [4/4]

void Fl::screen_xywh ( int &  X,
int &  Y,
int &  W,
int &  H,
int  n 
)
static

Gets the screen bounding rect for the given screen.

Under Windows, Mac OS X, and X11 + the Gnome desktop, screen #0 contains the menubar/taskbar

Parameters
[out]X,Y,W,Hthe corresponding screen bounding box
[in]nthe screen number (0 to Fl::screen_count() - 1)
Note
Like all quantities accessible via public APIs of FLTK, values of X,Y,W,H are given in FLTK units, that is, in drawing units divided by the scaling factor of screen n.
See also
void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my)