Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
chatty
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
172
Issues
172
List
Boards
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Librem5
chatty
Commits
9348937e
Commit
9348937e
authored
Oct 18, 2019
by
Andrea Schaefer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue
#203
'Keyboard open doesn't auto-scroll screen to bottom'
parent
5e03e282
Pipeline
#40088
passed with stages
in 8 minutes and 7 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
22 deletions
+45
-22
src/chatty-message-list.c
src/chatty-message-list.c
+32
-6
src/ui/chatty-message-list.ui
src/ui/chatty-message-list.ui
+11
-3
src/ui/chatty-pane-msg-view.ui
src/ui/chatty-pane-msg-view.ui
+2
-13
No files found.
src/chatty-message-list.c
View file @
9348937e
...
...
@@ -6,6 +6,8 @@
#include <glib.h>
#include <glib/gi18n.h>
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
...
...
@@ -42,7 +44,6 @@ static guint signals [SIGNAL_LAST_SIGNAL];
typedef
struct
{
GtkBox
*
disclaimer
;
GtkBox
*
container
;
GtkWidget
*
list
;
GtkWidget
*
scroll
;
GtkWidget
*
button
;
...
...
@@ -57,6 +58,7 @@ typedef struct
guint
message_type
;
guint
width
;
guint
height
;
guint
prev_height
;
guint
longpress_timeout_handle
;
guint32
refresh_timeout_handle
;
gboolean
first_scroll_to_bottom
;
...
...
@@ -128,13 +130,27 @@ cb_list_size_allocate (GtkWidget *sender,
size
=
gtk_adjustment_get_page_size
(
adj
);
upper
=
gtk_adjustment_get_upper
(
adj
);
value
=
gtk_adjustment_get_value
(
adj
);
// Only scroll to the bottom if in the proximity of bottom.
if
(
!
priv
->
first_scroll_to_bottom
||
abs
(
upper
-
value
)
<
size
*
1
.
5
){
gtk_adjustment_set_value
(
adj
,
upper
-
size
);
priv
->
first_scroll_to_bottom
=
TRUE
;
}
}
static
void
cb_cont_size_allocate
(
GtkWidget
*
sender
,
GtkAllocation
*
allocation
,
gpointer
self
)
{
ChattyMsgListPrivate
*
priv
=
chatty_msg_list_get_instance_private
(
self
);
if
(
priv
->
prev_height
>
0
&&
priv
->
prev_height
!=
allocation
->
height
)
{
cb_list_size_allocate
(
NULL
,
NULL
,
self
);
}
priv
->
prev_height
=
allocation
->
height
;
}
...
...
@@ -728,10 +744,17 @@ chatty_msg_list_constructed (GObject *object)
G_CALLBACK
(
cb_scroll_edge_reached
),
self
);
g_signal_connect
(
GTK_WIDGET
(
self
),
"size-allocate"
,
G_CALLBACK
(
cb_cont_size_allocate
),
self
);
priv
->
first_scroll_to_bottom
=
FALSE
;
priv
->
typing_indicator
=
NULL
;
priv
->
prev_height
=
0
;
path
=
"/sm/puri/chatty/ui/chatty-message-list-popover.ui"
;
builder
=
gtk_builder_new_from_resource
(
path
);
...
...
@@ -751,22 +774,25 @@ chatty_msg_list_constructed (GObject *object)
}
static
void
chatty_msg_list_size_allocate
(
GtkWidget
*
widget
,
GtkAllocation
*
allocation
){
static
void
chatty_msg_list_size_allocate
(
GtkWidget
*
widget
,
GtkAllocation
*
allocation
)
{
GtkScrolledWindow
*
scroll
;
GtkViewport
*
view
;
HdyColumn
*
column
;
GtkListBox
*
list
;
GtkListBoxRow
*
row
;
GtkRevealer
*
revealer
;
GtkBox
*
hbox
,
*
vbox
;
GtkAllocation
hbox_allocation
;
GtkAllocation
hbox_allocation
;
GList
*
children
;
children
=
gtk_container_get_children
(
GTK_CONTAINER
(
widget
));
scroll
=
GTK_SCROLLED_WINDOW
(
g_list_first
(
children
)
->
data
);
view
=
GTK_VIEWPORT
(
gtk_bin_get_child
(
GTK_BIN
(
scroll
)));
list
=
GTK_LIST_BOX
(
gtk_bin_get_child
(
GTK_BIN
(
view
)));
column
=
HDY_COLUMN
(
gtk_bin_get_child
(
GTK_BIN
(
view
)));
list
=
GTK_LIST_BOX
(
gtk_bin_get_child
(
GTK_BIN
(
column
)));
children
=
gtk_container_get_children
(
GTK_CONTAINER
(
list
));
...
...
src/ui/chatty-message-list.ui
View file @
9348937e
...
...
@@ -13,10 +13,18 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
<object
class=
"
GtkListBox"
id=
"list
"
>
<object
class=
"
HdyColumn
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"activate_on_single_click"
>
False
</property>
<property
name=
"maximum-width"
>
640
</property>
<property
name=
"linear-growth-width"
>
640
</property>
<child>
<object
class=
"GtkListBox"
id=
"list"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"activate_on_single_click"
>
False
</property>
</object>
</child>
</object>
</child>
</object>
...
...
@@ -29,4 +37,4 @@
</packing>
</child>
</template>
</interface>
</interface>
\ No newline at end of file
src/ui/chatty-pane-msg-view.ui
View file @
9348937e
...
...
@@ -39,21 +39,10 @@
<class
name=
"box_message"
/>
</style>
<child>
<object
class=
"HdyColumn"
>
<object
class=
"GtkBox"
id=
"msg_view_list"
>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"maximum-width"
>
640
</property>
<property
name=
"linear-growth-width"
>
640
</property>
<child>
<object
class=
"GtkBox"
id=
"msg_view_list"
>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
</child>
<property
name=
"visible"
>
True
</property>
</object>
</child>
</object>
<packing>
<property
name=
"expand"
>
True
</property>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment