Fix interaction of borders/background and scrolling

StBoxLayout: Make consistent that the area scrolled and clipped
to is the content area (excluding borders and padding.) Translate
back appropriately when chaining up so that the parent background
is drawn at the right place and picking on the box (if it's reactive)
picks at the right place on the screen.

clip-to-allocation is removed from StScrollView since it's just
not right - if the child has any non-moving elements, like headers or
borders, it will need to set a narrower clip. And even if the entire
child scrolls, we want to clip to an arrow that excludes the scrollbars.

https://bugzilla.gnome.org/show_bug.cgi?id=595997
This commit is contained in:
Owen W. Taylor
2009-09-21 19:11:09 -04:00
parent 28dbf7a06e
commit a15205e6c4
3 changed files with 106 additions and 41 deletions

View File

@ -8,11 +8,17 @@ const UI = imports.testcommon.ui;
UI.init();
let stage = Clutter.Stage.get_default();
let v = new St.ScrollView({});
stage.add_actor(v);
let vbox = new St.BoxLayout({ vertical: true,
width: stage.width,
height: stage.height,
style: "padding: 10px;" });
stage.add_actor(vbox);
let v = new St.ScrollView();
vbox.add(v, { expand: true });
let b = new St.BoxLayout({ vertical: true,
width: stage.width,
height: stage.height });
style: "border: 2px solid #880000; border-radius: 10px; padding: 0px 5px;" });
v.add_actor(b);
let cc_a = "a".charCodeAt(0);
@ -20,9 +26,16 @@ let s = "";
for (let i = 0; i < 26 * 3; i++) {
s += String.fromCharCode(cc_a + i % 26);
let t = new St.Label({ "text": s});
let t = new St.Label({ text: s,
reactive: true });
let line = i + 1;
t.connect('button-press-event',
function() {
log("Click on line " + line);
});
b.add(t);
}
stage.show();
Clutter.main();
stage.destroy();