Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1d0e89d

Browse filesBrowse files
committed
Added libadwaita init and some optimization
1 parent 1b4c329 commit 1d0e89d
Copy full SHA for 1d0e89d

File tree

Expand file treeCollapse file tree

4 files changed

+10
-14
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+10
-14
lines changed

‎CMakeLists.txt

Copy file name to clipboardExpand all lines: CMakeLists.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set(LITEBROWSER_PATH src)
1919
set(LITEHTML_PATH litehtml)
2020
set(CONTAINER_PATH ${LITEHTML_PATH}/containers/cairo)
2121

22-
pkg_check_modules(LB_LIBS REQUIRED gtkmm-4.0 libcurl cairo pango pangocairo)
22+
pkg_check_modules(LB_LIBS REQUIRED gtkmm-4.0 libcurl cairo pango pangocairo libadwaita-1)
2323

2424
set(SOURCE ${LITEBROWSER_PATH}/main.cpp
2525
${LITEBROWSER_PATH}/widget/html_widget.cpp

‎src/browser_wnd.cpp

Copy file name to clipboardExpand all lines: src/browser_wnd.cpp
+1-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,7 @@ struct
2424
static inline void mk_button(Gtk::Button& btn, const std::string& label_text, const std::string& icon_name)
2525
{
2626
btn.set_focusable(false);
27-
28-
auto icon = Gtk::make_managed<Gtk::Image>();
29-
icon->set_from_icon_name(icon_name);
30-
icon->set_icon_size(Gtk::IconSize::NORMAL);
31-
icon->set_expand(true);
32-
33-
auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL);
34-
hbox->append(*icon);
35-
hbox->set_expand(false);
36-
37-
btn.set_child(*hbox);
27+
btn.set_image_from_icon_name(icon_name);
3828
btn.set_tooltip_text(label_text);
3929
}
4030

‎src/main.cpp

Copy file name to clipboardExpand all lines: src/main.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#ifdef FOR_TESTING
33
#include "fonts.h"
44
#endif
5+
#include <adwaita.h>
56

67
int on_cmd(const Glib::RefPtr<Gio::ApplicationCommandLine> &, Glib::RefPtr<Gtk::Application> &app)
78
{
@@ -10,6 +11,7 @@ int on_cmd(const Glib::RefPtr<Gio::ApplicationCommandLine> &, Glib::RefPtr<Gtk::
1011
}
1112
int main (int argc, char *argv[])
1213
{
14+
adw_init();
1315
#ifdef FOR_TESTING
1416
prepare_fonts_for_testing();
1517
#endif

‎src/widget/html_widget.h

Copy file name to clipboardExpand all lines: src/widget/html_widget.h
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class draw_buffer
244244
m_draw_buffer = nullptr;
245245
if(m_width > 0 && m_height > 0)
246246
{
247-
m_draw_buffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
247+
m_draw_buffer = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
248248
std::ceil((double) m_width * m_scale_factor),
249249
std::ceil((double) m_height * m_scale_factor));
250250
}
@@ -286,7 +286,7 @@ class draw_buffer
286286
int surface_shift_y = (int) std::floor((double) (m_top - top) * m_scale_factor);
287287
//printf("[surface_shift] top:%d m_top:%d x:%d y:%d\n", top, m_top, surface_shift_x, surface_shift_y);
288288

289-
auto new_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, scaled_width, scaled_height);
289+
auto new_surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, scaled_width, scaled_height);
290290
cairo_t* cr = cairo_create(new_surface);
291291
cairo_rectangle(cr, (rec_clean.get_x() - left) * m_scale_factor - m_scale_factor,
292292
(rec_clean.get_y() - top) * m_scale_factor - m_scale_factor,
@@ -351,6 +351,10 @@ class draw_buffer
351351
cairo_rectangle(cr, s_x, s_y, s_width, s_height);
352352
cairo_clip(cr);
353353

354+
cairo_rectangle(cr, s_x, s_y, s_width, s_height);
355+
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
356+
cairo_fill(cr);
357+
354358
// Apply scale for drawing
355359
cairo_scale(cr, m_scale_factor, m_scale_factor);
356360

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.