Add gtk53

This commit is contained in:
daleclack 2021-03-28 08:39:36 +08:00
parent 1a25d00e0b
commit 239978e4bf
12 changed files with 499 additions and 0 deletions

View File

@ -0,0 +1,59 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
//For linux amd64 and linux on arm64,some include path may different
//Commet and uncomment these lines to compile on a specificed archtiecture
//Arm64 linux libs
/*
"/usr/lib/aarch64-linux-gnu/dbus-1.0/include/**",
"/usr/lib/aarch64-linux-gnu/glib-2.0/include",
*/
//amd64 linux libs(For ubuntu)
/*
"/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include",
*/
//For debian and ubuntu,kali
/*
"/usr/include/gtk-3.0/gtk/**",
"/usr/include/uuid/**",
*/
//For manjaro(Arch linux)
"/usr/lib/dbus-1.0/include/**",
"/usr/lib/glib-2.0/include/**",
"/usr/include/lzo/**",
"/usr/include/cloudproviders/**",
"${workspaceFolder}/**",
"/usr/include/gtk-3.0/**",
"/usr/include/at-spi2-atk/2.0/**",
"/usr/include/at-spi-2.0/**",
"/usr/include/dbus-1.0/**",
"/usr/include/gio-unix-2.0/**",
"/usr/include/cairo/**",
"/usr/include/pango-1.0/**",
"/usr/include/fribidi/**",
"/usr/include/harfbuzz/**",
"/usr/include/atk-1.0/**",
"/usr/include/pixman-1/**",
"/usr/include/freetype2/**",
"/usr/include/libpng16/**",
"/usr/include/gdk-pixbuf-2.0/**",
"/usr/include/libmount/**",
"/usr/include/blkid/**",
"/usr/include/glib-2.0/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-arm64",
"compilerArgs": [
"`pkg-config --cflags --libs gtk+-3.0`"
],
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

29
Gtk3/gtk53_runner2/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/gtk53",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++ build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}

View File

@ -0,0 +1,4 @@
{
"C_Cpp.errorSquiggles": "Disabled",
"cmake.configureOnOpen": false
}

82
Gtk3/gtk53_runner2/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,82 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"*.cpp",
"-o",
"${workspaceFolder}/bin/gtk53",
"-pthread",
//For Arm64 linux
/*
"-I/usr/lib/aarch64-linux-gnu/dbus-1.0/include",
"-I/usr/lib/aarch64-linux-gnu/glib-2.0/include",
*/
//For amd64 linux
/*
"-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
"-I/usr/lib/x86_64-linux-gnu/glib-2.0/include",
*/
//Ubuntu and kali include paths
/*
"-I/usr/include/uuid",
*/
//Manjaro linux and Arch linux include args
"-I${workspaceFolder}",
"-I/usr/lib/glib-2.0/include",
"-I/usr/lib/dbus-1.0/include",
"-I/usr/include/lzo",
"-I/usr/include/cloudproviders",
"-I/usr/include/gtk-3.0",
"-I/usr/include/at-spi2-atk/2.0",
"-I/usr/include/at-spi-2.0",
"-I/usr/include/dbus-1.0",
"-I/usr/include/gio-unix-2.0",
"-I/usr/include/cairo",
"-I/usr/include/pango-1.0",
"-I/usr/include/fribidi",
"-I/usr/include/harfbuzz",
"-I/usr/include/atk-1.0",
"-I/usr/include/pixman-1",
"-I/usr/include/freetype2",
"-I/usr/include/libpng16",
"-I/usr/include/gdk-pixbuf-2.0",
"-I/usr/include/libmount",
"-I/usr/include/blkid",
"-I/usr/include/glib-2.0",
//Manjaro linux lib args
"-lz",
"-lgtk-3",
"-lgdk-3",
"-lpangocairo-1.0",
"-lpango-1.0",
"-lharfbuzz",
"-latk-1.0",
"-lcairo-gobject",
"-lcairo",
"-lgdk_pixbuf-2.0",
"-lgio-2.0",
"-lgobject-2.0",
"-lglib-2.0",
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}

View File

@ -0,0 +1,32 @@
# Project: gtk53_runner2
# Makefile created by Dev-C++ 6.6
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o resource.o
LINKOBJ = main.o resource.o
LIBS = -L"C:/Dev-Cpp/MinGW64/lib" -L"C:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libstdc++ -static-libgcc -mms-bitfields -lgtk-3 -lgdk-3 -lz -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -mwindows -s
INCS = -I"C:/Dev-Cpp/MinGW64/include" -I"C:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.2.0/include" -I"C:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.2.0/include-fixed" -I"C:/Dev-Cpp/mingw64/include/gtk-3.0" -I"C:/Dev-Cpp/mingw64/include/pango-1.0" -I"C:/Dev-Cpp/mingw64/include" -I"C:/Dev-Cpp/mingw64/include/glib-2.0" -I"C:/Dev-Cpp/mingw64/lib/glib-2.0/include" -I"C:/Dev-Cpp/mingw64/include/harfbuzz" -I"C:/Dev-Cpp/mingw64/include/freetype2" -I"C:/Dev-Cpp/mingw64/include/libpng16" -I"C:/Dev-Cpp/mingw64/include/fribidi" -I"C:/Dev-Cpp/mingw64/include/cairo" -I"C:/Dev-Cpp/mingw64/include/lzo" -I"C:/Dev-Cpp/mingw64/include/pixman-1" -I"C:/Dev-Cpp/mingw64/include/atk-1.0" -I"C:/Dev-Cpp/mingw64/include/gdk-pixbuf-2.0"
CXXINCS = -I"C:/Dev-Cpp/MinGW64/include" -I"C:/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.2.0/include" -I"C:/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/10.2.0/include-fixed" -I"C:/Dev-Cpp/MinGW64/include/c++/10.2.0" -I"C:/Dev-Cpp/MinGW64/include/c++/10.2.0/x86_64-w64-mingw32" -I"C:/Dev-Cpp/MinGW64/include/c++/10.2.0/backward" -I"C:/Dev-Cpp/mingw64/include/gtk-3.0" -I"C:/Dev-Cpp/mingw64/include/pango-1.0" -I"C:/Dev-Cpp/mingw64/include" -I"C:/Dev-Cpp/mingw64/include/glib-2.0" -I"C:/Dev-Cpp/mingw64/lib/glib-2.0/include" -I"C:/Dev-Cpp/mingw64/include/harfbuzz" -I"C:/Dev-Cpp/mingw64/include/freetype2" -I"C:/Dev-Cpp/mingw64/include/libpng16" -I"C:/Dev-Cpp/mingw64/include/fribidi" -I"C:/Dev-Cpp/mingw64/include/cairo" -I"C:/Dev-Cpp/mingw64/include/lzo" -I"C:/Dev-Cpp/mingw64/include/pixman-1" -I"C:/Dev-Cpp/mingw64/include/atk-1.0" -I"C:/Dev-Cpp/mingw64/include/gdk-pixbuf-2.0"
BIN = gtk53_runner2.exe
CXXFLAGS = $(CXXINCS) -O2 -mwindows -pthread
ENCODINGS = -finput-charset=utf-8 -fexec-charset=gbk
CFLAGS = $(INCS) -O2 -mwindows -pthread
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)
main.o: main.cpp
$(CPP) -c main.cpp -o main.o $(CXXFLAGS) $(ENCODINGS)
resource.o: resource.cpp
$(CPP) -c resource.cpp -o resource.o $(CXXFLAGS) $(ENCODINGS)

View File

@ -0,0 +1 @@
glib-compile-resources gtk53.gresource.xml --target=resources.cpp --generate-source

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="gtk53">
<file preprocess="xml-stripblanks">window.ui</file>
</gresource>
</gresources>

View File

@ -0,0 +1,79 @@
[Project]
FileName=gtk53_runner2.dev
Name=gtk53_runner2
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
UseCustomMakefile=0
CustomMakefile=
UsePrecompiledHeader=0
PrecompiledHeader=
CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=3
CompilerSettings=000000a000000000000110000
UseUTF8=1
UnitCount=2
[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1
[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
DetectEncoding=0
Encoding=1
[Unit2]
FileName=resource.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
DetectEncoding=0
Encoding=1

View File

@ -0,0 +1,13 @@
[Editors]
Order=0,1
Focused=0
[Editor_0]
CursorCol=1
CursorRow=17
TopLine=1
LeftChar=1
[Editor_1]
CursorCol=1
CursorRow=1
TopLine=1
LeftChar=1

View File

@ -0,0 +1,38 @@
#include <gtk/gtk.h>
#include <thread>
void run_code(GtkWidget *widget,GtkBuilder *builder){
GObject *window,*check1,*entry;
const char *str;
gboolean flag;
window=gtk_builder_get_object(builder,"window");
check1=gtk_builder_get_object(builder,"check1");
entry=gtk_builder_get_object(builder,"entry");
str=gtk_entry_get_text(GTK_ENTRY(entry));
std::thread first (system,str);
first.detach();
flag=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check1));
if(flag==TRUE) gtk_widget_destroy(GTK_WIDGET(window));
}
static void gtkmain(GtkApplication *app,gpointer user_data){
GtkBuilder *builder=gtk_builder_new_from_resource("/gtk53/window.ui");
GObject *window,*entry,*btnok,*btncancel;
window=gtk_builder_get_object(builder,"window");
gtk_application_add_window(app,GTK_WINDOW(window));
entry=gtk_builder_get_object(builder,"entry");
gtk_entry_set_text(GTK_ENTRY(entry),"cmd");
g_signal_connect(entry,"activate",G_CALLBACK(run_code),builder);
btnok=gtk_builder_get_object(builder,"btnok");
g_signal_connect(btnok,"clicked",G_CALLBACK(run_code),builder);
btncancel=gtk_builder_get_object(builder,"btncancel");
g_signal_connect_swapped(btncancel,"clicked",G_CALLBACK(gtk_widget_destroy),window);
gtk_widget_show_all(GTK_WIDGET(window));
}
int main(int argc,char **argv){
GtkApplication *app;
app=gtk_application_new("org.gtk.daleclack",G_APPLICATION_NON_UNIQUE);
g_signal_connect(app,"activate",G_CALLBACK(gtkmain),NULL);
return g_application_run(G_APPLICATION(app),argc,argv);
}

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow" id="window">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="check1">
<property name="label" translatable="yes">Destroy window on run</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="btncancel">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnok">
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton">
<property name="label" translatable="yes">checkbutton</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>