Enhancement: Fixes #335, Create test for setup graphical mode X session

This commit is contained in:
Rory Fewell
2024-07-06 16:32:04 +01:00
parent ebd7523665
commit 6b45030e1f
29 changed files with 783 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
cmake_minimum_required(VERSION 3.5)
project(
wintc-setup-gui
VERSION 1.0
DESCRIPTION "Windows Total Conversion graphical phase setup."
LANGUAGES C
)
set(PROJECT_ANYARCH false)
set(PROJECT_FREESTATUS false)
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
include(GNUInstallDirs)
include(../../../packaging/cmake-inc/common/CMakeLists.txt)
include(../../../packaging/cmake-inc/linking/CMakeLists.txt)
include(../../../packaging/cmake-inc/packaging/CMakeLists.txt)
include(../../../packaging/cmake-inc/resources/CMakeLists.txt)
wintc_resolve_library(glib-2.0 GLIB)
wintc_resolve_library(gtk+-3.0 GTK3)
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
wintc_resolve_library(wintc-shelldpa WINTC_SHELLDPA)
wintc_resolve_library(wintc-shlang WINTC_SHLANG)
wintc_compile_resources()
add_executable(
wintc-setup-gui
src/main.c
src/resources.c
src/setupwnd.c
src/setupwnd.h
)
set_target_properties(
wintc-setup-gui
PROPERTIES
OUTPUT_NAME wsetupx
)
target_compile_options(
wintc-setup-gui
PRIVATE ${WINTC_COMPILE_OPTIONS}
)
target_include_directories(
wintc-setup-gui
SYSTEM
BEFORE
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${WINTC_SHELLDPA_INCLUDE_DIRS}
PRIVATE ${WINTC_SHLANG_INCLUDE_DIRS}
)
target_link_directories(
wintc-setup-gui
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
PRIVATE ${WINTC_SHELLDPA_LIBRARY_DIRS}
PRIVATE ${WINTC_SHLANG_LIBRARY_DIRS}
)
target_link_libraries(
wintc-setup-gui
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
PRIVATE ${WINTC_SHELLDPA_LIBRARIES}
PRIVATE ${WINTC_SHLANG_LIBRARIES}
)
# Installation
#
wintc_configure_and_install_packaging()
install(
FILES res/wsetupx.service
DESTINATION ${WINTC_ASSETS_INSTALL_DIR}/setup
)
install(
FILES src/xinitrc
DESTINATION ${WINTC_ASSETS_INSTALL_DIR}/setup
)
install(
TARGETS wintc-setup-gui
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -0,0 +1,28 @@
Welcome to WinTC Release Preview
Thanks for installing and trying out Windows Total Conversion Release Preview! It has been a long road to reach this first test release, and there's still plenty left to do.
Please report any bugs, feedback, or technical contributions you may have as this would be beneficial to improving the project.
--
Your distro matters
Windows Total Conversion provides you with the Windows XP user interface without imposing on your choice of OS distribution.
Included programs adapt to support your configuration, so your computer works the way you want it to.
--
Familiar and fun, enjoy computing again
Software does not have to be so lifeless, the Windows Total Conversion project is driven by enthusiasm for fun and usefulness in computing.
Feel free to toy around and personalize your environment, and know your bug reports will be taken seriously!
--
Thank you, and enjoy!
I sincerely hope you enjoy using Windows Total Conversion. Whilst this first release may be at the bottom of the mountain, it should be much less fuss for you to try out!
Thank you and have fun!
Rory

3
base/setup/guiphase/deps Normal file
View File

@@ -0,0 +1,3 @@
bt,rt:glib2
bt,rt:gtk3
bt,rt:wintc-comgtk

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Windows WinTC Setup (Graphical Phase)
Before=display-manager.service
[Service]
# FIXME: Needs to be configured by CMake...
ExecStart=startx /usr/share/wintc/setup/xinitrc
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,84 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/comgtk.h>
#include <wintc/shelldpa.h>
#include "setupwnd.h"
//
// FORWARD DECLARATIONS
//
static void on_window_destroyed(
GtkWidget* widget,
gpointer user_data
);
//
// ENTRY POINT
//
int main(
int argc,
char* argv[]
)
{
gtk_init(&argc, &argv);
if (!wintc_init_display_protocol_apis())
{
g_critical("%s", "Failed to resolve display protocol APIs.");
return 0;
}
// Set up styling
//
GtkCssProvider* css = gtk_css_provider_new();
gtk_css_provider_load_from_resource(
css,
"/uk/oddmatics/wintc/wsetupx/setupwnd.css"
);
gtk_style_context_add_provider_for_screen(
gdk_screen_get_default(),
GTK_STYLE_PROVIDER(css),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
);
// Create setup background window
//
GtkWidget* wnd_setup = wintc_setup_window_new();
// Create a billy basic test window (will be replaced by a wizard
// eventually
//
GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Hello World!");
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(wnd_setup));
g_signal_connect(
window,
"destroy",
G_CALLBACK(on_window_destroyed),
NULL
);
// Launch!
//
gtk_widget_show_all(wnd_setup);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
//
// CALLBACKS
//
static void on_window_destroyed(
WINTC_UNUSED(GtkWidget* widget),
WINTC_UNUSED(gpointer user_data)
)
{
gtk_main_quit();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/uk/oddmatics/wintc/wsetupx">
<!-- -->
<!-- GRAPHICAL RESOURCES -->
<!-- -->
<file>bgmain.png</file>
<file>bgsteps.png</file>
<file>borderb.png</file>
<file>bordert.png</file>
<file>bullcur.png</file>
<file>bulldone.png</file>
<file>bullnull.png</file>
<file>logo.png</file>
<file>throb1.png</file>
<file>throb2.png</file>
<file>throb3.png</file>
<file>throb4.png</file>
<!-- -->
<!-- STYLESHEETS -->
<!-- -->
<file>setupwnd.css</file>
<!-- -->
<!-- STRUCTURE -->
<!-- -->
<file>setupwnd.ui</file>
</gresource>
</gresources>

View File

@@ -0,0 +1,79 @@
.setup-wnd
{
background: #4E6FD6;
color: #FFF;
}
.setup-top,
.setup-bottom
{
min-height: 35px;
}
.setup-top
{
background: #003399;
border-bottom: 2px solid #000;
border-image: url('resource:///uk/oddmatics/wintc/wsetupx/bordert.png') 0 0 2 0;
}
.setup-top image
{
margin-left: 10px;
}
.setup-steps
{
background: url('resource:///uk/oddmatics/wintc/wsetupx/bgsteps.png');
background-repeat: no-repeat;
padding: 0px 50px
}
.setup-steps > grid
{
margin-top: 20px;
}
grid > *
{
margin-top: 10px
}
grid > label
{
font-weight: bold;
}
.setup-main
{
background: url('resource:///uk/oddmatics/wintc/wsetupx/bgmain.png');
background-position: bottom right;
background-repeat: no-repeat;
}
.promo,
.blurb
{
font-family: 'Arial';
margin-top: 20px;
margin-left: 50px;
}
.promo
{
font-size: 18pt;
font-weight: bold;
text-shadow: 2px 2px 0px #00256D;
}
.blurb
{
font-size: 10pt;
}
.setup-bottom
{
background: #08339B;
border-top: 2px solid #000;
border-image: url('resource:///uk/oddmatics/wintc/wsetupx/borderb.png') 2 0 0 0;
}

View File

@@ -0,0 +1,323 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkBox" id="main-box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="resource">/uk/oddmatics/wintc/wsetupx/logo.png</property>
<property name="halign">GTK_ALIGN_START</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<style>
<class name="setup-top" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="resource">/uk/oddmatics/wintc/wsetupx/bullnull.png</property>
<property name="valign">GTK_ALIGN_START</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Collecting information</property>
<property name="max-width-chars">10</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="resource">/uk/oddmatics/wintc/wsetupx/bullnull.png</property>
<property name="valign">GTK_ALIGN_START</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Dynamic Update</property>
<property name="max-width-chars">10</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="resource">/uk/oddmatics/wintc/wsetupx/bullnull.png</property>
<property name="valign">GTK_ALIGN_START</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Preparing installation</property>
<property name="max-width-chars">10</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="resource">/uk/oddmatics/wintc/wsetupx/bullnull.png</property>
<property name="valign">GTK_ALIGN_START</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Installing Windows</property>
<property name="max-width-chars">10</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="resource">/uk/oddmatics/wintc/wsetupx/bullnull.png</property>
<property name="valign">GTK_ALIGN_START</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Finalizing installation</property>
<property name="max-width-chars">10</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Setup will complete in</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<style>
<class name="setup-steps" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Welcome to WinTC Release Preview</property>
<property name="max-width-chars">32</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<style>
<class name="promo" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Thanks for installing and trying out Windows Total Conversion Release Preview! It has been a long road to reach this first test release, and there's still plenty left to do.
Please report any bugs, feedback, or technical contributions you may have as this would be beneficial to improving the project.</property>
<property name="max-width-chars">48</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<style>
<class name="blurb" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="setup-billboards" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="setup-main" />
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label">Temp.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<style>
<class name="setup-bottom" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<style>
<class name="setup-wnd" />
</style>
</object>
</interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

View File

@@ -0,0 +1,91 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/comgtk.h>
#include <wintc/shelldpa.h>
#include <wintc/shlang.h>
#include "setupwnd.h"
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCSetupWindowClass
{
WinTCDpaDesktopWindowClass __parent__;
};
struct _WinTCSetupWindow
{
WinTCDpaDesktopWindow __parent__;
};
//
// GTK TYPE DEFINITION & CTORS
//
G_DEFINE_TYPE(
WinTCSetupWindow,
wintc_setup_window,
WINTC_TYPE_DPA_DESKTOP_WINDOW
)
static void wintc_setup_window_class_init(
WINTC_UNUSED(WinTCSetupWindowClass* klass)
) {}
static void wintc_setup_window_init(
WinTCSetupWindow* self
)
{
GtkBuilder* builder =
gtk_builder_new_from_resource(
"/uk/oddmatics/wintc/wsetupx/setupwnd.ui"
);
wintc_lc_builder_preprocess_widget_text(builder);
gtk_container_add(
GTK_CONTAINER(self),
GTK_WIDGET(
gtk_builder_get_object(builder, "main-box")
)
);
// Add the style context
//
GtkCssProvider* css = gtk_css_provider_new();
GtkStyleContext* ctx = gtk_widget_get_style_context(
GTK_WIDGET(self)
);
gtk_css_provider_load_from_resource(
css,
"/uk/oddmatics/wintc/wsetupx/setupwnd.css"
);
gtk_style_context_add_provider(
ctx,
GTK_STYLE_PROVIDER(css),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
);
}
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_setup_window_new(void)
{
GdkMonitor* monitor =
gdk_display_get_primary_monitor(
gdk_screen_get_display(
gdk_screen_get_default()
)
);
return GTK_WIDGET(
g_object_new(
WINTC_TYPE_SETUP_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"monitor", monitor,
NULL
)
);
}

View File

@@ -0,0 +1,27 @@
#ifndef __SETUPWND_H__
#define __SETUPWND_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// GTK OOP BOILERPLATE
//
typedef struct _WinTCSetupWindowClass WinTCSetupWindowClass;
typedef struct _WinTCSetupWindow WinTCSetupWindow;
#define WINTC_TYPE_SETUP_WINDOW (wintc_setup_window_get_type())
#define WINTC_SETUP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WINTC_TYPE_SETUP_WINDOW, WinTCSetupWindow))
#define WINTC_SETUP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WINTC_TYPE_SETUP_WINDOW, WinTCSetupWindow))
#define IS_WINTC_SETUP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WINTC_TYPE_SETUP_WINDOW))
#define IS_WINTC_SETUP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WINTC_TYPE_SETUP_WINDOW))
#define WINTC_SETUP_WINDOW_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), WINTC_TYPE_SETUP_WINDOW))
GType wintc_setup_window_get_type(void) G_GNUC_CONST;
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_setup_window_new();
#endif

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env sh
# Must start a DBus session
#
eval `dbus-launch`
export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID
# Launch setup
#
xfwm4 --replace --compositor=on &
wsetupx