Previous: Idle Callbacks and Timeouts, Up: Part V Overview of Main Functions [Contents][Index]

### 32.8 Global Variables and Macros

For convenience the library exports a number of global variables. These are:

`FL_OBJECT *FL_EVENT`

  This is a special object returned by `fl_do_forms()` etc. when an X event is received that isn’t coming from a form under the control of the library, e.g., for a window that was opened directly via Xlib functions. Upon receiving this special event the application program can and must remove the pending event from the queue using `fl_XNextEvent()`.

`FL_FORM *fl_current_form`

  This variable is always set to the currently active form.

`Display *fl_display`

  This variable is set to the display (X server) the program is connected to and is needed as an argument for many Xlib functions. It’s recommended not to use this global variable but instead either the function `fl_get_display()` or `FL_FormDisplay()` (the latter accepts a form pointer as its argument and will also be safe in future versions of the library that may support multiple connections).

`int fl_screen`

  This variable is set to the default screen of the display connection.

`Window fl_root`

  This variable is set to the root window.

`Window fl_vroot`

  Some window managers have problems with obtaining the corrent root window and applications don’t work with the normal root windows. In this case `fl_vroot` can be used instead.

`int fl_scrw, fl_scrh`

  These variables contain the screens width and height.

`int fl_mode`

  The variable contains the visual mode in use, it should be one of the Xlib constants `PseudoColor`, `TrueColor`, `DirectColor`, `StaticColor`, `GrayScale or `StaticGray`. Alternatively, the functions `fl_get_vclass()` or `fl_get_form_vclass()`` can be used (the latter accepts a form pointer as its argument and is thus also safe for future versions that may allow multiple connections).

`FL_State fl_state[6]`

  This array of structure of type `FL_State` contains a lot of information about the graphics mode, where each structure has the information for each of the visual modes. Of interest is only the entry for the visual mode in use, `fl_vmode`.

`double fl_dpi`
`double fl_get_dpi()`

  The `fl_dpi` variable contains the screen resolution (in dots per inch), averaged over the resolutions in `x`- and `y`-direction. The funtion is a convenience macros with the same result.

`Visual *fl_visual`
`Visual *fl_get_visual()`

  Convenience macros that expands to the `Visual` pointer in use. Same as `fl_state[fl_vmode].xvinfo->visual`.

`Colormap fl_colormap`
`Colormap fl_get_colormap()`

  Convenience macros that expands to the currently used `Colormap`. Same as `fl_state[fl_vmode].colormap`.

`char *fl_ul_magic_char`

  This variable points to the character used to indicate underlining in labels and other texts. If it appears as the very first character of a string all characters in that string are underlined, otherwise the character direct in front of it. Per default it’s set to `'\b'`.

Previous: Idle Callbacks and Timeouts, Up: Part V Overview of Main Functions [Contents][Index]