Add gtk52

This commit is contained in:
daleclack 2021-03-28 08:29:39 +08:00
parent d6ce14eec9
commit 1a25d00e0b
8 changed files with 314 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/gtk52_runner/.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/gtk52",
"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/gtk52_runner/.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/gtk52",
"-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,29 @@
# Project: gtk52_runner
# Makefile created by Dev-C++ 6.6
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.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 = gtk52_runner.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)

View File

@ -0,0 +1,67 @@
[Project]
FileName=gtk52_runner.dev
Name=gtk52_runner
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=1
[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=1.0.0.0
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
AutoIncBuildNr=0
SyncProduct=1
[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
DetectEncoding=0
Encoding=1

View File

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

View File

@ -0,0 +1,36 @@
#include <gtk/gtk.h>
#include <thread>
void run_code(GtkWidget *widget,GtkEntry *entry){
//Get text and run a app
const char *str;
str=gtk_entry_get_text(entry);
std::thread first (system,str);
first.detach();
}
static void gtkmain(GtkApplication *app,gpointer user_data){
GtkWidget *window,*vbox,*entry,*btn_run;
//Create a new window
window=gtk_application_window_new(app);
gtk_window_set_default_size(GTK_WINDOW(window),300,100);
gtk_window_set_icon_name(GTK_WINDOW(window),"org.gtk.daleclack");
//Pack Widgets
vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
entry=gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry),"cmd");
g_signal_connect(entry,"activate",G_CALLBACK(run_code),entry);
gtk_box_pack_start(GTK_BOX(vbox),entry,FALSE,FALSE,0);
btn_run=gtk_button_new_with_label("Run");
g_signal_connect(btn_run,"clicked",G_CALLBACK(run_code),entry);
gtk_box_pack_start(GTK_BOX(vbox),btn_run,FALSE,FALSE,0);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_widget_show_all(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);
}