Module callback

Source
Expand description

Register wlc callbacks to events.

See individual methods for callback details.

§wlc Example

use rustwlc;
use rustwlc::callback;
use rustwlc::WlcView;

// An example callback function
// See the various functions in this module for more information
extern "C" fn view_focus_callback(view: WlcView, focused: bool) {
    println!("A view came into focus!");
}

// Set a default log callback
rustwlc::log_set_default_handler();

// Register some callbacks
callback::view_focus(view_focus_callback);
// ... and additional callbacks

// The only thing your code should do before init2 is register callbacks
// and log handlers.
let run_wlc = rustwlc::init2()
    .expect("Unable to initialize wlc!");

run_wlc();

Functions§

compositor_ready
Callback invoked by wlc after rustwlc::init is called.
compositor_terminate
Callback invoked by wlc when a compositor is terminating
keyboard_key
Callback invoked on keypresses. Return true to block the press from the view.
output_context_created
Output context destroyed
output_context_destroyed
Output context created. This generally happens on a tty switch.
output_created
Callback invoked when an output is created. Return true to allow the output to exist.
output_destroyed
Callback invoked when an output is destroyed.
output_focus
Callback invoked when an output gains focus.
output_render_post
Callback invoked post-render for an output.
output_render_pre
Callback invoked pre-render for an output.
output_resolution
Callback invoked when an output’s resolution changes.
pointer_button
Callback invoked on mouse clicks. Return true to block the click from the view.
pointer_motionDeprecated
Callback invoked on pointer motion. Return true to block the motion from the view.
pointer_motion_v2
Callback invoked on pointer motion. Return true to block the motion from the view.
pointer_scroll
Callback invoked on mouse scroll. Return true to block the scroll from the view.
positioner_get_anchor
Get anchor requested by positioner, as defined in xdg-shell v6. Returns default value WLC_BIT_GRAVITY_NONE if view has no valid positioner or if positioner has no gravity set.
positioner_get_anchor_rect
Get anchor requested by positioner, as defined in xdg-shell v6. Returns default value WLC_BIT_ANCHOR_NONE if view has no valid positioner or if positioner has no anchor set.
positioner_get_constraint_adjustment
positioner_get_gravity
positioner_get_size
Get size requested by positioner, as defined in xdg-shell v6.
touch
Callback invoked on touchscreen touch. Return true to block the touch from the view.
view_created
Callback invoked when a view is created. Return true to allow the view to be created.
view_destroyed
Callback invoked when a view is destroyed.
view_focus
Callback invoked when a view is focused.
view_move_to_output
Callback invoked when a view switches outputs.
view_properties_changed
Callback invoked when a WlcView has its properties updated.
view_render_post
Callback invoked post-view-render.
view_render_pre
Callback invoked pre-view-render.
view_request_geometry
Callback invoked when a view requests geometry.
view_request_move
Callback invoked when a view requests a move.
view_request_resize
Callback invoked when a view requests a resize.
view_request_state
Callback invoked when a view requests a ViewState.