st/scroll-view: Add private API to query bar offsets
The scroll fade effect is the only component that accesses the {v,h}scroll properties for anything other than getting access to the corresponding adjustments. Allow the effect to get what it needs via new private API instead, so we can deprecate and eventually remove the scroll bar properties. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
This commit is contained in:
parent
d243a9ba93
commit
14749744a3
30
src/st/st-scroll-view-private.h
Normal file
30
src/st/st-scroll-view-private.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/*
|
||||
* st-scroll-view-private.h: Private StSrollView methods
|
||||
*
|
||||
* Copyright 2023 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU Lesser General Public License,
|
||||
* version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "st-scroll-view.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void st_scroll_view_get_bar_offsets (StScrollView *scroll_view,
|
||||
float *hoffset,
|
||||
float *voffset);
|
||||
|
||||
G_END_DECLS
|
@ -60,7 +60,7 @@
|
||||
|
||||
#include "st-enum-types.h"
|
||||
#include "st-private.h"
|
||||
#include "st-scroll-view.h"
|
||||
#include "st-scroll-view-private.h"
|
||||
#include "st-scroll-bar.h"
|
||||
#include "st-scrollable.h"
|
||||
#include "st-scroll-view-fade.h"
|
||||
@ -1494,3 +1494,27 @@ st_scroll_view_set_policy (StScrollView *scroll,
|
||||
|
||||
g_object_thaw_notify ((GObject *) scroll);
|
||||
}
|
||||
|
||||
void
|
||||
st_scroll_view_get_bar_offsets (StScrollView *scroll,
|
||||
float *hoffset,
|
||||
float *voffset)
|
||||
{
|
||||
StScrollViewPrivate *priv;
|
||||
|
||||
g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));
|
||||
|
||||
priv = st_scroll_view_get_instance_private (scroll);
|
||||
|
||||
if (hoffset)
|
||||
{
|
||||
*hoffset = priv->vscrollbar_visible ? clutter_actor_get_width (priv->vscroll)
|
||||
: 0.;
|
||||
}
|
||||
|
||||
if (voffset)
|
||||
{
|
||||
*voffset = priv->hscrollbar_visible ? clutter_actor_get_height (priv->hscroll)
|
||||
: 0.;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user