shell: Make active hint size configurable
This commit is contained in:
parent
6492cfb96a
commit
4bf2c8df79
7 changed files with 58 additions and 26 deletions
|
|
@ -34,6 +34,7 @@ pub type SeatMoveGrabState = RefCell<Option<MoveGrabState>>;
|
|||
pub struct MoveGrabState {
|
||||
window: CosmicMapped,
|
||||
window_offset: Point<i32, Logical>,
|
||||
indicator_thickness: u8,
|
||||
}
|
||||
|
||||
impl MoveGrabState {
|
||||
|
|
@ -59,11 +60,17 @@ impl MoveGrabState {
|
|||
let scale = output.current_scale().fractional_scale().into();
|
||||
let render_location = cursor_at.to_i32_round() - output.geometry().loc + self.window_offset;
|
||||
|
||||
let mut elements: Vec<I> = vec![CosmicMappedRenderElement::from(IndicatorShader::element(
|
||||
renderer,
|
||||
Rectangle::from_loc_and_size(render_location, self.window.geometry().size),
|
||||
))
|
||||
.into()];
|
||||
let mut elements: Vec<I> = Vec::new();
|
||||
if self.indicator_thickness > 0 {
|
||||
elements.push(
|
||||
CosmicMappedRenderElement::from(IndicatorShader::element(
|
||||
renderer,
|
||||
Rectangle::from_loc_and_size(render_location, self.window.geometry().size),
|
||||
self.indicator_thickness,
|
||||
))
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
elements.extend(AsRenderElements::<R>::render_elements::<I>(
|
||||
&self.window,
|
||||
renderer,
|
||||
|
|
@ -172,6 +179,7 @@ impl MoveSurfaceGrab {
|
|||
seat: &Seat<State>,
|
||||
initial_cursor_location: Point<f64, Logical>,
|
||||
initial_window_location: Point<i32, Logical>,
|
||||
indicator_thickness: u8,
|
||||
) -> MoveSurfaceGrab {
|
||||
let output = seat.active_output();
|
||||
let mut outputs = HashSet::new();
|
||||
|
|
@ -182,6 +190,7 @@ impl MoveSurfaceGrab {
|
|||
window: window.clone(),
|
||||
window_offset: dbg!(initial_window_location)
|
||||
- dbg!(initial_cursor_location.to_i32_round()),
|
||||
indicator_thickness,
|
||||
};
|
||||
|
||||
*seat
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ impl FloatingLayout {
|
|||
renderer: &mut R,
|
||||
output: &Output,
|
||||
focused: Option<&CosmicMapped>,
|
||||
indicator_thickness: u8,
|
||||
) -> Vec<CosmicMappedRenderElement<R>>
|
||||
where
|
||||
R: Renderer + ImportAll + ImportMem + AsGlowRenderer,
|
||||
|
|
@ -372,14 +373,17 @@ impl FloatingLayout {
|
|||
output_scale.into(),
|
||||
);
|
||||
if focused == Some(elem) {
|
||||
let element = IndicatorShader::element(
|
||||
renderer,
|
||||
Rectangle::from_loc_and_size(
|
||||
self.space.element_location(elem).unwrap(),
|
||||
elem.geometry().size,
|
||||
),
|
||||
);
|
||||
elements.insert(0, element.into());
|
||||
if indicator_thickness > 0 {
|
||||
let element = IndicatorShader::element(
|
||||
renderer,
|
||||
Rectangle::from_loc_and_size(
|
||||
self.space.element_location(elem).unwrap(),
|
||||
elem.geometry().size,
|
||||
),
|
||||
indicator_thickness,
|
||||
);
|
||||
elements.insert(0, element.into());
|
||||
}
|
||||
}
|
||||
elements
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1306,6 +1306,7 @@ impl TilingLayout {
|
|||
renderer: &mut R,
|
||||
output: &Output,
|
||||
focused: Option<&CosmicMapped>,
|
||||
indicator_thickness: u8,
|
||||
) -> Result<Vec<CosmicMappedRenderElement<R>>, OutputNotMapped>
|
||||
where
|
||||
R: Renderer + ImportAll + ImportMem + AsGlowRenderer,
|
||||
|
|
@ -1383,11 +1384,14 @@ impl TilingLayout {
|
|||
Scale::from(output_scale),
|
||||
);
|
||||
if focused == Some(mapped) {
|
||||
let element = IndicatorShader::element(
|
||||
renderer,
|
||||
Rectangle::from_loc_and_size(loc, mapped.geometry().size),
|
||||
);
|
||||
elements.insert(0, element.into());
|
||||
if indicator_thickness > 0 {
|
||||
let element = IndicatorShader::element(
|
||||
renderer,
|
||||
Rectangle::from_loc_and_size(loc, mapped.geometry().size),
|
||||
indicator_thickness,
|
||||
);
|
||||
elements.insert(0, element.into());
|
||||
}
|
||||
}
|
||||
elements
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1278,8 +1278,13 @@ impl Shell {
|
|||
.windows()
|
||||
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface))
|
||||
.unwrap();
|
||||
if let Some(grab) = workspace.move_request(&window, &seat, &output, start_data)
|
||||
{
|
||||
if let Some(grab) = workspace.move_request(
|
||||
&window,
|
||||
&seat,
|
||||
&output,
|
||||
start_data,
|
||||
state.common.config.static_conf.active_hint,
|
||||
) {
|
||||
let handle = workspace.handle;
|
||||
state
|
||||
.common
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ impl Workspace {
|
|||
seat: &Seat<State>,
|
||||
output: &Output,
|
||||
start_data: PointerGrabStartData<State>,
|
||||
indicator_thickness: u8,
|
||||
) -> Option<MoveSurfaceGrab> {
|
||||
let pointer = seat.get_pointer().unwrap();
|
||||
let pos = pointer.current_location();
|
||||
|
|
@ -348,6 +349,7 @@ impl Workspace {
|
|||
seat,
|
||||
pos,
|
||||
initial_window_location,
|
||||
indicator_thickness,
|
||||
))
|
||||
} else {
|
||||
None // TODO
|
||||
|
|
@ -439,6 +441,7 @@ impl Workspace {
|
|||
override_redirect_windows: &[X11Surface],
|
||||
xwm_state: Option<&'a mut XWaylandState>,
|
||||
draw_focus_indicator: Option<&Seat<State>>,
|
||||
indicator_thickness: u8,
|
||||
exclude_workspace_overview: bool,
|
||||
) -> Result<Vec<WorkspaceRenderElement<R>>, OutputNotMapped>
|
||||
where
|
||||
|
|
@ -572,7 +575,7 @@ impl Workspace {
|
|||
// floating surfaces
|
||||
render_elements.extend(
|
||||
self.floating_layer
|
||||
.render_output::<R>(renderer, output, focused.as_ref())
|
||||
.render_output::<R>(renderer, output, focused.as_ref(), indicator_thickness)
|
||||
.into_iter()
|
||||
.map(WorkspaceRenderElement::from),
|
||||
);
|
||||
|
|
@ -580,7 +583,7 @@ impl Workspace {
|
|||
//tiling surfaces
|
||||
render_elements.extend(
|
||||
self.tiling_layer
|
||||
.render_output::<R>(renderer, output, focused.as_ref())?
|
||||
.render_output::<R>(renderer, output, focused.as_ref(), indicator_thickness)?
|
||||
.into_iter()
|
||||
.map(WorkspaceRenderElement::from),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue