Added mouse panel, dummy device representation
This commit is contained in:
parent
10d037819e
commit
ad5cef35d4
BIN
drivers/g-wolves/htx/htx_0.png
Normal file
BIN
drivers/g-wolves/htx/htx_0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
16
src/device/device.c
Normal file
16
src/device/device.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
struct DEVICE
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
char* device_get_image(device_t* device)
|
||||||
|
{
|
||||||
|
return "/home/valentin/Documents/prjs/ginput/drivers/g-wolves/htx/htx_0.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
char* device_get_name(device_t* device)
|
||||||
|
{
|
||||||
|
return "G-Wolves HTX 4K";
|
||||||
|
}
|
9
src/device/device.h
Normal file
9
src/device/device.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef DEVICE_H
|
||||||
|
#define DEVICE_H
|
||||||
|
|
||||||
|
typedef struct DEVICE device_t;
|
||||||
|
|
||||||
|
char* device_get_image(device_t* device);
|
||||||
|
char* device_get_name(device_t* device);
|
||||||
|
|
||||||
|
#endif
|
42
src/ui/panels/mouse-panel.c
Normal file
42
src/ui/panels/mouse-panel.c
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "mouse-panel.h"
|
||||||
|
|
||||||
|
struct _MousePanel
|
||||||
|
{
|
||||||
|
Panel parent_instance;
|
||||||
|
|
||||||
|
GtkImage* mouse_image;
|
||||||
|
GtkLabel* mouse_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MousePanel, mouse_panel, panel_get_type())
|
||||||
|
|
||||||
|
static void
|
||||||
|
mouse_panel_class_init(MousePanelClass* klass)
|
||||||
|
{
|
||||||
|
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||||
|
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
|
||||||
|
PanelClass* panel_class = GINPUT_PANEL_CLASS(klass);
|
||||||
|
|
||||||
|
gtk_widget_class_set_template_from_resource(widget_class, "/v/ginput/panel-mouse.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child(widget_class, MousePanel, mouse_image);
|
||||||
|
gtk_widget_class_bind_template_child(widget_class, MousePanel, mouse_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mouse_panel_init(MousePanel* self)
|
||||||
|
{
|
||||||
|
gtk_widget_init_template(GTK_WIDGET(self));
|
||||||
|
}
|
||||||
|
|
||||||
|
Panel*
|
||||||
|
mouse_panel_new(void)
|
||||||
|
{
|
||||||
|
return g_object_new(mouse_panel_get_type(), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouse_panel_set_device(MousePanel* self, device_t* device)
|
||||||
|
{
|
||||||
|
gtk_image_set_from_file(self->mouse_image, device_get_image(device));
|
||||||
|
gtk_label_set_label(self->mouse_name, device_get_name(device));
|
||||||
|
}
|
15
src/ui/panels/mouse-panel.h
Normal file
15
src/ui/panels/mouse-panel.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/panel.h"
|
||||||
|
#include "device/device.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
G_DECLARE_FINAL_TYPE(MousePanel, mouse_panel, GINPUT, MOUSE_PANEL, Panel)
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
Panel* mouse_panel_new(void);
|
||||||
|
|
||||||
|
void mouse_panel_set_device(MousePanel* self, device_t* device);
|
||||||
|
|
@ -28,7 +28,10 @@
|
|||||||
(2,16,"AdwWindowTitle","title",15,None,None,None,None,None),
|
(2,16,"AdwWindowTitle","title",15,None,None,None,None,None),
|
||||||
(3,1,"Panel","EmptyPanel",None,None,None,None,None,"\n"),
|
(3,1,"Panel","EmptyPanel",None,None,None,None,None,"\n"),
|
||||||
(3,2,"GtkLabel",None,1,None,None,None,None,None),
|
(3,2,"GtkLabel",None,1,None,None,None,None,None),
|
||||||
(4,1,"Panel","MousePanel",None,None,None,None,None,"")
|
(4,1,"Panel","MousePanel",None,None,None,None,None,""),
|
||||||
|
(4,5,"GtkBox",None,1,None,None,None,1,None),
|
||||||
|
(4,6,"GtkImage","mouse_image",5,None,None,None,None,None),
|
||||||
|
(4,7,"GtkLabel","mouse_name",5,None,None,None,1,None)
|
||||||
</object>
|
</object>
|
||||||
<object_property>
|
<object_property>
|
||||||
(1,1,"GtkWindow","default-height","980",None,None,None,None,None,None,None,None,None),
|
(1,1,"GtkWindow","default-height","980",None,None,None,None,None,None,None,None,None),
|
||||||
@ -62,7 +65,17 @@
|
|||||||
(2,15,"AdwHeaderBar","show-start-title-buttons","False",None,None,None,None,None,None,None,None,None),
|
(2,15,"AdwHeaderBar","show-start-title-buttons","False",None,None,None,None,None,None,None,None,None),
|
||||||
(2,15,"AdwHeaderBar","title-widget",None,None,None,None,None,16,None,None,None,None),
|
(2,15,"AdwHeaderBar","title-widget",None,None,None,None,None,16,None,None,None,None),
|
||||||
(3,2,"GtkLabel","justify","center",None,None,None,None,None,None,None,None,None),
|
(3,2,"GtkLabel","justify","center",None,None,None,None,None,None,None,None,None),
|
||||||
(3,2,"GtkLabel","label","There is nothing here...\nPerhaps you don't have the needed drivers installed and active ?",None,None,None,None,None,None,None,None,None)
|
(3,2,"GtkLabel","label","There is nothing here...\nPerhaps you don't have the needed drivers installed and active ?",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,5,"GtkBox","spacing","10",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,5,"GtkOrientable","orientation","vertical",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,5,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,6,"GtkWidget","halign","start",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,6,"GtkWidget","height-request","250",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,6,"GtkWidget","margin-top","30",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,6,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,6,"GtkWidget","width-request","300",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,7,"GtkLabel","justify","center",None,None,None,None,None,None,None,None,None),
|
||||||
|
(4,7,"GtkWidget","halign","center",None,None,None,None,None,None,None,None,None)
|
||||||
</object_property>
|
</object_property>
|
||||||
<object_data>
|
<object_data>
|
||||||
(1,6,"GtkWidget",1,1,None,None,None,None,None,None),
|
(1,6,"GtkWidget",1,1,None,None,None,None,None,None),
|
||||||
@ -70,7 +83,13 @@
|
|||||||
(1,10,"GtkWidget",2,2,None,1,None,None,None,None),
|
(1,10,"GtkWidget",2,2,None,1,None,None,None,None),
|
||||||
(1,8,"GtkWidget",1,1,None,None,None,None,None,None),
|
(1,8,"GtkWidget",1,1,None,None,None,None,None,None),
|
||||||
(1,8,"GtkWidget",2,2,None,1,None,None,None,None),
|
(1,8,"GtkWidget",2,2,None,1,None,None,None,None),
|
||||||
(1,6,"GtkWidget",2,2,None,1,None,None,None,None)
|
(1,6,"GtkWidget",2,2,None,1,None,None,None,None),
|
||||||
|
(4,1,"GtkWidget",2,2,None,1,None,None,None,None),
|
||||||
|
(4,1,"GtkWidget",2,3,None,1,None,None,None,None),
|
||||||
|
(4,1,"GtkWidget",2,4,None,1,None,None,None,None),
|
||||||
|
(4,1,"GtkWidget",2,5,None,1,None,None,None,None),
|
||||||
|
(4,1,"GtkWidget",2,6,None,1,None,None,None,None),
|
||||||
|
(4,6,"GtkWidget",1,1,None,None,None,None,None,None)
|
||||||
</object_data>
|
</object_data>
|
||||||
<object_data_arg>
|
<object_data_arg>
|
||||||
(1,10,"GtkWidget",2,2,"name","background"),
|
(1,10,"GtkWidget",2,2,"name","background"),
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<file preprocess="xml-stripblanks">main-window.ui</file>
|
<file preprocess="xml-stripblanks">main-window.ui</file>
|
||||||
<file preprocess="xml-stripblanks">panel.ui</file>
|
<file preprocess="xml-stripblanks">panel.ui</file>
|
||||||
<file preprocess="xml-stripblanks">panel-empty.ui</file>
|
<file preprocess="xml-stripblanks">panel-empty.ui</file>
|
||||||
|
<file preprocess="xml-stripblanks">panel-mouse.ui</file>
|
||||||
<file>style.css</file>
|
<file>style.css</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
Loading…
Reference in New Issue
Block a user