From 07e781d357003870f2b5bffb563d114bf2ba9bc5 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 13 Sep 2024 01:12:05 +0300 Subject: [PATCH] add window full screen support --- src/app/browser.cpp | 27 +++++++++++++++++---------- src/app/browser.hpp | 5 +++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/app/browser.cpp b/src/app/browser.cpp index 19405892..093762e1 100644 --- a/src/app/browser.cpp +++ b/src/app/browser.cpp @@ -203,6 +203,8 @@ Browser::Browser( HEIGHT ); + IS_FULLSCREEN ? fullscreen() : unfullscreen(); + // Init components browserHeader = Gtk::make_managed( ACTION__DEBUG, @@ -278,7 +280,7 @@ int Browser::restore() while (sqlite3_step(statement) == SQLITE_ROW) { // Restore widget settings - set_default_size( // @TODO actualize + set_default_size( sqlite3_column_int( statement, DB::SESSION::WIDTH @@ -289,6 +291,11 @@ int Browser::restore() ) ); + sqlite3_column_int( + statement, + DB::SESSION::IS_FULLSCREEN + ) ? fullscreen() : unfullscreen(); + // Restore children components browserMain->restore( sqlite3_column_int( @@ -327,7 +334,7 @@ void Browser::save() db, get_width(), get_height(), - false // @TODO full screen status + is_fullscreen() ); // Delegate save actions to children components @@ -347,11 +354,11 @@ int Browser::DB::SESSION::init( R"SQL( CREATE TABLE IF NOT EXISTS `app_browser__session` ( - `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - `time` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, - `width` INTEGER NOT NULL, - `height` INTEGER NOT NULL, - `is_full_screen` INTEGER NOT NULL + `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + `time` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, + `width` INTEGER NOT NULL, + `height` INTEGER NOT NULL, + `is_fullscreen` INTEGER NOT NULL ) )SQL", nullptr, @@ -420,7 +427,7 @@ sqlite3_int64 Browser::DB::SESSION::add( sqlite3 * db, const int & WIDTH, const int & HEIGHT, - const bool & IS_FULL_SCREEN + const bool & IS_FULLSCREEN ) { char * error; // @TODO @@ -431,7 +438,7 @@ sqlite3_int64 Browser::DB::SESSION::add( INSERT INTO `app_browser__session` ( `width`, `height`, - `is_full_screen` + `is_fullscreen` ) VALUES ( %d, %d, @@ -440,7 +447,7 @@ sqlite3_int64 Browser::DB::SESSION::add( )SQL", WIDTH, HEIGHT, - IS_FULL_SCREEN ? 1 : 0 + IS_FULLSCREEN ? 1 : 0 ).c_str(), nullptr, nullptr, diff --git a/src/app/browser.hpp b/src/app/browser.hpp index 25a2a246..4778148d 100644 --- a/src/app/browser.hpp +++ b/src/app/browser.hpp @@ -42,7 +42,7 @@ namespace app TIME, WIDTH, HEIGHT, - IS_FULL_SCREEN + IS_FULLSCREEN }; // table fields index static int init( @@ -57,7 +57,7 @@ namespace app sqlite3 * db, const int & WIDTH, const int & HEIGHT, - const bool & IS_FULL_SCREEN + const bool & IS_FULLSCREEN ); // return sqlite3_last_insert_rowid }; }; @@ -77,6 +77,7 @@ namespace app // Defaults const int WIDTH = 640; const int HEIGHT = 480; + const bool IS_FULLSCREEN = false; /* * Browser class API