Merge branch 'rtl-margins' into 'master'

Flip margin-start and -end in RTL

Closes #3583

See merge request GNOME/gtk!3081
This commit is contained in:
Matthias Clasen 2021-01-16 00:19:41 +00:00
commit e1a308d151
4 changed files with 85 additions and 1 deletions

View File

@ -3900,7 +3900,10 @@ gtk_widget_allocate (GtkWidget *widget,
priv->allocated_height = height;
priv->allocated_size_baseline = baseline;
adjusted.x = priv->margin.left;
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
adjusted.x = priv->margin.left;
else
adjusted.x = priv->margin.right;
adjusted.y = priv->margin.top;
adjusted.width = width - priv->margin.left - priv->margin.right;
adjusted.height = height - priv->margin.top - priv->margin.bottom;

View File

@ -0,0 +1,23 @@
@import "reset-to-defaults.css";
window {
background-color: purple;
}
#red {
background-color: red;
min-width: 100px;
min-height: 100px;
}
#yellow {
background-color: yellow;
min-width: 100px;
min-height: 100px;
}
#green {
background-color: green;
min-width: 100px;
min-height: 100px;
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="decorated">0</property>
<property name="resizable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkDrawingArea">
<property name="name">green</property>
<property name="margin-end">50</property>
</object>
</child>
<child>
<object class="GtkDrawingArea">
<property name="name">yellow</property>
<property name="margin-end">10</property>
</object>
</child>
<child>
<object class="GtkDrawingArea">
<property name="name">red</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="decorated">0</property>
<property name="resizable">0</property>
<signal name="map" handler="reftest:set_default_direction_rtl" swapped="no"/>
<signal name="destroy" handler="reftest:set_default_direction_ltr" swapped="no"/>
<child>
<object class="GtkBox">
<child>
<object class="GtkDrawingArea">
<property name="name">red</property>
</object>
</child>
<child>
<object class="GtkDrawingArea">
<property name="name">yellow</property>
<property name="margin-start">10</property>
</object>
</child>
<child>
<object class="GtkDrawingArea">
<property name="margin-start">50</property>
<property name="name">green</property>
</object>
</child>
</object>
</child>
</object>
</interface>