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_
motion Deprecated - 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
.