mirror of
https://github.com/rozniak/xfce-winxp-tc.git
synced 2026-05-01 03:31:33 +00:00
Enhancement: Fixes #183, Replace xfce4-panel with our own taskbar implementation
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "submodules/xfce-winxp-tc-panel"]
|
||||
path = submodules/xfce-winxp-tc-panel
|
||||
url = https://github.com/rozniak/xfce-winxp-tc-panel
|
||||
@@ -4,9 +4,14 @@ set(REPO_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../..)
|
||||
|
||||
# Define some constants used by builds
|
||||
#
|
||||
set(WINTC_COMPILE_OPTIONS -Wall -Wextra -Wpedantic -Werror -Wno-overlength-strings)
|
||||
set(WINTC_ASSETS_INSTALL_DIR share/wintc)
|
||||
|
||||
if (DEFINED WINTC_NO_PEDANTIC_COMPILE)
|
||||
set(WINTC_COMPILE_OPTIONS -Wall -Wextra -Werror -Wno-overlength-strings)
|
||||
else()
|
||||
set(WINTC_COMPILE_OPTIONS -Wall -Wextra -Wpedantic -Werror -Wno-overlength-strings)
|
||||
endif()
|
||||
|
||||
# Handle SKU stuff
|
||||
#
|
||||
set(
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(
|
||||
libwintc-startmenu-plugin
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Windows Total Conversion Start menu xfce-panel plugin."
|
||||
)
|
||||
|
||||
set(PROJECT_ANYARCH false)
|
||||
set(PROJECT_FREESTATUS true)
|
||||
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
|
||||
|
||||
set(
|
||||
PROJECT_DEPENDENCIES
|
||||
libgarcon-1-0
|
||||
libgarcon-gtk3-1-0
|
||||
libglib2.0-0
|
||||
libgtk-3-0
|
||||
libwintc-comgtk
|
||||
libwintc-exec
|
||||
libwintc-shllang
|
||||
libxfce4panel-2.0-4
|
||||
libxfce4util7
|
||||
xdg-utils
|
||||
)
|
||||
|
||||
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(../../packaging/cmake-inc/common/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/libraries/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/locale/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/resources/CMakeLists.txt)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(GARCON REQUIRED garcon-1)
|
||||
pkg_check_modules(GARCON_GTK3 REQUIRED garcon-gtk3-1)
|
||||
pkg_check_modules(GDK REQUIRED gdk-3.0)
|
||||
pkg_check_modules(GIO REQUIRED gio-2.0)
|
||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
|
||||
pkg_check_modules(WINTC_EXEC REQUIRED wintc-exec)
|
||||
pkg_check_modules(WINTC_SHLLANG REQUIRED wintc-shllang)
|
||||
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
|
||||
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
|
||||
|
||||
wintc_compile_resources()
|
||||
wintc_create_config_h()
|
||||
|
||||
# Main target
|
||||
#
|
||||
add_library(
|
||||
libwintc-startmenu-plugin MODULE
|
||||
src/action.h
|
||||
src/action.c
|
||||
src/config.h
|
||||
src/placeslist.h
|
||||
src/placeslist.c
|
||||
src/plugin.h
|
||||
src/plugin.c
|
||||
src/programslist.h
|
||||
src/programslist.c
|
||||
src/resources.c
|
||||
src/startbutton.h
|
||||
src/startbutton.c
|
||||
src/startmenu.h
|
||||
src/startmenu.c
|
||||
src/startmenuitem.h
|
||||
src/startmenuitem.c
|
||||
src/util.h
|
||||
src/util.c
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
libwintc-startmenu-plugin
|
||||
PRIVATE ${WINTC_COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
libwintc-startmenu-plugin
|
||||
SYSTEM
|
||||
PRIVATE ${GARCON_INCLUDE_DIRS}
|
||||
PRIVATE ${GARCON_GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${GDK_INCLUDE_DIRS}
|
||||
PRIVATE ${GIO_INCLUDE_DIRS}
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_EXEC_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_SHLLANG_INCLUDE_DIRS}
|
||||
PRIVATE ${XFCE4PANEL_INCLUDE_DIRS}
|
||||
PRIVATE ${XFCE4UTIL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_directories(
|
||||
libwintc-startmenu-plugin
|
||||
PRIVATE ${GARCON_LIBRARY_DIRS}
|
||||
PRIVATE ${GARCON_GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${GDK_LIBRARY_DIRS}
|
||||
PRIVATE ${GIO_LIBRARY_DIRS}
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_EXEC_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_SHLLANG_LIBRARY_DIRS}
|
||||
PRIVATE ${XFCE4PANEL_LIBRARY_DIRS}
|
||||
PRIVATE ${XFCE4UTIL_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
libwintc-startmenu-plugin
|
||||
PRIVATE ${GARCON_LIBRARIES}
|
||||
PRIVATE ${GARCON_GTK3_LIBRARIES}
|
||||
PRIVATE ${GDK_LIBRARIES}
|
||||
PRIVATE ${GIO_LIBRARIES}
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${WINTC_EXEC_LIBRARIES}
|
||||
PRIVATE ${WINTC_SHLLANG_LIBRARIES}
|
||||
PRIVATE ${XFCE4PANEL_LIBRARIES}
|
||||
PRIVATE ${XFCE4UTIL_LIBRARIES})
|
||||
|
||||
add_dependencies(
|
||||
libwintc-startmenu-plugin
|
||||
build-gresources
|
||||
)
|
||||
|
||||
# Installation
|
||||
#
|
||||
wintc_configure_and_install_packaging()
|
||||
wintc_compile_and_install_pofiles()
|
||||
|
||||
install(
|
||||
DIRECTORY res/
|
||||
DESTINATION ${WINTC_ASSETS_INSTALL_DIR}/shell-res
|
||||
)
|
||||
install(
|
||||
FILES startmenu.desktop
|
||||
DESTINATION share/xfce4/panel/plugins
|
||||
)
|
||||
install(
|
||||
TARGETS libwintc-startmenu-plugin
|
||||
DESTINATION ${LIB_DIR}/xfce4/panel/plugins
|
||||
)
|
||||
@@ -1,7 +0,0 @@
|
||||
# libstartmenu-plugin
|
||||
This directory contains the source code for the Start menu XFCE panel plugin.
|
||||
|
||||

|
||||
|
||||
## Keyboard Shortcut
|
||||
At the moment there is no ability to open the Start menu with the `super`/`Win` key - there is an issue open for this however: [#86](https://github.com/rozniak/xfce-winxp-tc/issues/86)
|
||||
@@ -1,108 +0,0 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/libxfce4panel.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "plugin.h"
|
||||
#include "startbutton.h"
|
||||
#include "startmenu.h"
|
||||
#include "util.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _StartPluginClass
|
||||
{
|
||||
XfcePanelPluginClass __parent__;
|
||||
};
|
||||
|
||||
struct _StartPlugin
|
||||
{
|
||||
XfcePanelPlugin __parent__;
|
||||
|
||||
GtkWidget* start_button;
|
||||
GtkWidget* start_menu;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void start_plugin_construct(
|
||||
XfcePanelPlugin* plugin
|
||||
);
|
||||
static void start_plugin_free_data(
|
||||
XfcePanelPlugin* plugin
|
||||
);
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
XFCE_PANEL_DEFINE_PLUGIN(StartPlugin, start_plugin)
|
||||
|
||||
static void start_plugin_class_init(
|
||||
StartPluginClass* klass
|
||||
)
|
||||
{
|
||||
XfcePanelPluginClass* plugin_class;
|
||||
|
||||
plugin_class = XFCE_PANEL_PLUGIN_CLASS(klass);
|
||||
|
||||
plugin_class->construct = start_plugin_construct;
|
||||
plugin_class->free_data = start_plugin_free_data;
|
||||
}
|
||||
|
||||
static void start_plugin_init(
|
||||
WINTC_UNUSED(StartPlugin* start_plugin)
|
||||
) {}
|
||||
|
||||
static void start_plugin_construct(
|
||||
XfcePanelPlugin* plugin
|
||||
)
|
||||
{
|
||||
StartPlugin* start = START_PLUGIN(plugin);
|
||||
GtkCssProvider* styles = gtk_css_provider_new();
|
||||
|
||||
// Load global stylesheet
|
||||
//
|
||||
gtk_css_provider_load_from_resource(
|
||||
styles,
|
||||
"/uk/oddmatics/wintc/xp-start/appstyles.css"
|
||||
);
|
||||
|
||||
gtk_style_context_add_provider_for_screen(
|
||||
gdk_screen_get_default(),
|
||||
GTK_STYLE_PROVIDER(styles),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
|
||||
);
|
||||
|
||||
// Set up plugin widgets
|
||||
//
|
||||
start->start_button = GTK_WIDGET(g_object_new(TYPE_START_BUTTON, NULL));
|
||||
start->start_menu = GTK_WIDGET(g_object_new(TYPE_START_MENU, NULL));
|
||||
|
||||
start_button_attach_menu(
|
||||
START_BUTTON(start->start_button),
|
||||
START_MENU(start->start_menu)
|
||||
);
|
||||
start_button_attach_plugin(
|
||||
START_BUTTON(start->start_button),
|
||||
start
|
||||
);
|
||||
|
||||
wintc_widget_add_style_class(GTK_WIDGET(plugin), "xp-start-plugin");
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(plugin), start->start_button);
|
||||
gtk_widget_show_all(start->start_button);
|
||||
}
|
||||
|
||||
//
|
||||
// FINALIZE
|
||||
//
|
||||
static void start_plugin_free_data(
|
||||
XfcePanelPlugin* plugin
|
||||
)
|
||||
{
|
||||
StartPlugin* start = START_PLUGIN(plugin);
|
||||
|
||||
gtk_widget_destroy(start->start_menu);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef __PLUGIN_H__
|
||||
#define __PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/libxfce4panel.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _StartPluginClass StartPluginClass;
|
||||
typedef struct _StartPlugin StartPlugin;
|
||||
|
||||
#define TYPE_START_PLUGIN (start_plugin_get_type())
|
||||
#define START_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_START_PLUGIN, StartPlugin))
|
||||
#define START_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_START_PLUGIN, StartPluginClass))
|
||||
#define IS_START_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_START_PLUGIN))
|
||||
#define IS_START_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_START_PLUGIN))
|
||||
#define START_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_START_PLUGIN, StartPluginClass))
|
||||
|
||||
GType start_plugin_get_type(void) G_GNUC_CONST;
|
||||
|
||||
void start_plugin_register_type(XfcePanelTypeModule* type_module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/uk/oddmatics/wintc/xp-start">
|
||||
<file>appstyles.css</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef __STARTMENU_H__
|
||||
#define __STARTMENU_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/xfce-panel-plugin.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _StartMenuPrivate StartMenuPrivate;
|
||||
typedef struct _StartMenuClass StartMenuClass;
|
||||
typedef struct _StartMenu StartMenu;
|
||||
|
||||
#define TYPE_START_MENU (start_menu_get_type())
|
||||
#define START_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_START_MENU, StartMenu))
|
||||
#define START_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_START_MENU, StartMenuClass))
|
||||
#define IS_START_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_START_MENU))
|
||||
#define IS_START_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_START_MENU))
|
||||
#define START_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_START_MENU, StartMenuClass))
|
||||
|
||||
GType start_menu_get_type(void) G_GNUC_CONST;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
void start_menu_get_popup_position(
|
||||
GtkWidget* menu,
|
||||
XfcePanelPlugin* plugin,
|
||||
GtkWidget* widget,
|
||||
gint* x,
|
||||
gint* y
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
[Xfce Panel]
|
||||
Type=X-XFCE-PanelPlugin
|
||||
Encoding=UTF-8
|
||||
Name=Start button
|
||||
Comment=Windows XP Start menu
|
||||
Icon=start-logo
|
||||
X-XFCE-Module=wintc-startmenu-plugin
|
||||
X-XFCE-Internal=false
|
||||
X-XFCE-API=2.0
|
||||
@@ -1,98 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(
|
||||
libwintc-xpsystray-plugin
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Windows Total Conversion notification area xfce-panel plugin."
|
||||
)
|
||||
|
||||
set(PROJECT_ANYARCH false)
|
||||
set(PROJECT_FREESTATUS true)
|
||||
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
|
||||
|
||||
set(
|
||||
PROJECT_DEPENDENCIES
|
||||
libglib2.0-0
|
||||
libgtk-3-0
|
||||
libwintc-comgtk
|
||||
libxfce4panel-2.0-4
|
||||
libxfce4util7
|
||||
)
|
||||
|
||||
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(../../packaging/cmake-inc/common/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/libraries/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(GDK REQUIRED gdk-3.0)
|
||||
pkg_check_modules(GIO REQUIRED gio-2.0)
|
||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
|
||||
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
|
||||
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
|
||||
|
||||
add_library(
|
||||
libwintc-xpsystray-plugin MODULE
|
||||
src/clock.h
|
||||
src/clock.c
|
||||
src/plugin.h
|
||||
src/plugin.c
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
libwintc-xpsystray-plugin
|
||||
PRIVATE ${WINTC_COMPILE_OTPIONS}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
libwintc-xpsystray-plugin
|
||||
SYSTEM
|
||||
PRIVATE ${GDK_INCLUDE_DIRS}
|
||||
PRIVATE ${GIO_INCLUDE_DIRS}
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${XFCE4PANEL_INCLUDE_DIRS}
|
||||
PRIVATE ${XFCE4UTIL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_directories(
|
||||
libwintc-xpsystray-plugin
|
||||
PRIVATE ${GDK_LIBRARY_DIRS}
|
||||
PRIVATE ${GIO_LIBRARY_DIRS}
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${XFCE4PANEL_LIBRARY_DIRS}
|
||||
PRIVATE ${XFCE4UTIL_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
libwintc-xpsystray-plugin
|
||||
PRIVATE ${GDK_LIBRARIES}
|
||||
PRIVATE ${GIO_LIBRARIES}
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${XFCE4PANEL_LIBRARIES}
|
||||
PRIVATE ${XFCE4UTIL_LIBRARIES}
|
||||
)
|
||||
|
||||
# Installation
|
||||
#
|
||||
wintc_configure_and_install_packaging()
|
||||
|
||||
install(
|
||||
FILES xpsystray.desktop
|
||||
DESTINATION share/xfce4/panel/plugins
|
||||
)
|
||||
install(
|
||||
TARGETS libwintc-xpsystray-plugin
|
||||
DESTINATION ${LIB_DIR}/xfce4/panel/plugins
|
||||
)
|
||||
@@ -1,4 +0,0 @@
|
||||
# libxpsystray-plugin
|
||||
This directory contains the source code for the Notification Area XFCE panel plugin.
|
||||
|
||||

|
||||
@@ -1,74 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/libxfce4panel.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "plugin.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _SystrayPluginClass
|
||||
{
|
||||
XfcePanelPluginClass __parent__;
|
||||
};
|
||||
|
||||
struct _SystrayPlugin
|
||||
{
|
||||
XfcePanelPlugin __parent__;
|
||||
|
||||
GtkWidget* box;
|
||||
GtkWidget* clock;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void systray_plugin_construct(
|
||||
XfcePanelPlugin* plugin
|
||||
);
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
XFCE_PANEL_DEFINE_PLUGIN(SystrayPlugin, systray_plugin)
|
||||
|
||||
static void systray_plugin_class_init(
|
||||
SystrayPluginClass* klass
|
||||
)
|
||||
{
|
||||
XfcePanelPluginClass* plugin_class;
|
||||
|
||||
plugin_class = XFCE_PANEL_PLUGIN_CLASS(klass);
|
||||
|
||||
plugin_class->construct = systray_plugin_construct;
|
||||
}
|
||||
|
||||
static void systray_plugin_init(
|
||||
WINTC_UNUSED(SystrayPlugin* systray_plugin)
|
||||
) {}
|
||||
|
||||
static void systray_plugin_construct(
|
||||
XfcePanelPlugin* plugin
|
||||
)
|
||||
{
|
||||
SystrayPlugin* systray = SYSTRAY_PLUGIN(plugin);
|
||||
|
||||
systray->box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
systray->clock = GTK_WIDGET(g_object_new(TYPE_TRAY_CLOCK, NULL));
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(plugin), systray->box);
|
||||
gtk_container_add(GTK_CONTAINER(systray->box), systray->clock);
|
||||
|
||||
// Attach systray styles
|
||||
//
|
||||
GtkStyleContext* tray_styles = gtk_widget_get_style_context(systray->box);
|
||||
|
||||
gtk_style_context_add_class(tray_styles, "xp-systray");
|
||||
|
||||
// Show all now
|
||||
//
|
||||
gtk_widget_show_all(GTK_WIDGET(systray));
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef __PLUGIN_H__
|
||||
#define __PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/libxfce4panel.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _SystrayPluginClass SystrayPluginClass;
|
||||
typedef struct _SystrayPlugin SystrayPlugin;
|
||||
|
||||
#define TYPE_SYSTRAY_PLUGIN (systray_plugin_get_type())
|
||||
#define SYSTRAY_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_SYSTRAY_PLUGIN, SystrayPlugin))
|
||||
#define SYSTRAY_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_SYSTRAY_PLUGIN, SystrayPluginClass))
|
||||
#define IS_SYSTRAY_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_SYSTRAY_PLUGIN))
|
||||
#define IS_SYSTRAY_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_SYSTRAY_PLUGIN))
|
||||
#define SYSTRAY_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_SYSTRAY_PLUGIN, SystrayPluginClass))
|
||||
|
||||
GType systray_plugin_get_type(void) G_GNUC_CONST;
|
||||
|
||||
void systray_plugin_register_type(
|
||||
XfcePanelTypeModule* type_module
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
[Xfce Panel]
|
||||
Type=X-XFCE-PanelPlugin
|
||||
Encoding=UTF-8
|
||||
Name=Notification Area
|
||||
Comment=Windows XP notification area
|
||||
Icon=start-logo
|
||||
X-XFCE-Module=wintc-xpsystray-plugin
|
||||
X-XFCE-Internal=false
|
||||
X-XFCE-API=2.0
|
||||
159
shell/taskband/CMakeLists.txt
Normal file
159
shell/taskband/CMakeLists.txt
Normal file
@@ -0,0 +1,159 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(
|
||||
wintc-taskband
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Windows Total Conversion taskband application"
|
||||
)
|
||||
|
||||
set(PROJECT_ANYARCH false)
|
||||
set(PROJECT_FREESTATUS true)
|
||||
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
|
||||
|
||||
set(
|
||||
PROJECT_DEPENDENCIES
|
||||
libgarcon-1-0
|
||||
libgarcon-gtk3-1-0
|
||||
libgdk-pixbuf-2.0-0
|
||||
libglib2.0-0
|
||||
libgtk-3-0
|
||||
libwintc-comgtk
|
||||
libwintc-exec
|
||||
libwintc-shllang
|
||||
xdg-utils
|
||||
)
|
||||
|
||||
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
set(WINTC_NO_PEDANTIC_COMPILE true) # Necessary because we use dlsym()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(../../packaging/cmake-inc/common/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/locale/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/resources/CMakeLists.txt)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(GARCON REQUIRED garcon-1)
|
||||
pkg_check_modules(GARCON_GTK3 REQUIRED garcon-gtk3-1)
|
||||
pkg_check_modules(GDK REQUIRED gdk-3.0)
|
||||
pkg_check_modules(GDK_PIXBUF REQUIRED gdk-pixbuf-2.0)
|
||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
|
||||
pkg_check_modules(WINTC_EXEC REQUIRED wintc-exec)
|
||||
pkg_check_modules(WINTC_SHLLANG REQUIRED wintc-shllang)
|
||||
|
||||
wintc_compile_resources()
|
||||
wintc_create_meta_h()
|
||||
|
||||
add_executable(
|
||||
wintc-taskband
|
||||
src/application.c
|
||||
src/application.h
|
||||
src/dispproto.c
|
||||
src/dispproto.h
|
||||
src/dispproto-wayland.c
|
||||
src/dispproto-wayland.h
|
||||
src/dispproto-x11.c
|
||||
src/dispproto-x11.h
|
||||
src/dispproto-wndmgmt-wnck.c
|
||||
src/dispproto-wndmgmt-wnck.h
|
||||
src/dispproto-wndmgmt-xfw.c
|
||||
src/dispproto-wndmgmt-xfw.h
|
||||
src/main.c
|
||||
src/meta.h
|
||||
src/resources.c
|
||||
src/window.c
|
||||
src/window.h
|
||||
src/start/action.c
|
||||
src/start/action.h
|
||||
src/start/placeslist.c
|
||||
src/start/placeslist.h
|
||||
src/start/programslist.c
|
||||
src/start/programslist.h
|
||||
src/start/startbutton.c
|
||||
src/start/startbutton.h
|
||||
src/start/startmenu.c
|
||||
src/start/startmenu.h
|
||||
src/start/startmenuitem.c
|
||||
src/start/startmenuitem.h
|
||||
src/start/util.c
|
||||
src/start/util.h
|
||||
src/systray/clock.c
|
||||
src/systray/clock.h
|
||||
src/systray/notifarea.c
|
||||
src/systray/notifarea.h
|
||||
src/taskbuttons/taskbuttonbar.c
|
||||
src/taskbuttons/taskbuttonbar.h
|
||||
src/taskbuttons/windowmonitor.c
|
||||
src/taskbuttons/windowmonitor.h
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
wintc-taskband
|
||||
PRIVATE ${WINTC_COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
wintc-taskband
|
||||
SYSTEM
|
||||
PRIVATE ${GARCON_INCLUDE_DIRS}
|
||||
PRIVATE ${GARCON_GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${GDK_INCLUDE_DIRS}
|
||||
PRIVATE ${GDK_PIXBUF_INCLUDE_DIRS}
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_EXEC_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_SHLLANG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_directories(
|
||||
wintc-taskband
|
||||
PRIVATE ${GARCON_LIBRARY_DIRS}
|
||||
PRIVATE ${GARCON_GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${GDK_LIBRARY_DIRS}
|
||||
PRIVATE ${GDK_PIXBUF_LIBRARY_DIRS}
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_EXEC_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_SHLLANG_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
wintc-taskband
|
||||
PRIVATE ${CMAKE_DL_LIBS}
|
||||
PRIVATE ${GARCON_LIBRARIES}
|
||||
PRIVATE ${GARCON_GTK3_LIBRARIES}
|
||||
PRIVATE ${GDK_LIBRARIES}
|
||||
PRIVATE ${GDK_PIXBUF_LIBRARIES}
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${WINTC_EXEC_LIBRARIES}
|
||||
PRIVATE ${WINTC_SHLLANG_LIBRARIES}
|
||||
)
|
||||
|
||||
add_dependencies(
|
||||
wintc-taskband
|
||||
build-gresources
|
||||
)
|
||||
|
||||
# Installation
|
||||
#
|
||||
wintc_configure_and_install_packaging()
|
||||
wintc_compile_and_install_pofiles()
|
||||
|
||||
install(
|
||||
DIRECTORY res/
|
||||
DESTINATION ${WINTC_ASSETS_INSTALL_DIR}/shell-res
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS wintc-taskband
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
7
shell/taskband/README.MD
Normal file
7
shell/taskband/README.MD
Normal file
@@ -0,0 +1,7 @@
|
||||
# wintc-taskband
|
||||
This directory contains the source code for the taskband.
|
||||
|
||||

|
||||
|
||||
## Keyboard Shortcut
|
||||
At the moment there is no ability to open the Start menu with the `super`/`Win` key - there is an issue open for this however: [#86](https://github.com/rozniak/xfce-winxp-tc/issues/86)
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
112
shell/taskband/src/application.c
Normal file
112
shell/taskband/src/application.c
Normal file
@@ -0,0 +1,112 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "dispproto.h"
|
||||
#include "window.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _WinTCTaskbandApplicationClass
|
||||
{
|
||||
GtkApplicationClass __parent__;
|
||||
};
|
||||
|
||||
struct _WinTCTaskbandApplication
|
||||
{
|
||||
GtkApplication __parent__;
|
||||
|
||||
GtkWidget* host_window;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void wintc_taskband_application_activate(
|
||||
GApplication* application
|
||||
);
|
||||
static void wintc_taskband_application_startup(
|
||||
GApplication* application
|
||||
);
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
G_DEFINE_TYPE(
|
||||
WinTCTaskbandApplication,
|
||||
wintc_taskband_application,
|
||||
GTK_TYPE_APPLICATION
|
||||
)
|
||||
|
||||
static void wintc_taskband_application_class_init(
|
||||
WinTCTaskbandApplicationClass* klass
|
||||
)
|
||||
{
|
||||
GApplicationClass* application_class = G_APPLICATION_CLASS(klass);
|
||||
|
||||
application_class->activate = wintc_taskband_application_activate;
|
||||
application_class->startup = wintc_taskband_application_startup;
|
||||
}
|
||||
|
||||
static void wintc_taskband_application_init(
|
||||
WINTC_UNUSED(WinTCTaskbandApplication* self)
|
||||
) {}
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
WinTCTaskbandApplication* wintc_taskband_application_new(void)
|
||||
{
|
||||
WinTCTaskbandApplication* app;
|
||||
|
||||
g_set_application_name("Taskband");
|
||||
|
||||
app =
|
||||
g_object_new(
|
||||
wintc_taskband_application_get_type(),
|
||||
"application-id", "uk.co.oddmatics.wintc.taskband",
|
||||
NULL
|
||||
);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
//
|
||||
// CALLBACKS
|
||||
//
|
||||
static void wintc_taskband_application_activate(
|
||||
GApplication* application
|
||||
)
|
||||
{
|
||||
WinTCTaskbandApplication* taskband_app =
|
||||
WINTC_TASKBAND_APPLICATION(application);
|
||||
|
||||
if (taskband_app->host_window != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
taskband_app->host_window = wintc_taskband_window_new(taskband_app);
|
||||
|
||||
gtk_widget_show_all(taskband_app->host_window);
|
||||
}
|
||||
|
||||
static void wintc_taskband_application_startup(
|
||||
GApplication* application
|
||||
)
|
||||
{
|
||||
// Chain up for gtk init
|
||||
//
|
||||
G_APPLICATION_CLASS(wintc_taskband_application_parent_class)
|
||||
->startup(application);
|
||||
|
||||
// Init APIs at runtime
|
||||
//
|
||||
if (!init_display_protocol_apis())
|
||||
{
|
||||
g_critical("%s", "Failed to resolve display protocol APIs.");
|
||||
g_application_quit(application);
|
||||
}
|
||||
}
|
||||
27
shell/taskband/src/application.h
Normal file
27
shell/taskband/src/application.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __APPLICATION_H__
|
||||
#define __APPLICATION_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _WinTCTaskbandApplicationClass WinTCTaskbandApplicationClass;
|
||||
typedef struct _WinTCTaskbandApplication WinTCTaskbandApplication;
|
||||
|
||||
#define TYPE_WINTC_TASKBAND_APPLICATION (wintc_taskband_application_get_type())
|
||||
#define WINTC_TASKBAND_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_TASKBAND_APPLICATION, WinTCTaskbandApplication))
|
||||
#define WINTC_TASKBAND_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_TASKBAND_APPLICATION, WinTCTaskbandApplicationClass))
|
||||
#define IS_WINTC_TASKBAND_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_TASKBAND_APPLICATION))
|
||||
#define IS_WINTC_TASKBAND_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_TASKBAND_APPLICATION))
|
||||
#define WINTC_TASKBAND_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_WINTC_TASKBAND_APPLICATION, WinTCTaskbandApplication))
|
||||
|
||||
GType wintc_taskband_application_get_type(void) G_GNUC_CONST;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
WinTCTaskbandApplication* wintc_taskband_application_new(void);
|
||||
|
||||
#endif
|
||||
116
shell/taskband/src/dispproto-wayland.c
Normal file
116
shell/taskband/src/dispproto-wayland.c
Normal file
@@ -0,0 +1,116 @@
|
||||
#include <dlfcn.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "dispproto.h"
|
||||
#include "dispproto-wayland.h"
|
||||
|
||||
//
|
||||
// PRIVATE ENUMS
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
GTK_LAYER_SHELL_EDGE_LEFT = 0,
|
||||
GTK_LAYER_SHELL_EDGE_RIGHT,
|
||||
GTK_LAYER_SHELL_EDGE_TOP,
|
||||
GTK_LAYER_SHELL_EDGE_BOTTOM,
|
||||
GTK_LAYER_SHELL_EDGE_ENTRY_NUMBER
|
||||
} GtkLayerShellEdge;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_LAYER_SHELL_LAYER_BACKGROUND = 0,
|
||||
GTK_LAYER_SHELL_LAYER_BOTTOM,
|
||||
GTK_LAYER_SHELL_LAYER_TOP,
|
||||
GTK_LAYER_SHELL_LAYER_OVERLAY,
|
||||
GTK_LAYER_SHELL_LAYER_ENTRY_NUMBER
|
||||
} GtkLayerShellLayer;
|
||||
|
||||
//
|
||||
// RESOLVED FUNCS
|
||||
//
|
||||
void (*p_gtk_layer_auto_exclusive_zone_enable) (
|
||||
GtkWindow* window
|
||||
);
|
||||
void (*p_gtk_layer_init_for_window) (
|
||||
GtkWindow* window
|
||||
);
|
||||
void (*p_gtk_layer_set_anchor) (
|
||||
GtkWindow* window,
|
||||
GtkLayerShellEdge edge,
|
||||
gboolean anchor_to_edge
|
||||
);
|
||||
void (*p_gtk_layer_set_layer) (
|
||||
GtkWindow* window,
|
||||
GtkLayerShellLayer layer
|
||||
);
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void wayland_anchor_taskband_to_bottom(
|
||||
GtkWindow* taskband
|
||||
);
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_wayland_protocol_impl(void)
|
||||
{
|
||||
void* dl_gtk_layer_shell =
|
||||
dlopen("libgtk-layer-shell.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
|
||||
if (dl_gtk_layer_shell == NULL)
|
||||
{
|
||||
g_critical("%s", "Failed to open libgtk-layer-shell for symbols.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Resolve funcs we're using
|
||||
//
|
||||
p_gtk_layer_auto_exclusive_zone_enable =
|
||||
dlsym(dl_gtk_layer_shell, "gtk_layer_auto_exclusive_zone_enable");
|
||||
p_gtk_layer_init_for_window =
|
||||
dlsym(dl_gtk_layer_shell, "gtk_layer_init_for_window");
|
||||
p_gtk_layer_set_anchor =
|
||||
dlsym(dl_gtk_layer_shell, "gtk_layer_set_anchor");
|
||||
p_gtk_layer_set_layer =
|
||||
dlsym(dl_gtk_layer_shell, "gtk_layer_set_layer");
|
||||
|
||||
if (
|
||||
p_gtk_layer_auto_exclusive_zone_enable == NULL ||
|
||||
p_gtk_layer_init_for_window == NULL ||
|
||||
p_gtk_layer_set_anchor == NULL ||
|
||||
p_gtk_layer_set_layer == NULL
|
||||
)
|
||||
{
|
||||
g_critical("%s", "Failed to resolve symbols for GTK layer shell.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// All good, assign the API now
|
||||
//
|
||||
anchor_taskband_to_bottom = &wayland_anchor_taskband_to_bottom;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// PRIVATE FUNCTIONS
|
||||
//
|
||||
static void wayland_anchor_taskband_to_bottom(
|
||||
GtkWindow* taskband
|
||||
)
|
||||
{
|
||||
static gboolean anchors[] = { TRUE, TRUE, FALSE, TRUE };
|
||||
|
||||
p_gtk_layer_init_for_window(taskband);
|
||||
p_gtk_layer_set_layer(taskband, GTK_LAYER_SHELL_LAYER_BOTTOM);
|
||||
p_gtk_layer_auto_exclusive_zone_enable(taskband);
|
||||
|
||||
for (int i = 0; i < GTK_LAYER_SHELL_EDGE_ENTRY_NUMBER; i++)
|
||||
{
|
||||
p_gtk_layer_set_anchor(taskband, i, anchors[i]);
|
||||
}
|
||||
}
|
||||
11
shell/taskband/src/dispproto-wayland.h
Normal file
11
shell/taskband/src/dispproto-wayland.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __DISPPROTO_WAYLAND_H__
|
||||
#define __DISPPROTO_WAYLAND_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_wayland_protocol_impl(void);
|
||||
|
||||
#endif
|
||||
117
shell/taskband/src/dispproto-wndmgmt-wnck.c
Normal file
117
shell/taskband/src/dispproto-wndmgmt-wnck.c
Normal file
@@ -0,0 +1,117 @@
|
||||
#include <dlfcn.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "dispproto.h"
|
||||
#include "dispproto-wndmgmt-wnck.h"
|
||||
|
||||
//
|
||||
// RESOLVED FUNCS
|
||||
//
|
||||
static WndMgmtWindow* (*p_wnck_screen_get_active_window) (
|
||||
WndMgmtScreen* screen
|
||||
) = NULL;
|
||||
static WndMgmtScreen* (*p_wnck_screen_get_default) (void) = NULL;
|
||||
|
||||
static GdkPixbuf* (*p_wnck_window_get_mini_icon) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
static gchar* (*p_wnck_window_get_name) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
static gboolean (*p_wnck_window_is_skip_tasklist) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
static void (*p_wnck_window_minimize) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
static void (*p_wnck_window_unminimize) (
|
||||
WndMgmtWindow* window,
|
||||
guint32 timestamp
|
||||
) = NULL;
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void wnck_window_unminimize_now(
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_wndmgmt_wnck_impl(void)
|
||||
{
|
||||
void* dl_wnck = dlopen("libwnck-3.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
|
||||
if (dl_wnck == NULL)
|
||||
{
|
||||
g_message("%s", "libwnck not available.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Attempt to load the necessary functions
|
||||
//
|
||||
p_wnck_screen_get_active_window =
|
||||
dlsym(dl_wnck, "wnck_screen_get_active_window");
|
||||
|
||||
p_wnck_screen_get_default =
|
||||
dlsym(dl_wnck, "wnck_screen_get_default");
|
||||
|
||||
p_wnck_window_get_mini_icon =
|
||||
dlsym(dl_wnck, "wnck_window_get_mini_icon");
|
||||
|
||||
p_wnck_window_get_name =
|
||||
dlsym(dl_wnck, "wnck_window_get_name");
|
||||
|
||||
p_wnck_window_is_skip_tasklist =
|
||||
dlsym(dl_wnck, "wnck_window_is_skip_tasklist");
|
||||
|
||||
p_wnck_window_minimize =
|
||||
dlsym(dl_wnck, "wnck_window_minimize");
|
||||
|
||||
p_wnck_window_unminimize =
|
||||
dlsym(dl_wnck, "wnck_window_unminimize");
|
||||
|
||||
// Check all symbols loaded
|
||||
//
|
||||
if (
|
||||
p_wnck_screen_get_active_window == NULL ||
|
||||
p_wnck_screen_get_default == NULL ||
|
||||
p_wnck_window_get_mini_icon == NULL ||
|
||||
p_wnck_window_get_name == NULL ||
|
||||
p_wnck_window_is_skip_tasklist == NULL ||
|
||||
p_wnck_window_minimize == NULL ||
|
||||
p_wnck_window_unminimize == NULL
|
||||
)
|
||||
{
|
||||
g_warning("%s", "libwnck loaded, but not all symbols.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// We're good, implement the API
|
||||
//
|
||||
wndmgmt_screen_get_active_window = p_wnck_screen_get_active_window;
|
||||
wndmgmt_screen_get_default = p_wnck_screen_get_default;
|
||||
wndmgmt_window_get_mini_icon = p_wnck_window_get_mini_icon;
|
||||
wndmgmt_window_get_name = p_wnck_window_get_name;
|
||||
wndmgmt_window_is_skip_tasklist = p_wnck_window_is_skip_tasklist;
|
||||
wndmgmt_window_minimize = p_wnck_window_minimize;
|
||||
wndmgmt_window_unminimize = &wnck_window_unminimize_now;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// PRIVATE FUNCTIONS
|
||||
//
|
||||
static void wnck_window_unminimize_now(
|
||||
WndMgmtWindow* window
|
||||
)
|
||||
{
|
||||
// FIXME: This throws a warning because we use 0 or GDK_CURRENT_TIME where
|
||||
// it expects an X11 timestamp - it works and I can't be bothered to
|
||||
// resolve this right now
|
||||
//
|
||||
p_wnck_window_unminimize(window, 0);
|
||||
}
|
||||
11
shell/taskband/src/dispproto-wndmgmt-wnck.h
Normal file
11
shell/taskband/src/dispproto-wndmgmt-wnck.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __DISPPROTO_WNDMGMT_WNCK_H__
|
||||
#define __DISPPROTO_WNDMGMT_WNCK_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_wndmgmt_wnck_impl(void);
|
||||
|
||||
#endif
|
||||
128
shell/taskband/src/dispproto-wndmgmt-xfw.c
Normal file
128
shell/taskband/src/dispproto-wndmgmt-xfw.c
Normal file
@@ -0,0 +1,128 @@
|
||||
#include <dlfcn.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "dispproto.h"
|
||||
#include "dispproto-wndmgmt-xfw.h"
|
||||
|
||||
//
|
||||
// RESOLVED FUNCS
|
||||
//
|
||||
static WndMgmtWindow* (*p_xfw_screen_get_active_window) (
|
||||
WndMgmtScreen* screen
|
||||
) = NULL;
|
||||
static WndMgmtScreen* (*p_xfw_screen_get_default) (void) = NULL;
|
||||
|
||||
static GdkPixbuf* (*p_xfw_window_get_icon) (
|
||||
WndMgmtWindow* window,
|
||||
gint size,
|
||||
gint scale
|
||||
) = NULL;
|
||||
static gchar* (*p_xfw_window_get_name) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
static gboolean (*p_xfw_window_is_skip_tasklist) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
static gboolean (*p_xfw_window_set_minimized) (
|
||||
WndMgmtWindow* window,
|
||||
gboolean is_maximized,
|
||||
GError** error
|
||||
) = NULL;
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static GdkPixbuf* xfw_window_get_mini_icon(
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
static void xfw_window_minimize(
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
static void xfw_window_unminimize(
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_wndmgmt_xfw_impl(void)
|
||||
{
|
||||
void* dl_xfw = dlopen("libxfce4windowing-0.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
|
||||
if (dl_xfw == NULL)
|
||||
{
|
||||
g_message("%s", "libxfce4windowing not available.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Attempt to load the necessary functions
|
||||
//
|
||||
p_xfw_screen_get_active_window =
|
||||
dlsym(dl_xfw, "xfw_screen_get_active_window");
|
||||
|
||||
p_xfw_screen_get_default =
|
||||
dlsym(dl_xfw, "xfw_screen_get_default");
|
||||
|
||||
p_xfw_window_get_icon =
|
||||
dlsym(dl_xfw, "xfw_window_get_icon");
|
||||
|
||||
p_xfw_window_get_name =
|
||||
dlsym(dl_xfw, "xfw_window_get_name");
|
||||
|
||||
p_xfw_window_is_skip_tasklist =
|
||||
dlsym(dl_xfw, "xfw_window_is_skip_tasklist");
|
||||
|
||||
p_xfw_window_set_minimized =
|
||||
dlsym(dl_xfw, "xfw_window_set_minimized");
|
||||
|
||||
// Check all symbols loaded
|
||||
//
|
||||
if (
|
||||
p_xfw_screen_get_active_window == NULL ||
|
||||
p_xfw_screen_get_default == NULL ||
|
||||
p_xfw_window_get_icon == NULL ||
|
||||
p_xfw_window_get_name == NULL ||
|
||||
p_xfw_window_is_skip_tasklist == NULL ||
|
||||
p_xfw_window_set_minimized == NULL
|
||||
)
|
||||
{
|
||||
g_warning("%s", "libxfce4windowing loaded, but not all symbols.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// We're good, implement the API
|
||||
//
|
||||
wndmgmt_screen_get_active_window = p_xfw_screen_get_active_window;
|
||||
wndmgmt_screen_get_default = p_xfw_screen_get_default;
|
||||
wndmgmt_window_get_mini_icon = &xfw_window_get_mini_icon;
|
||||
wndmgmt_window_get_name = p_xfw_window_get_name;
|
||||
wndmgmt_window_is_skip_tasklist = p_xfw_window_is_skip_tasklist;
|
||||
wndmgmt_window_minimize = &xfw_window_minimize;
|
||||
wndmgmt_window_unminimize = &xfw_window_unminimize;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// PRIVATE FUNCTIONS
|
||||
//
|
||||
static GdkPixbuf* xfw_window_get_mini_icon(
|
||||
WndMgmtWindow* window
|
||||
)
|
||||
{
|
||||
return p_xfw_window_get_icon(window, 16, 1);
|
||||
}
|
||||
|
||||
static void xfw_window_minimize(
|
||||
WndMgmtWindow* window
|
||||
)
|
||||
{
|
||||
p_xfw_window_set_minimized(window, TRUE, NULL);
|
||||
}
|
||||
|
||||
static void xfw_window_unminimize(
|
||||
WndMgmtWindow* window
|
||||
)
|
||||
{
|
||||
p_xfw_window_set_minimized(window, FALSE, NULL);
|
||||
}
|
||||
11
shell/taskband/src/dispproto-wndmgmt-xfw.h
Normal file
11
shell/taskband/src/dispproto-wndmgmt-xfw.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __DISPPROTO_WNDMGMT_XFW_H__
|
||||
#define __DISPPROTO_WNDMGMT_XFW_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_wndmgmt_xfw_impl(void);
|
||||
|
||||
#endif
|
||||
142
shell/taskband/src/dispproto-x11.c
Normal file
142
shell/taskband/src/dispproto-x11.c
Normal file
@@ -0,0 +1,142 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "dispproto.h"
|
||||
#include "dispproto-x11.h"
|
||||
#include "taskband.h"
|
||||
|
||||
//
|
||||
// STRUCTURE DEFINITIONS
|
||||
//
|
||||
struct X11Struts
|
||||
{
|
||||
gulong left;
|
||||
gulong right;
|
||||
gulong top;
|
||||
gulong bottom;
|
||||
|
||||
gulong left_start_y;
|
||||
gulong left_end_y;
|
||||
|
||||
gulong right_start_y;
|
||||
gulong right_end_y;
|
||||
|
||||
gulong top_start_x;
|
||||
gulong top_end_x;
|
||||
|
||||
gulong bottom_start_x;
|
||||
gulong bottom_end_x;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void x11_anchor_taskband_to_bottom(
|
||||
GtkWindow* taskband
|
||||
);
|
||||
|
||||
static void on_taskband_realized(
|
||||
GtkWidget* self,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_x11_protocol_impl(void)
|
||||
{
|
||||
anchor_taskband_to_bottom = &x11_anchor_taskband_to_bottom;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// PRIVATE FUNCTIONS
|
||||
//
|
||||
static void x11_anchor_taskband_to_bottom(
|
||||
GtkWindow* taskband
|
||||
)
|
||||
{
|
||||
g_signal_connect(
|
||||
taskband,
|
||||
"realize",
|
||||
G_CALLBACK(on_taskband_realized),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// CALLBACKS
|
||||
//
|
||||
static void on_taskband_realized(
|
||||
GtkWidget* self,
|
||||
WINTC_UNUSED(gpointer user_data)
|
||||
)
|
||||
{
|
||||
GdkAtom cardinal_atom;
|
||||
GdkDisplay* display = gdk_display_get_default();
|
||||
GdkRectangle geometry;
|
||||
GdkMonitor* monitor = NULL;
|
||||
int monitor_count = gdk_display_get_n_monitors(display);
|
||||
GdkAtom net_wm_strut_partial_atom;
|
||||
int screen_bottom = 0;
|
||||
|
||||
cardinal_atom =
|
||||
gdk_atom_intern_static_string("CARDINAL");
|
||||
net_wm_strut_partial_atom =
|
||||
gdk_atom_intern_static_string("_NET_WM_STRUT_PARTIAL");
|
||||
|
||||
struct X11Struts struts = { 0 };
|
||||
|
||||
for (int i = 0; i < monitor_count; i++)
|
||||
{
|
||||
int monitor_bottom = 0;
|
||||
GdkMonitor* monitor_i = gdk_display_get_monitor(display, i);
|
||||
|
||||
if (monitor == NULL || gdk_monitor_is_primary(monitor_i))
|
||||
{
|
||||
monitor = monitor_i;
|
||||
}
|
||||
|
||||
// Update screen bottom
|
||||
//
|
||||
gdk_monitor_get_geometry(monitor_i, &geometry);
|
||||
|
||||
monitor_bottom = geometry.y + geometry.height;
|
||||
|
||||
if (monitor_bottom > screen_bottom)
|
||||
{
|
||||
screen_bottom = monitor_bottom;
|
||||
}
|
||||
}
|
||||
|
||||
gdk_monitor_get_geometry(monitor, &geometry);
|
||||
|
||||
gtk_window_set_default_size(
|
||||
GTK_WINDOW(self),
|
||||
geometry.width,
|
||||
TASKBAND_ROW_HEIGHT
|
||||
);
|
||||
gtk_window_move(
|
||||
GTK_WINDOW(self),
|
||||
geometry.x,
|
||||
geometry.y + geometry.height - TASKBAND_ROW_HEIGHT
|
||||
);
|
||||
|
||||
struts.bottom =
|
||||
screen_bottom - (geometry.y + geometry.height) + TASKBAND_ROW_HEIGHT;
|
||||
struts.bottom_start_x = geometry.x;
|
||||
struts.bottom_end_x = geometry.x + geometry.width;
|
||||
|
||||
gdk_property_change(
|
||||
gtk_widget_get_window(self),
|
||||
net_wm_strut_partial_atom,
|
||||
cardinal_atom,
|
||||
32,
|
||||
GDK_PROP_MODE_REPLACE,
|
||||
(guchar*) &struts,
|
||||
sizeof (struct X11Struts) / sizeof (gulong)
|
||||
);
|
||||
}
|
||||
11
shell/taskband/src/dispproto-x11.h
Normal file
11
shell/taskband/src/dispproto-x11.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __DISPPROTO_X11_H__
|
||||
#define __DISPPROTO_X11_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
gboolean init_x11_protocol_impl(void);
|
||||
|
||||
#endif
|
||||
146
shell/taskband/src/dispproto.c
Normal file
146
shell/taskband/src/dispproto.c
Normal file
@@ -0,0 +1,146 @@
|
||||
#include <dlfcn.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "dispproto.h"
|
||||
#include "dispproto-wayland.h"
|
||||
#include "dispproto-x11.h"
|
||||
#include "dispproto-wndmgmt-wnck.h"
|
||||
#include "dispproto-wndmgmt-xfw.h"
|
||||
|
||||
//
|
||||
// STATIC DATA
|
||||
//
|
||||
static TaskbandDisplayProtocol s_dispproto;
|
||||
|
||||
//
|
||||
// RESOLVED FUNCS
|
||||
//
|
||||
static GType (*p_gdk_x11_display_get_type) (void) = NULL;
|
||||
static GType (*p_gdk_wayland_display_get_type) (void) = NULL;
|
||||
|
||||
void (*anchor_taskband_to_bottom)(
|
||||
GtkWindow* taskband
|
||||
) = NULL;
|
||||
|
||||
WndMgmtWindow* (*wndmgmt_screen_get_active_window) (
|
||||
WndMgmtScreen* screen
|
||||
) = NULL;
|
||||
WndMgmtScreen* (*wndmgmt_screen_get_default) (void) = NULL;
|
||||
|
||||
GdkPixbuf* (*wndmgmt_window_get_mini_icon) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
gchar* (*wndmgmt_window_get_name) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
gboolean (*wndmgmt_window_is_skip_tasklist) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
void (*wndmgmt_window_minimize) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
void (*wndmgmt_window_unminimize) (
|
||||
WndMgmtWindow* window
|
||||
) = NULL;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
TaskbandDisplayProtocol get_display_protocol_in_use(void)
|
||||
{
|
||||
return s_dispproto;
|
||||
}
|
||||
|
||||
gboolean init_display_protocol_apis(void)
|
||||
{
|
||||
void* dl_gdk = dlopen("libgdk-3.so", RTLD_LAZY | RTLD_LOCAL);
|
||||
|
||||
if (dl_gdk == NULL)
|
||||
{
|
||||
g_critical("%s", "Failed to open libgdk for symbols.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Resolve GObject type codes for the displays
|
||||
//
|
||||
p_gdk_x11_display_get_type = dlsym(dl_gdk, "gdk_x11_display_get_type");
|
||||
p_gdk_wayland_display_get_type = dlsym(dl_gdk, "gdk_wayland_display_get_type");
|
||||
|
||||
if (
|
||||
p_gdk_x11_display_get_type == NULL &&
|
||||
p_gdk_wayland_display_get_type == NULL
|
||||
)
|
||||
{
|
||||
g_critical("%s", "Unable to resolve X11 nor Wayland symbols in GDK.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// What is our display?
|
||||
//
|
||||
GdkDisplay* display = gdk_display_get_default();
|
||||
|
||||
if (
|
||||
p_gdk_x11_display_get_type != NULL &&
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((display), p_gdk_x11_display_get_type()))
|
||||
)
|
||||
{
|
||||
s_dispproto = DISPPROTO_X11;
|
||||
|
||||
if (!init_x11_protocol_impl())
|
||||
{
|
||||
g_critical("%s", "Failed to initialize X11 implementation.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (
|
||||
p_gdk_wayland_display_get_type != NULL &&
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((display), p_gdk_wayland_display_get_type()))
|
||||
)
|
||||
{
|
||||
s_dispproto = DISPPROTO_WAYLAND;
|
||||
|
||||
if (!init_wayland_protocol_impl())
|
||||
{
|
||||
g_critical("%s", "Failed to initialize Wayland implementation.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_critical("%s", "Can't determine display type, not X11 or Wayland?");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Window management stuff, we prioritise loading xfce4windowing because it
|
||||
// is the future - failing that we try WNCK, but only for X cos It Don't
|
||||
// Work On Wayland! (TM)
|
||||
//
|
||||
if (!init_wndmgmt_xfw_impl())
|
||||
{
|
||||
if (get_display_protocol_in_use() == DISPPROTO_WAYLAND)
|
||||
{
|
||||
// It's over for Wayland!
|
||||
//
|
||||
g_critical(
|
||||
"%s",
|
||||
"libxfce4windowing not available, cannot continue on Wayland."
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!init_wndmgmt_wnck_impl())
|
||||
{
|
||||
// No WNCK! Computer over! Disaster = very yes!
|
||||
//
|
||||
g_critical(
|
||||
"%s",
|
||||
"libwnck not available, cannot continue."
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
54
shell/taskband/src/dispproto.h
Normal file
54
shell/taskband/src/dispproto.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef __DISPPROTO_H__
|
||||
#define __DISPPROTO_H__
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//
|
||||
// PUBLIC DEFINES
|
||||
//
|
||||
#define WndMgmtScreen void
|
||||
#define WndMgmtWindow void
|
||||
|
||||
//
|
||||
// PUBLIC ENUMS
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
DISPPROTO_X11,
|
||||
DISPPROTO_WAYLAND
|
||||
} TaskbandDisplayProtocol;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
TaskbandDisplayProtocol get_display_protocol_in_use(void);
|
||||
gboolean init_display_protocol_apis(void);
|
||||
|
||||
extern void (*anchor_taskband_to_bottom) (
|
||||
GtkWindow* taskband
|
||||
);
|
||||
|
||||
extern WndMgmtWindow* (*wndmgmt_screen_get_active_window) (
|
||||
WndMgmtScreen* screen
|
||||
);
|
||||
extern WndMgmtScreen* (*wndmgmt_screen_get_default) (void);
|
||||
|
||||
extern GdkPixbuf* (*wndmgmt_window_get_mini_icon) (
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
extern gchar* (*wndmgmt_window_get_name) (
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
extern gboolean (*wndmgmt_window_is_skip_tasklist) (
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
extern void (*wndmgmt_window_minimize) (
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
extern void (*wndmgmt_window_unminimize) (
|
||||
WndMgmtWindow* window
|
||||
);
|
||||
|
||||
#endif
|
||||
29
shell/taskband/src/main.c
Normal file
29
shell/taskband/src/main.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "meta.h"
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char* argv[]
|
||||
)
|
||||
{
|
||||
// Set up locales
|
||||
//
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(PKG_NAME, "/usr/share/locale");
|
||||
textdomain(PKG_NAME);
|
||||
|
||||
// Launch application
|
||||
//
|
||||
WinTCTaskbandApplication* app = wintc_taskband_application_new();
|
||||
int status;
|
||||
|
||||
status = g_application_run(G_APPLICATION(app), argc, argv);
|
||||
|
||||
g_object_unref(app);
|
||||
|
||||
return status;
|
||||
}
|
||||
6
shell/taskband/src/res/resources.xml
Normal file
6
shell/taskband/src/res/resources.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/uk/oddmatics/wintc/taskband">
|
||||
<file>start-menu.css</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
@@ -1,16 +1,15 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <garcon/garcon.h>
|
||||
#include <garcon-gtk/garcon-gtk.h>
|
||||
#include <gio/gdesktopappinfo.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comgtk.h>
|
||||
#include <wintc-exec.h>
|
||||
|
||||
#include "startmenuitem.h"
|
||||
#include "../meta.h"
|
||||
#include "programslist.h"
|
||||
#include "startmenuitem.h"
|
||||
#include "util.h"
|
||||
|
||||
//
|
||||
@@ -1,13 +1,9 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/xfce-panel-plugin.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "plugin.h"
|
||||
#include "../meta.h"
|
||||
#include "startbutton.h"
|
||||
#include "startmenu.h"
|
||||
#include "util.h"
|
||||
@@ -15,6 +11,13 @@
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _StartButtonPrivate
|
||||
{
|
||||
StartMenu* menu;
|
||||
|
||||
gboolean synchronizing;
|
||||
};
|
||||
|
||||
struct _StartButtonClass
|
||||
{
|
||||
GtkToggleButtonClass __parent__;
|
||||
@@ -24,17 +27,12 @@ struct _StartButton
|
||||
{
|
||||
GtkToggleButton __parent__;
|
||||
|
||||
GtkWidget* menu;
|
||||
XfcePanelPlugin* plugin;
|
||||
StartButtonPrivate* priv;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void start_button_finalize(
|
||||
GObject* object
|
||||
);
|
||||
|
||||
static void on_clicked(
|
||||
GtkButton* button,
|
||||
gpointer user_data
|
||||
@@ -48,21 +46,25 @@ static void on_start_menu_hidden(
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
G_DEFINE_TYPE(StartButton, start_button, GTK_TYPE_TOGGLE_BUTTON)
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
StartButton,
|
||||
start_button,
|
||||
GTK_TYPE_TOGGLE_BUTTON,
|
||||
G_ADD_PRIVATE(StartButton)
|
||||
)
|
||||
|
||||
static void start_button_class_init(
|
||||
StartButtonClass* klass
|
||||
)
|
||||
{
|
||||
GObjectClass* gclass = G_OBJECT_CLASS(klass);
|
||||
|
||||
gclass->finalize = start_button_finalize;
|
||||
}
|
||||
WINTC_UNUSED(StartButtonClass* klass)
|
||||
) {}
|
||||
|
||||
static void start_button_init(
|
||||
StartButton* self
|
||||
)
|
||||
{
|
||||
self->priv = start_button_get_instance_private(self);
|
||||
|
||||
self->priv->synchronizing = FALSE;
|
||||
|
||||
//
|
||||
// The layout here - we use a box to represent the icon next to the 'start' text
|
||||
// so that themes can apply their own icon here (important because the Plex style
|
||||
@@ -92,8 +94,6 @@ static void start_button_init(
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(self), outer_box);
|
||||
|
||||
// FIXME: Use localized string
|
||||
//
|
||||
gtk_widget_set_tooltip_text(GTK_WIDGET(self), _("Click here to begin"));
|
||||
|
||||
// Add style class
|
||||
@@ -102,60 +102,32 @@ static void start_button_init(
|
||||
wintc_widget_add_style_class(icon_box, "xp-flag");
|
||||
wintc_widget_add_style_class(start_label_l, "lower");
|
||||
wintc_widget_add_style_class(start_label_u, "upper");
|
||||
}
|
||||
|
||||
//
|
||||
// FINALIZE
|
||||
//
|
||||
static void start_button_finalize(
|
||||
GObject* object
|
||||
)
|
||||
{
|
||||
(*G_OBJECT_CLASS(start_button_parent_class)->finalize) (object);
|
||||
// Create menu
|
||||
//
|
||||
self->priv->menu = start_menu_new(GTK_WIDGET(self));
|
||||
|
||||
g_signal_connect(
|
||||
G_OBJECT(self),
|
||||
"clicked",
|
||||
G_CALLBACK(on_clicked),
|
||||
NULL
|
||||
);
|
||||
|
||||
connect_start_menu_closed_signal(
|
||||
self->priv->menu,
|
||||
G_CALLBACK(on_start_menu_hidden)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
void start_button_attach_menu(
|
||||
StartButton* button,
|
||||
StartMenu* menu
|
||||
)
|
||||
GtkWidget* start_button_new(void)
|
||||
{
|
||||
if (button->menu != NULL)
|
||||
{
|
||||
g_warning("Attempt to attach a second menu.");
|
||||
return;
|
||||
}
|
||||
|
||||
button->menu = GTK_WIDGET(menu);
|
||||
|
||||
g_signal_connect(
|
||||
G_OBJECT(menu),
|
||||
"hide",
|
||||
G_CALLBACK(on_start_menu_hidden),
|
||||
button
|
||||
return GTK_WIDGET(
|
||||
g_object_new(TYPE_START_BUTTON, NULL)
|
||||
);
|
||||
g_signal_connect(
|
||||
G_OBJECT(button),
|
||||
"clicked",
|
||||
G_CALLBACK(on_clicked),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
void start_button_attach_plugin(
|
||||
StartButton* button,
|
||||
StartPlugin* plugin
|
||||
)
|
||||
{
|
||||
if (button->plugin != NULL)
|
||||
{
|
||||
g_warning("Attempt to attach a second plugin.");
|
||||
return;
|
||||
}
|
||||
|
||||
button->plugin = XFCE_PANEL_PLUGIN(plugin);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -168,38 +140,18 @@ static void on_clicked(
|
||||
{
|
||||
StartButton* start_button = START_BUTTON(button);
|
||||
|
||||
if (
|
||||
start_button->menu == NULL ||
|
||||
start_button->plugin == NULL
|
||||
)
|
||||
if (start_button->priv->synchronizing)
|
||||
{
|
||||
g_critical("Attachments are incomplete.");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
|
||||
{
|
||||
gint x, y;
|
||||
|
||||
gtk_window_present_with_time(
|
||||
GTK_WINDOW(start_button->menu),
|
||||
GDK_CURRENT_TIME
|
||||
);
|
||||
|
||||
start_menu_get_popup_position(
|
||||
start_button->menu,
|
||||
start_button->plugin,
|
||||
GTK_WIDGET(start_button),
|
||||
&x,
|
||||
&y
|
||||
);
|
||||
|
||||
gtk_window_move(GTK_WINDOW(start_button->menu), x, y);
|
||||
start_menu_present(start_button->priv->menu);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_hide(start_button->menu);
|
||||
start_menu_close(start_button->priv->menu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,8 +160,14 @@ static void on_start_menu_hidden(
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
StartButton* start_button = START_BUTTON(user_data);
|
||||
|
||||
start_button->priv->synchronizing = TRUE;
|
||||
|
||||
gtk_toggle_button_set_active(
|
||||
GTK_TOGGLE_BUTTON(user_data),
|
||||
GTK_TOGGLE_BUTTON(start_button),
|
||||
FALSE
|
||||
);
|
||||
|
||||
start_button->priv->synchronizing = FALSE;
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "plugin.h"
|
||||
#include "startmenu.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -12,8 +11,9 @@ G_BEGIN_DECLS
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _StartButtonClass StartButtonClass;
|
||||
typedef struct _StartButton StartButton;
|
||||
typedef struct _StartButtonPrivate StartButtonPrivate;
|
||||
typedef struct _StartButtonClass StartButtonClass;
|
||||
typedef struct _StartButton StartButton;
|
||||
|
||||
#define TYPE_START_BUTTON (start_button_get_type())
|
||||
#define START_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_START_BUTTON, StartButton))
|
||||
@@ -27,14 +27,7 @@ GType start_button_get_type(void) G_GNUC_CONST;
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
void start_button_attach_menu(
|
||||
StartButton* button,
|
||||
StartMenu* menu
|
||||
);
|
||||
void start_button_attach_plugin(
|
||||
StartButton* button,
|
||||
StartPlugin* plugin
|
||||
);
|
||||
GtkWidget* start_button_new(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/xfce-panel-plugin.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "../dispproto.h"
|
||||
#include "../meta.h"
|
||||
#include "action.h"
|
||||
#include "placeslist.h"
|
||||
#include "programslist.h"
|
||||
@@ -17,35 +16,20 @@
|
||||
#include "util.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
// STRUCTURE DEFINITIONS
|
||||
//
|
||||
struct _StartMenuPrivate
|
||||
{
|
||||
StartMenu* menu;
|
||||
|
||||
GtkWidget* main_box;
|
||||
GtkStyleProvider* userpic_style_provider;
|
||||
};
|
||||
|
||||
struct _StartMenuClass
|
||||
{
|
||||
GtkWindowClass __parent__;
|
||||
};
|
||||
|
||||
struct _StartMenu
|
||||
{
|
||||
GtkWindow __parent__;
|
||||
GtkWidget* menu;
|
||||
|
||||
StartMenuPrivate* priv;
|
||||
GtkWidget* main_box;
|
||||
GtkWidget* start_button;
|
||||
GtkStyleProvider* userpic_style_provider;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void start_menu_finalize(
|
||||
GObject* object
|
||||
);
|
||||
|
||||
static void create_logoffpane_structure(
|
||||
StartMenu* start_menu,
|
||||
GtkBox* box
|
||||
@@ -93,130 +77,160 @@ static void on_userpic_clicked(
|
||||
);
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
StartMenu,
|
||||
start_menu,
|
||||
GTK_TYPE_WINDOW,
|
||||
G_ADD_PRIVATE(StartMenu)
|
||||
)
|
||||
|
||||
static void start_menu_class_init(
|
||||
StartMenuClass* klass
|
||||
void connect_start_menu_closed_signal(
|
||||
StartMenu* start_menu,
|
||||
GCallback callback
|
||||
)
|
||||
{
|
||||
GObjectClass* gclass = G_OBJECT_CLASS(klass);
|
||||
|
||||
gclass->finalize = start_menu_finalize;
|
||||
g_signal_connect(
|
||||
start_menu->menu,
|
||||
"hide",
|
||||
callback,
|
||||
start_menu->start_button
|
||||
);
|
||||
}
|
||||
|
||||
static void start_menu_init(
|
||||
StartMenu* self
|
||||
void start_menu_close(
|
||||
StartMenu* start_menu
|
||||
)
|
||||
{
|
||||
self->priv = start_menu_get_instance_private(self);
|
||||
gtk_widget_hide(start_menu->menu);
|
||||
}
|
||||
|
||||
// Set up hints
|
||||
StartMenu* start_menu_new(
|
||||
GtkWidget* start_button
|
||||
)
|
||||
{
|
||||
StartMenu* start_menu = g_new(StartMenu, 1);
|
||||
|
||||
// On X11, we must use a GtkWindow, on Wayland we use a GtkPopover - the
|
||||
// reason for this is because popovers cannot exist outside the bounds of
|
||||
// the parent window on X11
|
||||
//
|
||||
gtk_window_set_type_hint(GTK_WINDOW(self), GDK_WINDOW_TYPE_HINT_POPUP_MENU);
|
||||
gtk_window_set_resizable(GTK_WINDOW(self), FALSE);
|
||||
gtk_window_set_keep_above(GTK_WINDOW(self), TRUE);
|
||||
gtk_window_stick(GTK_WINDOW(self));
|
||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(self), TRUE);
|
||||
gtk_window_set_title(GTK_WINDOW(self), "Start menu");
|
||||
gtk_widget_set_events(GTK_WIDGET(self), GDK_FOCUS_CHANGE_MASK);
|
||||
|
||||
// Set up signals
|
||||
// We use a GtkWindow instead on X11 to work around that, using
|
||||
// gtk_window_move() -- which obviously doesn't work on Wayland
|
||||
//
|
||||
g_signal_connect(
|
||||
G_OBJECT(self),
|
||||
"delete-event",
|
||||
G_CALLBACK(gtk_widget_hide_on_delete),
|
||||
NULL
|
||||
);
|
||||
g_signal_connect(
|
||||
G_OBJECT(self),
|
||||
"focus-out-event",
|
||||
G_CALLBACK(on_focus_out),
|
||||
NULL
|
||||
);
|
||||
|
||||
// Set titlebar to the fake titlebar box
|
||||
// So... GtkWindow on X11, GtkPopover on Wayland :)
|
||||
//
|
||||
GtkWidget* fake_titlebar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
if (get_display_protocol_in_use() == DISPPROTO_X11)
|
||||
{
|
||||
start_menu->menu = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_window_set_titlebar(GTK_WINDOW(self), fake_titlebar);
|
||||
// Set up hints
|
||||
//
|
||||
gtk_window_set_type_hint(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
GDK_WINDOW_TYPE_HINT_POPUP_MENU
|
||||
);
|
||||
gtk_window_set_resizable(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
FALSE
|
||||
);
|
||||
gtk_window_set_keep_above(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
TRUE
|
||||
);
|
||||
gtk_window_stick(GTK_WINDOW(start_menu->menu));
|
||||
gtk_window_set_skip_taskbar_hint(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
TRUE
|
||||
);
|
||||
gtk_window_set_title(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
"Start menu"
|
||||
);
|
||||
gtk_widget_set_events(
|
||||
GTK_WIDGET(start_menu->menu),
|
||||
GDK_FOCUS_CHANGE_MASK
|
||||
);
|
||||
|
||||
// Set up signals
|
||||
//
|
||||
g_signal_connect(
|
||||
start_menu->menu,
|
||||
"delete-event",
|
||||
G_CALLBACK(gtk_widget_hide_on_delete),
|
||||
NULL
|
||||
);
|
||||
g_signal_connect(
|
||||
start_menu->menu,
|
||||
"focus-out-event",
|
||||
G_CALLBACK(on_focus_out),
|
||||
NULL
|
||||
);
|
||||
|
||||
// Set titlebar to the fake titlebar box
|
||||
//
|
||||
GtkWidget* fake_titlebar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
gtk_window_set_titlebar(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
fake_titlebar
|
||||
);
|
||||
}
|
||||
else if (get_display_protocol_in_use() == DISPPROTO_WAYLAND)
|
||||
{
|
||||
start_menu->menu = gtk_popover_new(start_button);
|
||||
}
|
||||
|
||||
// Set up structure
|
||||
//
|
||||
self->priv->main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||
start_menu->main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
create_userpane_structure(self, GTK_BOX(self->priv->main_box));
|
||||
create_taskcolumns_structure(self, GTK_BOX(self->priv->main_box));
|
||||
create_logoffpane_structure(self, GTK_BOX(self->priv->main_box));
|
||||
create_userpane_structure(start_menu, GTK_BOX(start_menu->main_box));
|
||||
create_taskcolumns_structure(start_menu, GTK_BOX(start_menu->main_box));
|
||||
create_logoffpane_structure(start_menu, GTK_BOX(start_menu->main_box));
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(self), self->priv->main_box);
|
||||
gtk_container_add(GTK_CONTAINER(start_menu->menu), start_menu->main_box);
|
||||
|
||||
// Add style class
|
||||
//
|
||||
wintc_widget_add_style_class(GTK_WIDGET(self), "xp-start-menu");
|
||||
wintc_widget_add_style_class(GTK_WIDGET(start_menu->menu), "xp-start-menu");
|
||||
|
||||
gtk_widget_show_all(self->priv->main_box);
|
||||
gtk_widget_show_all(start_menu->main_box);
|
||||
|
||||
// Attach button
|
||||
//
|
||||
start_menu->start_button = start_button;
|
||||
|
||||
return start_menu;
|
||||
}
|
||||
|
||||
//
|
||||
// FINALIZE
|
||||
//
|
||||
static void start_menu_finalize(
|
||||
GObject* object
|
||||
void start_menu_present(
|
||||
StartMenu* start_menu
|
||||
)
|
||||
{
|
||||
(*G_OBJECT_CLASS(start_menu_parent_class)->finalize) (object);
|
||||
}
|
||||
gint height;
|
||||
gint x;
|
||||
gint y;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
void start_menu_get_popup_position(
|
||||
GtkWidget* menu,
|
||||
WINTC_UNUSED(XfcePanelPlugin* plugin),
|
||||
GtkWidget* widget,
|
||||
gint* x,
|
||||
gint* y
|
||||
)
|
||||
{
|
||||
GtkAllocation box_alloc;
|
||||
gint wnd_x;
|
||||
gint wnd_y;
|
||||
if (get_display_protocol_in_use() == DISPPROTO_X11)
|
||||
{
|
||||
gtk_window_present_with_time(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
GDK_CURRENT_TIME
|
||||
);
|
||||
|
||||
// Find where the attach widget is
|
||||
//
|
||||
gtk_window_get_position(
|
||||
GTK_WINDOW(gtk_widget_get_toplevel(widget)),
|
||||
&wnd_x,
|
||||
&wnd_y
|
||||
);
|
||||
height = gtk_widget_get_allocated_height(start_menu->main_box);
|
||||
|
||||
// Find my size
|
||||
//
|
||||
gtk_widget_get_allocation(
|
||||
(START_MENU(menu))->priv->main_box,
|
||||
&box_alloc
|
||||
);
|
||||
gdk_window_get_origin(
|
||||
gtk_widget_get_window(start_menu->start_button),
|
||||
&x,
|
||||
&y
|
||||
);
|
||||
|
||||
// Respond
|
||||
//
|
||||
// FIXME: This is assuming the panel is on the bottom of the screen
|
||||
// AND that the start menu fits on screen
|
||||
//
|
||||
// Need to:
|
||||
// - Check screen geometry to try and fit the Start menu
|
||||
// - Check which way to open the Start menu
|
||||
// ( xfce_panel_plugin_arrow_type() ? )
|
||||
//
|
||||
*x = wnd_x;
|
||||
*y = wnd_y - box_alloc.height;
|
||||
gtk_window_move(
|
||||
GTK_WINDOW(start_menu->menu),
|
||||
x,
|
||||
y - height
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_show(start_menu->menu);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -432,14 +446,14 @@ static void create_userpane_structure(
|
||||
GtkWidget* pic_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
GtkWidget* pic_event_box = gtk_event_box_new();
|
||||
|
||||
start_menu->priv->userpic_style_provider =
|
||||
start_menu->userpic_style_provider =
|
||||
GTK_STYLE_PROVIDER(gtk_css_provider_new());
|
||||
|
||||
context = gtk_widget_get_style_context(pic_box);
|
||||
|
||||
gtk_style_context_add_provider(
|
||||
context,
|
||||
start_menu->priv->userpic_style_provider,
|
||||
start_menu->userpic_style_provider,
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
);
|
||||
|
||||
@@ -516,7 +530,7 @@ static void update_userpic(
|
||||
// Give GTK a bump that we want to update the pic
|
||||
//
|
||||
gtk_css_provider_load_from_data(
|
||||
GTK_CSS_PROVIDER(start_menu->priv->userpic_style_provider),
|
||||
GTK_CSS_PROVIDER(start_menu->userpic_style_provider),
|
||||
css,
|
||||
-1,
|
||||
NULL
|
||||
@@ -549,7 +563,7 @@ static void on_selection_done(
|
||||
StartMenu* start_menu
|
||||
)
|
||||
{
|
||||
gtk_widget_hide(GTK_WIDGET(start_menu));
|
||||
gtk_widget_hide(GTK_WIDGET(start_menu->menu));
|
||||
}
|
||||
|
||||
static void on_userpic_clicked(
|
||||
31
shell/taskband/src/start/startmenu.h
Normal file
31
shell/taskband/src/start/startmenu.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef __STARTMENU_H__
|
||||
#define __STARTMENU_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//
|
||||
// STRUCTURE DEFINITIONS
|
||||
//
|
||||
typedef struct _StartMenu StartMenu;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
void connect_start_menu_closed_signal(
|
||||
StartMenu* start_menu,
|
||||
GCallback callback
|
||||
);
|
||||
|
||||
void start_menu_close(
|
||||
StartMenu* start_menu
|
||||
);
|
||||
|
||||
StartMenu* start_menu_new(
|
||||
GtkWidget* start_button
|
||||
);
|
||||
|
||||
void start_menu_present(
|
||||
StartMenu* start_menu
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <garcon/garcon.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gdesktopappinfo.h>
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtk.h>
|
||||
@@ -11,6 +9,7 @@
|
||||
#include <wintc-exec.h>
|
||||
#include <wintc-shllang.h>
|
||||
|
||||
#include "../meta.h"
|
||||
#include "action.h"
|
||||
#include "startmenuitem.h"
|
||||
#include "util.h"
|
||||
@@ -120,6 +120,16 @@ static void tray_clock_finalize(
|
||||
(*G_OBJECT_CLASS(tray_clock_parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* tray_clock_new(void)
|
||||
{
|
||||
return GTK_WIDGET(
|
||||
g_object_new(TYPE_TRAY_CLOCK, NULL)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// PRIVATE FUNCTIONS
|
||||
//
|
||||
@@ -24,4 +24,9 @@ GType tray_clock_get_type(void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* tray_clock_new(void);
|
||||
|
||||
#endif
|
||||
26
shell/taskband/src/systray/notifarea.c
Normal file
26
shell/taskband/src/systray/notifarea.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "notifarea.h"
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* notification_area_new(void)
|
||||
{
|
||||
GtkWidget* box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
GtkWidget* clock = tray_clock_new();
|
||||
|
||||
wintc_widget_add_style_class(box, "wintc-systray");
|
||||
|
||||
gtk_box_pack_start(
|
||||
GTK_BOX(box),
|
||||
clock,
|
||||
FALSE,
|
||||
FALSE,
|
||||
0
|
||||
);
|
||||
|
||||
return box;
|
||||
}
|
||||
6
shell/taskband/src/systray/notifarea.h
Normal file
6
shell/taskband/src/systray/notifarea.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* notification_area_new(void);
|
||||
6
shell/taskband/src/taskband.h
Normal file
6
shell/taskband/src/taskband.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __TASKBAND_H__
|
||||
#define __TASKBAND_H__
|
||||
|
||||
#define TASKBAND_ROW_HEIGHT 30
|
||||
|
||||
#endif
|
||||
@@ -2,11 +2,12 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "../taskband.h"
|
||||
#include "taskbuttonbar.h"
|
||||
#include "windowmonitor.h"
|
||||
|
||||
#define TASKBUTTON_MAX_WIDTH 160
|
||||
#define TASKBUTTON_MIN_WIDTH 52
|
||||
#define TASKBUTTON_BAR_HEIGHT 30
|
||||
#define TASKBUTTON_BAR_UPDOWN_WIDTH 17
|
||||
|
||||
//
|
||||
@@ -15,6 +16,7 @@
|
||||
struct _TaskButtonBarPrivate
|
||||
{
|
||||
GSList* buttons;
|
||||
WindowMonitor* window_monitor;
|
||||
};
|
||||
|
||||
struct _TaskButtonBarClass
|
||||
@@ -119,7 +121,12 @@ static void taskbutton_bar_init(
|
||||
{
|
||||
self->priv = taskbutton_bar_get_instance_private(self);
|
||||
|
||||
self->priv->window_monitor =
|
||||
window_monitor_init_management(GTK_CONTAINER(self));
|
||||
|
||||
gtk_widget_set_has_window(GTK_WIDGET(self), FALSE);
|
||||
|
||||
wintc_widget_add_style_class(GTK_WIDGET(self), "wintc-taskbuttons");
|
||||
}
|
||||
|
||||
//
|
||||
@@ -200,8 +207,8 @@ static void taskbutton_bar_get_preferred_height(
|
||||
gint* natural_height
|
||||
)
|
||||
{
|
||||
*minimum_height = TASKBUTTON_BAR_HEIGHT;
|
||||
*natural_height = TASKBUTTON_BAR_HEIGHT;
|
||||
*minimum_height = TASKBAND_ROW_HEIGHT;
|
||||
*natural_height = TASKBAND_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
static void taskbutton_bar_get_preferred_height_for_width(
|
||||
@@ -211,8 +218,8 @@ static void taskbutton_bar_get_preferred_height_for_width(
|
||||
gint* natural_height
|
||||
)
|
||||
{
|
||||
*minimum_height = TASKBUTTON_BAR_HEIGHT;
|
||||
*natural_height = TASKBUTTON_BAR_HEIGHT;
|
||||
*minimum_height = TASKBAND_ROW_HEIGHT;
|
||||
*natural_height = TASKBAND_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
static void taskbutton_bar_get_preferred_width(
|
||||
@@ -343,10 +350,10 @@ static void taskbutton_bar_size_allocate(
|
||||
|
||||
child = taskbutton_bar->priv->buttons;
|
||||
|
||||
child_alloc.x = 0;
|
||||
child_alloc.x = allocation->x;
|
||||
child_alloc.y = 0;
|
||||
child_alloc.width = 0;
|
||||
child_alloc.height = TASKBUTTON_BAR_HEIGHT;
|
||||
child_alloc.height = TASKBAND_ROW_HEIGHT;
|
||||
|
||||
for (i = 0; i < n_buttons_can_fit; i++)
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libwnck/libwnck.h>
|
||||
#include <pango/pango.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "../dispproto.h"
|
||||
#include "windowmonitor.h"
|
||||
|
||||
//
|
||||
@@ -15,49 +15,49 @@ typedef struct _WindowManagerSingle
|
||||
GtkImage* button_icon;
|
||||
gboolean button_synchronizing;
|
||||
GtkLabel* button_text;
|
||||
WnckWindow* managed_window;
|
||||
WndMgmtWindow* managed_window;
|
||||
WindowMonitor* parent_monitor;
|
||||
} WindowManagerSingle;
|
||||
|
||||
struct _WindowMonitor
|
||||
{
|
||||
GtkContainer* container;
|
||||
WnckScreen* screen;
|
||||
GHashTable* window_manager_map;
|
||||
GtkContainer* container;
|
||||
WndMgmtScreen* screen;
|
||||
GHashTable* window_manager_map;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void on_active_window_changed(
|
||||
WnckScreen* screen,
|
||||
WnckWindow* previously_active_window,
|
||||
gpointer user_data
|
||||
WndMgmtScreen* screen,
|
||||
WndMgmtWindow* previously_active_window,
|
||||
gpointer user_data
|
||||
);
|
||||
static void on_window_closed(
|
||||
WnckScreen* screen,
|
||||
WnckWindow* window,
|
||||
gpointer user_data
|
||||
WndMgmtScreen* screen,
|
||||
WndMgmtWindow* window,
|
||||
gpointer user_data
|
||||
);
|
||||
static void on_window_opened(
|
||||
WnckScreen* screen,
|
||||
WnckWindow* window,
|
||||
gpointer user_data
|
||||
WndMgmtScreen* screen,
|
||||
WndMgmtWindow* window,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
static void on_window_icon_changed(
|
||||
WnckWindow* window,
|
||||
gpointer user_data
|
||||
WndMgmtWindow* window,
|
||||
gpointer user_data
|
||||
);
|
||||
static void on_window_name_changed(
|
||||
WnckWindow* window,
|
||||
gpointer user_data
|
||||
WndMgmtWindow* window,
|
||||
gpointer user_data
|
||||
);
|
||||
static void on_window_state_changed(
|
||||
WnckWindow* window,
|
||||
WnckWindowState changed_mask,
|
||||
WnckWindowState new_state,
|
||||
gpointer user_data
|
||||
WndMgmtWindow* window,
|
||||
gint changed_mask,
|
||||
gint new_state,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
static void on_window_button_toggled(
|
||||
@@ -85,7 +85,7 @@ WindowMonitor* window_monitor_init_management(
|
||||
WindowMonitor* window_monitor = g_new(WindowMonitor, 1);
|
||||
|
||||
window_monitor->container = container;
|
||||
window_monitor->screen = wnck_screen_get_default();
|
||||
window_monitor->screen = wndmgmt_screen_get_default();
|
||||
window_monitor->window_manager_map = g_hash_table_new(
|
||||
g_direct_hash,
|
||||
g_direct_equal
|
||||
@@ -127,7 +127,7 @@ static void window_manager_update_icon(
|
||||
|
||||
gtk_image_set_from_pixbuf(
|
||||
window_manager->button_icon,
|
||||
wnck_window_get_mini_icon(
|
||||
wndmgmt_window_get_mini_icon(
|
||||
window_manager->managed_window
|
||||
)
|
||||
);
|
||||
@@ -141,7 +141,7 @@ static void window_manager_update_state(
|
||||
gboolean skip_tasklist;
|
||||
|
||||
skip_tasklist =
|
||||
wnck_window_is_skip_tasklist(window_manager->managed_window);
|
||||
wndmgmt_window_is_skip_tasklist(window_manager->managed_window);
|
||||
|
||||
if (skip_tasklist && window_manager->button != NULL)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ static void window_manager_update_text(
|
||||
)
|
||||
{
|
||||
const gchar* new_text =
|
||||
wnck_window_get_name(window_manager->managed_window);
|
||||
wndmgmt_window_get_name(window_manager->managed_window);
|
||||
|
||||
gtk_label_set_text(
|
||||
window_manager->button_text,
|
||||
@@ -234,17 +234,17 @@ static void window_manager_update_text(
|
||||
// CALLBACKS
|
||||
//
|
||||
static void on_active_window_changed(
|
||||
WINTC_UNUSED(WnckScreen* screen),
|
||||
WnckWindow* previously_active_window,
|
||||
gpointer user_data
|
||||
WINTC_UNUSED(WndMgmtScreen* screen),
|
||||
WndMgmtWindow* previously_active_window,
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
WnckWindow* active_window;
|
||||
WndMgmtWindow* active_window;
|
||||
WindowManagerSingle* window_manager_old;
|
||||
WindowManagerSingle* window_manager_new;
|
||||
WindowMonitor* window_monitor = (WindowMonitor*) user_data;
|
||||
|
||||
active_window = wnck_screen_get_active_window(window_monitor->screen);
|
||||
active_window = wndmgmt_screen_get_active_window(window_monitor->screen);
|
||||
|
||||
if (previously_active_window != NULL)
|
||||
{
|
||||
@@ -296,9 +296,9 @@ static void on_active_window_changed(
|
||||
}
|
||||
|
||||
static void on_window_closed(
|
||||
WINTC_UNUSED(WnckScreen* screen),
|
||||
WnckWindow* window,
|
||||
gpointer user_data
|
||||
WINTC_UNUSED(WndMgmtScreen* screen),
|
||||
WndMgmtWindow* window,
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
WindowManagerSingle* window_manager;
|
||||
@@ -327,9 +327,9 @@ static void on_window_closed(
|
||||
}
|
||||
|
||||
static void on_window_opened(
|
||||
WINTC_UNUSED(WnckScreen* screen),
|
||||
WnckWindow* window,
|
||||
gpointer user_data
|
||||
WINTC_UNUSED(WndMgmtScreen* screen),
|
||||
WndMgmtWindow* window,
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
WindowManagerSingle* window_manager = g_new(WindowManagerSingle, 1);
|
||||
@@ -371,7 +371,7 @@ static void on_window_opened(
|
||||
}
|
||||
|
||||
static void on_window_icon_changed(
|
||||
WINTC_UNUSED(WnckWindow* window),
|
||||
WINTC_UNUSED(WndMgmtWindow* window),
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ static void on_window_icon_changed(
|
||||
}
|
||||
|
||||
static void on_window_name_changed(
|
||||
WINTC_UNUSED(WnckWindow* window),
|
||||
WINTC_UNUSED(WndMgmtWindow* window),
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
@@ -391,9 +391,9 @@ static void on_window_name_changed(
|
||||
}
|
||||
|
||||
static void on_window_state_changed(
|
||||
WINTC_UNUSED(WnckWindow* window),
|
||||
WINTC_UNUSED(WnckWindowState changed_mask),
|
||||
WINTC_UNUSED(WnckWindowState new_state),
|
||||
WINTC_UNUSED(WndMgmtWindow* window),
|
||||
WINTC_UNUSED(gint changed_mask),
|
||||
WINTC_UNUSED(gint new_state),
|
||||
gpointer user_data
|
||||
)
|
||||
{
|
||||
@@ -416,15 +416,10 @@ static void on_window_button_toggled(
|
||||
|
||||
if (gtk_toggle_button_get_active(button))
|
||||
{
|
||||
wnck_window_unminimize(
|
||||
window_manager->managed_window,
|
||||
GDK_CURRENT_TIME
|
||||
);
|
||||
wndmgmt_window_unminimize(window_manager->managed_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
wnck_window_minimize(
|
||||
window_manager->managed_window
|
||||
);
|
||||
wndmgmt_window_minimize(window_manager->managed_window);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libwnck/libwnck.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
152
shell/taskband/src/window.c
Normal file
152
shell/taskband/src/window.c
Normal file
@@ -0,0 +1,152 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "dispproto.h"
|
||||
#include "window.h"
|
||||
#include "start/startbutton.h"
|
||||
#include "systray/notifarea.h"
|
||||
#include "taskbuttons/taskbuttonbar.h"
|
||||
#include "taskbuttons/windowmonitor.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _WinTCTaskbandWindowPrivate
|
||||
{
|
||||
GtkWidget* main_box;
|
||||
|
||||
GtkWidget* notification_area;
|
||||
GtkWidget* start_button;
|
||||
GtkWidget* taskbuttons;
|
||||
};
|
||||
|
||||
struct _WinTCTaskbandWindowClass
|
||||
{
|
||||
GtkApplicationWindowClass __parent__;
|
||||
};
|
||||
|
||||
struct _WinTCTaskbandWindow
|
||||
{
|
||||
GtkApplicationWindow __parent__;
|
||||
|
||||
WinTCTaskbandWindowPrivate* priv;
|
||||
};
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
G_DEFINE_TYPE_WITH_CODE(
|
||||
WinTCTaskbandWindow,
|
||||
wintc_taskband_window,
|
||||
GTK_TYPE_APPLICATION_WINDOW,
|
||||
G_ADD_PRIVATE(WinTCTaskbandWindow)
|
||||
)
|
||||
|
||||
static void wintc_taskband_window_class_init(
|
||||
WINTC_UNUSED(WinTCTaskbandWindowClass* klass)
|
||||
) {}
|
||||
|
||||
static void wintc_taskband_window_init(
|
||||
WinTCTaskbandWindow* self
|
||||
)
|
||||
{
|
||||
self->priv = wintc_taskband_window_get_instance_private(self);
|
||||
|
||||
//
|
||||
// WINDOW SETUP
|
||||
//
|
||||
wintc_widget_add_style_class(
|
||||
GTK_WIDGET(self),
|
||||
"wintc-taskband"
|
||||
);
|
||||
|
||||
anchor_taskband_to_bottom(GTK_WINDOW(self));
|
||||
|
||||
//
|
||||
// SET UP CHILDREN IN HERE
|
||||
// FIXME: Tidy all this stuff up big time! Taskband shouldn't know about
|
||||
// how stuff is built, just ask for a Start button, a taskbar, and
|
||||
// systray -- no implementation details!!
|
||||
//
|
||||
|
||||
// Create main container box
|
||||
//
|
||||
self->priv->main_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
gtk_container_add(
|
||||
GTK_CONTAINER(self),
|
||||
self->priv->main_box
|
||||
);
|
||||
|
||||
// Create Start button and menu
|
||||
//
|
||||
GtkCssProvider* css_start = gtk_css_provider_new();
|
||||
|
||||
gtk_css_provider_load_from_resource(
|
||||
css_start,
|
||||
"/uk/oddmatics/wintc/taskband/start-menu.css"
|
||||
);
|
||||
|
||||
gtk_style_context_add_provider_for_screen(
|
||||
gdk_screen_get_default(),
|
||||
GTK_STYLE_PROVIDER(css_start),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
|
||||
);
|
||||
|
||||
self->priv->start_button = start_button_new();
|
||||
|
||||
gtk_box_pack_start(
|
||||
GTK_BOX(self->priv->main_box),
|
||||
self->priv->start_button,
|
||||
FALSE,
|
||||
FALSE,
|
||||
0
|
||||
);
|
||||
|
||||
// Create task buttons
|
||||
//
|
||||
self->priv->taskbuttons = taskbutton_bar_new();
|
||||
|
||||
gtk_box_pack_start(
|
||||
GTK_BOX(self->priv->main_box),
|
||||
self->priv->taskbuttons,
|
||||
TRUE,
|
||||
TRUE,
|
||||
0
|
||||
);
|
||||
|
||||
// Create notification area
|
||||
//
|
||||
self->priv->notification_area = notification_area_new();
|
||||
|
||||
gtk_box_pack_end(
|
||||
GTK_BOX(self->priv->main_box),
|
||||
self->priv->notification_area,
|
||||
FALSE,
|
||||
FALSE,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* wintc_taskband_window_new(
|
||||
WinTCTaskbandApplication* app
|
||||
)
|
||||
{
|
||||
return GTK_WIDGET(
|
||||
g_object_new(
|
||||
TYPE_WINTC_TASKBAND_WINDOW,
|
||||
"application", GTK_APPLICATION(app),
|
||||
"type", GTK_WINDOW_TOPLEVEL,
|
||||
"decorated", FALSE,
|
||||
"resizable", FALSE,
|
||||
"type-hint", GDK_WINDOW_TYPE_HINT_DOCK,
|
||||
NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
32
shell/taskband/src/window.h
Normal file
32
shell/taskband/src/window.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef __WINDOW_H__
|
||||
#define __WINDOW_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "application.h"
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _WinTCTaskbandWindowPrivate WinTCTaskbandWindowPrivate;
|
||||
typedef struct _WinTCTaskbandWindowClass WinTCTaskbandWindowClass;
|
||||
typedef struct _WinTCTaskbandWindow WinTCTaskbandWindow;
|
||||
|
||||
#define TYPE_WINTC_TASKBAND_WINDOW (wintc_taskband_window_get_type())
|
||||
#define WINTC_TASKBAND_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_WINTC_TASKBAND_WINDOW, WinTCTaskbandWindow))
|
||||
#define WINTC_TASKBAND_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_WINTC_TASKBAND_WINDOW, WinTCTaskbandWindow))
|
||||
#define IS_WINTC_TASKBAND_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_WINTC_TASKBAND_WINDOW))
|
||||
#define IS_WINTC_TASKBAND_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_WINTC_TASKBAND_WINDOW))
|
||||
#define WINTC_TASKBAND_WINDOW_GET_CLASS(obj) (G_TYPE_CHECK_INSTANCE_GET_CLASS((obj), TYPE_WINTC_TASKBAND_WINDOW))
|
||||
|
||||
GType wintc_taskband_window_get_type(void) G_GNUC_CONST;
|
||||
|
||||
//
|
||||
// PUBLIC FUNCTIONS
|
||||
//
|
||||
GtkWidget* wintc_taskband_window_new(
|
||||
WinTCTaskbandApplication* app
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(
|
||||
libwintc-taskbuttons-plugin
|
||||
VERSION 1.0
|
||||
DESCRIPTION "Windows Total Conversion taskbar buttons plugin."
|
||||
)
|
||||
|
||||
set(PROJECT_ANYARCH false)
|
||||
set(PROJECT_FREESTATUS true)
|
||||
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
|
||||
|
||||
set(
|
||||
PROJECT_DEPENDENCIES
|
||||
libglib2.0-0
|
||||
libgtk-3-0
|
||||
libpango-1.0-0
|
||||
libwintc-comgtk
|
||||
libwnck-3-0
|
||||
libxfce4panel-2.0-4
|
||||
libxfce4util7
|
||||
)
|
||||
|
||||
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(../../packaging/cmake-inc/common/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/libraries/CMakeLists.txt)
|
||||
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||
pkg_check_modules(PANGO REQUIRED pango)
|
||||
pkg_check_modules(WINTC_COMGTK REQUIRED wintc-comgtk)
|
||||
pkg_check_modules(WNCK REQUIRED libwnck-3.0)
|
||||
pkg_check_modules(XFCE4PANEL REQUIRED libxfce4panel-2.0)
|
||||
pkg_check_modules(XFCE4UTIL REQUIRED libxfce4util-1.0)
|
||||
|
||||
add_library(
|
||||
libwintc-taskbuttons-plugin MODULE
|
||||
src/plugin.h
|
||||
src/plugin.c
|
||||
src/taskbuttonbar.h
|
||||
src/taskbuttonbar.c
|
||||
src/windowmonitor.h
|
||||
src/windowmonitor.c
|
||||
)
|
||||
|
||||
target_compile_definitions(
|
||||
libwintc-taskbuttons-plugin
|
||||
PRIVATE WNCK_I_KNOW_THIS_IS_UNSTABLE
|
||||
)
|
||||
|
||||
target_compile_options(
|
||||
libwintc-taskbuttons-plugin
|
||||
PRIVATE ${WINTC_COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
libwintc-taskbuttons-plugin
|
||||
SYSTEM
|
||||
PRIVATE ${GLIB_INCLUDE_DIRS}
|
||||
PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${PANGO_INCLUDE_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
|
||||
PRIVATE ${WNCK_INCLUDE_DIRS}
|
||||
PRIVATE ${XFCE4PANEL_INCLUDE_DIRS}
|
||||
PRIVATE ${XFCE4UTIL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_directories(
|
||||
libwintc-taskbuttons-plugin
|
||||
PRIVATE ${GLIB_LIBRARY_DIRS}
|
||||
PRIVATE ${GTK3_LIBRARY_DIRS}
|
||||
PRIVATE ${PANGO_LIBRARY_DIRS}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
|
||||
PRIVATE ${WNCK_LIBRARY_DIRS}
|
||||
PRIVATE ${XFCE4PANEL_LIBRARY_DIRS}
|
||||
PRIVATE ${XFCE4UTIL_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
libwintc-taskbuttons-plugin
|
||||
PRIVATE ${GLIB_LIBRARIES}
|
||||
PRIVATE ${GTK3_LIBRARIES}
|
||||
PRIVATE ${PANGO_LIBRARIES}
|
||||
PRIVATE ${WINTC_COMGTK_LIBRARIES}
|
||||
PRIVATE ${WNCK_LIBRARIES}
|
||||
PRIVATE ${XFCE4PANEL_LIBRARIES}
|
||||
PRIVATE ${XFCE4UTIL_LIBRARIES}
|
||||
)
|
||||
|
||||
# Installation
|
||||
#
|
||||
wintc_configure_and_install_packaging()
|
||||
|
||||
install(
|
||||
FILES taskbuttons.desktop
|
||||
DESTINATION share/xfce4/panel/plugins
|
||||
)
|
||||
install(
|
||||
TARGETS libwintc-taskbuttons-plugin
|
||||
DESTINATION ${LIB_DIR}/xfce4/panel/plugins
|
||||
)
|
||||
@@ -1,3 +0,0 @@
|
||||
# libwintc-taskbuttons-plugin
|
||||
This directory contains the source code for the taskbar buttons XFCE panel plugin.
|
||||

|
||||
@@ -1,71 +0,0 @@
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libwnck/libwnck.h>
|
||||
#include <libxfce4panel/libxfce4panel.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
#include <wintc-comgtk.h>
|
||||
|
||||
#include "plugin.h"
|
||||
#include "taskbuttonbar.h"
|
||||
#include "windowmonitor.h"
|
||||
|
||||
//
|
||||
// GTK OOP CLASS/INSTANCE DEFINITIONS
|
||||
//
|
||||
struct _TaskButtonsPluginClass
|
||||
{
|
||||
XfcePanelPluginClass __parent__;
|
||||
};
|
||||
|
||||
struct _TaskButtonsPlugin
|
||||
{
|
||||
XfcePanelPlugin __parent__;
|
||||
|
||||
TaskButtonBar* button_bar;
|
||||
WindowMonitor* window_monitor;
|
||||
};
|
||||
|
||||
//
|
||||
// FORWARD DECLARATIONS
|
||||
//
|
||||
static void taskbuttons_plugin_construct(
|
||||
XfcePanelPlugin* plugin
|
||||
);
|
||||
|
||||
//
|
||||
// GTK TYPE DEFINITION & CTORS
|
||||
//
|
||||
XFCE_PANEL_DEFINE_PLUGIN(TaskButtonsPlugin, taskbuttons_plugin)
|
||||
|
||||
static void taskbuttons_plugin_class_init(
|
||||
TaskButtonsPluginClass* klass
|
||||
)
|
||||
{
|
||||
XfcePanelPluginClass* plugin_class;
|
||||
|
||||
plugin_class = XFCE_PANEL_PLUGIN_CLASS(klass);
|
||||
|
||||
plugin_class->construct = taskbuttons_plugin_construct;
|
||||
}
|
||||
|
||||
static void taskbuttons_plugin_init(
|
||||
TaskButtonsPlugin* self
|
||||
)
|
||||
{
|
||||
self->button_bar = TASKBUTTON_BAR(taskbutton_bar_new());
|
||||
self->window_monitor = window_monitor_init_management(
|
||||
GTK_CONTAINER(self->button_bar)
|
||||
);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->button_bar));
|
||||
|
||||
wintc_widget_add_style_class(GTK_WIDGET(self), "wintc-taskbuttons");
|
||||
}
|
||||
|
||||
static void taskbuttons_plugin_construct(
|
||||
XfcePanelPlugin* plugin
|
||||
)
|
||||
{
|
||||
gtk_widget_show_all(GTK_WIDGET(plugin));
|
||||
xfce_panel_plugin_set_expand(plugin, TRUE);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef __PLUGIN_H__
|
||||
#define __PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libxfce4panel/libxfce4panel.h>
|
||||
#include <libxfce4util/libxfce4util.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
//
|
||||
// GTK OOP BOILERPLATE
|
||||
//
|
||||
typedef struct _TaskButtonsPluginClass TaskButtonsPluginClass;
|
||||
typedef struct _TaskButtonsPlugin TaskButtonsPlugin;
|
||||
|
||||
#define TYPE_TASKBUTTONS_PLUGIN (taskbuttons_plugin_get_type())
|
||||
#define TASKBUTTONS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_TASKBUTTONS_PLUGIN, TaskButtonsPlugin))
|
||||
#define TASKBUTTONS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_TASKBUTTONS_PLUGIN, TaskButtonsPluginClass))
|
||||
#define IS_TASKBUTTONS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE((obj), TYPE_TASKBUTTONS_PLUGIN))
|
||||
#define IS_TASKBUTTONS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_TASKBUTTONS_PLUGIN))
|
||||
#define TASKBUTTONS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_TASKBUTTONS_PLUGIN, TaskButtonsPluginClass))
|
||||
|
||||
GType taskbuttons_plugin_get_type(void) G_GNUC_CONST;
|
||||
|
||||
void taskbuttons_plugin_register_type(
|
||||
XfcePanelTypeModule* type_module
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
[Xfce Panel]
|
||||
Type=X-XFCE-PanelPlugin
|
||||
Encoding=UTF-8
|
||||
Name=Task Buttons
|
||||
Comment=Windows XP task switcher buttons.
|
||||
Icon=start-logo
|
||||
X-XFCE-Module=wintc-taskbuttons-plugin
|
||||
X-XFCE-Internal=false
|
||||
X-XFCE-API=2.0
|
||||
@@ -1,21 +0,0 @@
|
||||
# Submodules / Forks
|
||||
This directory contains submodules referenced by this repository. Mostly forks of existing software tweaked to patch things to fix certain problems.
|
||||
|
||||
## Note about cloning
|
||||
If you simply `git clone`'d this repository these directories may be empty. If so, run `git submodule update --init --recursive` to make sure these submodules are also cloned.
|
||||
|
||||
## xfce-winxp-tc-panel
|
||||
This is a fork of `xfce4-panel` which patches a few things such as removing borders and fixing external plugin backgrounds. It is recommended to install this so that the Start button looks correct.
|
||||
|
||||
To install this fork:
|
||||
- `cd` into `xfce-winxp-tc-panel/packaging` (it should already be on the `test-borders` branch, but you can check with `git status`)
|
||||
- Build the packages by running these scripts:
|
||||
- `./pack-libxfce4panel-2.0.sh`
|
||||
- `./pack-xfce4-panel.sh`
|
||||
- Install the generated packages with:
|
||||
- `sudo dpkg -i libxfce4panel-2.0-4.deb`
|
||||
- `sudo dpkg -i xfce4-panel.deb`
|
||||
|
||||
You must then restart the panel, logging off and back on is sufficient to do this.
|
||||
|
||||
(In future I will hopefully tidy up the fork and see if the patches can be merged with upstream)
|
||||
Submodule submodules/xfce-winxp-tc-panel deleted from 8a08d1a0d3
@@ -7,7 +7,7 @@
|
||||
* Authors: Rory Fewell <roryf@oddmatics.uk>
|
||||
*/
|
||||
|
||||
@import "wintc-taskband";
|
||||
@import "wintc-taskbuttons";
|
||||
@import "xp-start-plugin";
|
||||
@import "xp-systray-plugin";
|
||||
@import "xfce-panel";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* xfce-panel.scss - Theme Base XFCE Panel Styles
|
||||
* wintc-taskband.scss - Theme Base XFCE Panel Styles
|
||||
*
|
||||
* This source-code is part of Windows XP stuff for XFCE:
|
||||
* <<https://www.oddmatics.uk>>
|
||||
@@ -7,7 +7,7 @@
|
||||
* Author(s): Rory Fewell <roryf@oddmatics.uk>
|
||||
*/
|
||||
|
||||
.xfce4-panel
|
||||
.wintc-taskband
|
||||
{
|
||||
// NOTE: You would think that theming the panel is simple, right? Just stretch the
|
||||
// taskband texture to the full size of the panel...
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user