| Top |
| void | cdk_init () |
| gboolean | cdk_init_check () |
| void | cdk_parse_args () |
| const gchar * | cdk_get_display_arg_name () |
| void | cdk_notify_startup_complete () |
| void | cdk_notify_startup_complete_with_id () |
| void | cdk_set_allowed_backends () |
| const gchar * | cdk_get_program_class () |
| void | cdk_set_program_class () |
| gchar * | cdk_get_display () |
| void | cdk_flush () |
| gint | cdk_screen_width () |
| gint | cdk_screen_height () |
| gint | cdk_screen_width_mm () |
| gint | cdk_screen_height_mm () |
| CdkGrabStatus | cdk_pointer_grab () |
| void | cdk_pointer_ungrab () |
| gboolean | cdk_pointer_is_grabbed () |
| void | cdk_set_double_click_time () |
| CdkGrabStatus | cdk_keyboard_grab () |
| void | cdk_keyboard_ungrab () |
| void | cdk_beep () |
| void | cdk_error_trap_push () |
| gint | cdk_error_trap_pop () |
| void | cdk_error_trap_pop_ignored () |
| enum | CdkGrabStatus |
| #define | CDK_WINDOWING_X11 |
| #define | CDK_WINDOWING_WIN32 |
| #define | CDK_WINDOWING_QUARTZ |
| #define | CDK_WINDOWING_WAYLAND |
| #define | CDK_VERSION_3_0 |
| #define | CDK_VERSION_3_2 |
| #define | CDK_VERSION_3_4 |
| #define | CDK_VERSION_3_6 |
| #define | CDK_VERSION_3_8 |
| #define | CDK_VERSION_3_10 |
| #define | CDK_VERSION_3_12 |
| #define | CDK_VERSION_3_14 |
| #define | CDK_VERSION_MIN_REQUIRED |
| #define | CDK_VERSION_MAX_ALLOWED |
| #define | CDK_DISABLE_DEPRECATION_WARNINGS |
This section describes the CDK initialization functions and miscellaneous utility functions, as well as deprecation facilities.
The CDK and CTK+ headers annotate deprecated APIs in a way that produces
compiler warnings if these deprecated APIs are used. The warnings
can be turned off by defining the macro CDK_DISABLE_DEPRECATION_WARNINGS
before including the glib.h header.
CDK and CTK+ also provide support for building applications against
defined subsets of deprecated or new APIs. Define the macro
CDK_VERSION_MIN_REQUIRED to specify up to what version
you want to receive warnings about deprecated APIs. Define the
macro CDK_VERSION_MAX_ALLOWED to specify the newest version
whose API you want to use.
void cdk_init (gint *argc,gchar ***argv);
Initializes the CDK library and connects to the windowing system.
If initialization fails, a warning message is output and the application
terminates with a call to exit(1).
Any arguments used by CDK are removed from the array and argc
and argv
are updated accordingly.
CTK+ initializes CDK in ctk_init() and so this function is not usually
needed by CTK+ applications.
gboolean cdk_init_check (gint *argc,gchar ***argv);
Initializes the CDK library and connects to the windowing system,
returning TRUE on success.
Any arguments used by CDK are removed from the array and argc
and argv
are updated accordingly.
CTK+ initializes CDK in ctk_init() and so this function is not usually
needed by CTK+ applications.
void cdk_parse_args (gint *argc,gchar ***argv);
Parse command line arguments, and store for future
use by calls to cdk_display_open().
Any arguments used by CDK are removed from the array and argc
and argv
are
updated accordingly.
You shouldn’t call this function explicitly if you are using
ctk_init(), ctk_init_check(), cdk_init(), or cdk_init_check().
argc |
the number of command line arguments. |
|
argv |
the array of command line arguments. |
[inout][array length=argc] |
Since: 2.2
const gchar *
cdk_get_display_arg_name (void);
Gets the display name specified in the command line arguments passed
to cdk_init() or cdk_parse_args(), if any.
the display name, if specified explicitly,
otherwise NULL this string is owned by CTK+ and must not be
modified or freed.
[nullable]
Since: 2.2
void
cdk_notify_startup_complete (void);
Indicates to the GUI environment that the application has finished loading. If the applications opens windows, this function is normally called after opening the application’s initial set of windows.
CTK+ will call this function automatically after opening the first
CtkWindow unless ctk_window_set_auto_startup_notification() is called
to disable that feature.
Since: 2.2
void
cdk_notify_startup_complete_with_id (const gchar *startup_id);
Indicates to the GUI environment that the application has finished loading, using a given identifier.
CTK+ will call this function automatically for CtkWindow
with custom startup-notification identifier unless
ctk_window_set_auto_startup_notification() is called to
disable that feature.
startup_id |
a startup-notification identifier, for which notification process should be completed |
Since: 2.12
void
cdk_set_allowed_backends (const gchar *backends);
Sets a list of backends that CDK should try to use.
This can be be useful if your application does not work with certain CDK backends.
By default, CDK tries all included backends.
For example,
1 |
cdk_set_allowed_backends ("wayland,quartz,*"); |
instructs CDK to try the Wayland backend first, followed by the Quartz backend, and then all others.
If the CDK_BACKEND environment variable
is set, it determines what backends are tried in what
order, while still respecting the set of allowed backends
that are specified by this function.
The possible backend names are x11, win32, quartz, broadway, wayland. You can also include a * in the list to try all remaining backends.
This call must happen prior to cdk_display_open(),
ctk_init(), ctk_init_with_args() or ctk_init_check()
in order to take effect.
Since: 3.10
const gchar *
cdk_get_program_class (void);
Gets the program class. Unless the program class has explicitly
been set with cdk_set_program_class() or with the --class
commandline option, the default value is the program name (determined
with g_get_prgname()) with the first character converted to uppercase.
void
cdk_set_program_class (const gchar *program_class);
Sets the program class. The X11 backend uses the program class to set
the class name part of the WM_CLASS property on
toplevel windows; see the ICCCM.
The program class can still be overridden with the --class command line option.
gchar *
cdk_get_display (void);
cdk_get_display has been deprecated since version 3.8 and should not be used in newly-written code.
Call cdk_display_get_name (cdk_display_get_default()))
instead.
Gets the name of the display, which usually comes from the
DISPLAY environment variable or the
--display command line option.
void
cdk_flush (void);
cdk_flush is deprecated and should not be used in newly-written code.
Flushes the output buffers of all display connections and waits until all requests have been processed. This is rarely needed by applications.
gint
cdk_screen_width (void);
cdk_screen_width has been deprecated since version 3.22 and should not be used in newly-written code.
Use per-monitor information
Gets the width of the default screen in pixels. The returned
size is in ”application pixels”, not in ”device pixels” (see
cdk_screen_get_monitor_scale_factor()).
gint
cdk_screen_height (void);
cdk_screen_height has been deprecated since version 3.22 and should not be used in newly-written code.
Use per-monitor information
Gets the height of the default screen in pixels. The returned
size is in ”application pixels”, not in ”device pixels” (see
cdk_screen_get_monitor_scale_factor()).
gint
cdk_screen_width_mm (void);
cdk_screen_width_mm has been deprecated since version 3.22 and should not be used in newly-written code.
Use per-monitor information
Returns the width of the default screen in millimeters. Note that on many X servers this value will not be correct.
gint
cdk_screen_height_mm (void);
cdk_screen_height_mm has been deprecated since version 3.22 and should not be used in newly-written code.
Use per-monitor information
Returns the height of the default screen in millimeters. Note that on many X servers this value will not be correct.
CdkGrabStatus cdk_pointer_grab (CdkWindow *window,gboolean owner_events,CdkEventMask event_mask,CdkWindow *confine_to,CdkCursor *cursor,guint32 time_);
Grabs the pointer (usually a mouse) so that all events are passed to this
application until the pointer is ungrabbed with cdk_pointer_ungrab(), or
the grab window becomes unviewable.
This overrides any previous pointer grab by this client.
Pointer grabs are used for operations which need complete control over mouse events, even if the mouse leaves the application. For example in CTK+ it is used for Drag and Drop, for dragging the handle in the CtkHPaned and CtkVPaned widgets.
Note that if the event mask of an X window has selected both button press and
button release events, then a button press event will cause an automatic
pointer grab until the button is released.
X does this automatically since most applications expect to receive button
press and release events in pairs.
It is equivalent to a pointer grab on the window with owner_events
set to
TRUE.
If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the CdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.
window |
the CdkWindow which will own the grab (the grab window). |
|
owner_events |
if |
|
event_mask |
specifies the event mask, which is used in accordance with
|
|
confine_to |
If non- |
[allow-none] |
cursor |
the cursor to display while the grab is active. If this is |
[allow-none] |
time_ |
the timestamp of the event which led to this pointer grab. This usually
comes from a CdkEventButton struct, though |
void
cdk_pointer_ungrab (guint32 time_);
Ungrabs the pointer on the default display, if it is grabbed by this application.
gboolean
cdk_pointer_is_grabbed (void);
Returns TRUE if the pointer on the default display is currently
grabbed by this application.
Note that this does not take the inmplicit pointer grab on button presses into account.
void
cdk_set_double_click_time (guint msec);
cdk_set_double_click_time is deprecated and should not be used in newly-written code.
Set the double click time for the default display. See
cdk_display_set_double_click_time().
See also cdk_display_set_double_click_distance().
Applications should not set this, it is a
global user-configured setting.
CdkGrabStatus cdk_keyboard_grab (CdkWindow *window,gboolean owner_events,guint32 time_);
Grabs the keyboard so that all events are passed to this
application until the keyboard is ungrabbed with cdk_keyboard_ungrab().
This overrides any previous keyboard grab by this client.
If you set up anything at the time you take the grab that needs to be cleaned up when the grab ends, you should handle the CdkEventGrabBroken events that are emitted when the grab ends unvoluntarily.
window |
the CdkWindow which will own the grab (the grab window). |
|
owner_events |
if |
|
time_ |
a timestamp from a CdkEvent, or |
void
cdk_keyboard_ungrab (guint32 time_);
Ungrabs the keyboard on the default display, if it is grabbed by this application.
void
cdk_beep (void);
cdk_beep is deprecated and should not be used in newly-written code.
Emits a short beep on the default display.
void
cdk_error_trap_push (void);
cdk_error_trap_push is deprecated and should not be used in newly-written code.
This function allows X errors to be trapped instead of the normal
behavior of exiting the application. It should only be used if it
is not possible to avoid the X error in any other way. Errors are
ignored on all CdkDisplay currently known to the
CdkDisplayManager. If you don’t care which error happens and just
want to ignore everything, pop with cdk_error_trap_pop_ignored().
If you need the error code, use cdk_error_trap_pop() which may have
to block and wait for the error to arrive from the X server.
This API exists on all platforms but only does anything on X.
You can use cdk_x11_display_error_trap_push() to ignore errors
on only a single display.
gint
cdk_error_trap_pop (void);
cdk_error_trap_pop is deprecated and should not be used in newly-written code.
Removes an error trap pushed with cdk_error_trap_push().
May block until an error has been definitively received
or not received from the X server. cdk_error_trap_pop_ignored()
is preferred if you don’t need to know whether an error
occurred, because it never has to block. If you don't
need the return value of cdk_error_trap_pop(), use
cdk_error_trap_pop_ignored().
Prior to CDK 3.0, this function would not automatically
sync for you, so you had to cdk_flush() if your last
call to Xlib was not a blocking round trip.
void
cdk_error_trap_pop_ignored (void);
cdk_error_trap_pop_ignored is deprecated and should not be used in newly-written code.
Removes an error trap pushed with cdk_error_trap_push(), but
without bothering to wait and see whether an error occurred. If an
error arrives later asynchronously that was triggered while the
trap was pushed, that error will be ignored.
Since: 3.0
Returned by cdk_device_grab(), cdk_pointer_grab() and cdk_keyboard_grab() to
indicate success or the reason for the failure of the grab attempt.
|
the resource was successfully grabbed. |
||
|
the resource is actively grabbed by another client. |
||
|
the resource was grabbed more recently than the specified time. |
||
|
the grab window or the |
||
|
the resource is frozen by an active grab of another client. |
||
|
the grab failed for some other reason. Since 3.16 |
#define CDK_WINDOWING_X11
The CDK_WINDOWING_X11 macro is defined if the X11 backend is supported.
Use this macro to guard code that is specific to the X11 backend.
#define CDK_WINDOWING_WIN32
The CDK_WINDOWING_WIN32 macro is defined if the Win32 backend is supported.
Use this macro to guard code that is specific to the Win32 backend.
#define CDK_WINDOWING_QUARTZ
The CDK_WINDOWING_QUARTZ macro is defined if the Quartz backend is supported.
Use this macro to guard code that is specific to the Quartz backend.
#define CDK_WINDOWING_WAYLAND
The CDK_WINDOWING_WAYLAND macro is defined if the Wayland backend is supported.
Use this macro to guard code that is specific to the Wayland backend.
#define CDK_VERSION_3_0 (G_ENCODE_VERSION (3, 0))
A macro that evaluates to the 3.0 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.4
#define CDK_VERSION_3_2 (G_ENCODE_VERSION (3, 2))
A macro that evaluates to the 3.2 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.4
#define CDK_VERSION_3_4 (G_ENCODE_VERSION (3, 4))
A macro that evaluates to the 3.4 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.4
#define CDK_VERSION_3_6 (G_ENCODE_VERSION (3, 6))
A macro that evaluates to the 3.6 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.6
#define CDK_VERSION_3_8 (G_ENCODE_VERSION (3, 8))
A macro that evaluates to the 3.8 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.8
#define CDK_VERSION_3_10 (G_ENCODE_VERSION (3, 10))
A macro that evaluates to the 3.10 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.10
#define CDK_VERSION_3_12 (G_ENCODE_VERSION (3, 12))
A macro that evaluates to the 3.12 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.12
#define CDK_VERSION_3_14 (G_ENCODE_VERSION (3, 14))
A macro that evaluates to the 3.14 version of CDK, in a format that can be used by the C pre-processor.
Since: 3.14
# define CDK_VERSION_MIN_REQUIRED (CDK_VERSION_CUR_STABLE)
A macro that should be defined by the user prior to including
the cdk.h header.
The definition should be one of the predefined CDK version
macros: CDK_VERSION_3_0, CDK_VERSION_3_2,...
This macro defines the lower bound for the CDK API to use.
If a function has been deprecated in a newer version of CDK, it is possible to use this symbol to avoid the compiler warnings without disabling warning for every deprecated function.
Since: 3.4
# define CDK_VERSION_MAX_ALLOWED CDK_VERSION_MIN_REQUIRED
A macro that should be defined by the user prior to including
the cdk.h header.
The definition should be one of the predefined CDK version
macros: CDK_VERSION_3_0, CDK_VERSION_3_2,...
This macro defines the upper bound for the CDK API to use.
If a function has been introduced in a newer version of CDK, it is possible to use this symbol to get compiler warnings when trying to use that function.
Since: 3.4