Compare commits
4 Commits
master
...
khorben/gt
Author | SHA1 | Date | |
---|---|---|---|
dabebc55e8 | |||
b76e6562bd | |||
9ecac417e4 | |||
ef57d933d1 |
1
data/gtk4/.gitignore
vendored
Normal file
1
data/gtk4/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/libDesktop.pc
|
11
data/gtk4/libDesktop.pc.in
Normal file
11
data/gtk4/libDesktop.pc.in
Normal file
|
@ -0,0 +1,11 @@
|
|||
prefix=@PREFIX@
|
||||
includedir=${prefix}/include
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: @PACKAGE@
|
||||
Description: DeforaOS Desktop helper library
|
||||
Version: @VERSION@
|
||||
Requires: libSystem gtk4-x11
|
||||
Cflags: -I${includedir}
|
||||
Libs: @RPATH@ -L${libdir} -lDesktop
|
9
data/gtk4/project.conf
Normal file
9
data/gtk4/project.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
targets=libDesktop.pc
|
||||
dist=Makefile,libDesktop.pc.in
|
||||
|
||||
#targets
|
||||
[libDesktop.pc]
|
||||
type=script
|
||||
script=../pkgconfig.sh
|
||||
depends=libDesktop.pc.in,../../config.sh
|
||||
install=
|
|
@ -1,6 +1,6 @@
|
|||
subdirs=gtk3
|
||||
dist=Makefile,pkgconfig.sh
|
||||
mode=gtk3-debug
|
||||
mode=gtk4-debug
|
||||
|
||||
#modes
|
||||
[mode::gtk2-debug]
|
||||
|
@ -8,3 +8,9 @@ subdirs=gtk2
|
|||
|
||||
[mode::gtk2-release]
|
||||
subdirs=gtk2
|
||||
|
||||
[mode::gtk4-debug]
|
||||
subdirs=gtk4
|
||||
|
||||
[mode::gtk4-release]
|
||||
subdirs=gtk4
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2009-2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -41,6 +41,10 @@ typedef struct _DesktopAccel
|
|||
unsigned int accel;
|
||||
} DesktopAccel;
|
||||
|
||||
# if GTK_CHECK_VERSION(4, 0, 0)
|
||||
typedef void GtkAccelGroup;
|
||||
# endif
|
||||
|
||||
|
||||
/* functions */
|
||||
void desktop_accel_create(DesktopAccel const * accel, gpointer data,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2011-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2011-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -107,8 +107,29 @@
|
|||
# define GDK_KEY_uparrow GDK_uparrow
|
||||
# endif
|
||||
|
||||
/* Gtk+ 4.0 */
|
||||
# if GTK_CHECK_VERSION(4, 0, 0)
|
||||
void gtk_box_pack_end(GtkBox * box, GtkWidget * child,
|
||||
gboolean fill, gboolean expand, gint padding);
|
||||
void gtk_box_pack_start(GtkBox * box, GtkWidget * child,
|
||||
gboolean fill, gboolean expand, gint padding);
|
||||
|
||||
# define GTK_CONTAINER(a) GTK_WIDGET(a)
|
||||
void gtk_container_add(GtkWidget * container, GtkWidget * child);
|
||||
|
||||
# define GTK_ICON_LOOKUP_USE_BUILTIN 0
|
||||
# define GTK_ICON_LOOKUP_GENERIC_FALLBACK 0
|
||||
GdkPixbuf * gtk_icon_theme_load_icon(GtkIconTheme * theme, char const * name,
|
||||
GtkIconSize size, guint flags, gpointer data);
|
||||
|
||||
void gtk_main(void);
|
||||
|
||||
# define GTK_STOCK_DIRECTORY "gtk-directory"
|
||||
# define GTK_STOCK_FILE "gtk-file"
|
||||
# define GTK_STOCK_MISSING_IMAGE "gtk-missing-image"
|
||||
|
||||
# elif !GTK_CHECK_VERSION(3, 0, 0)
|
||||
/* Gtk+ 3.0 */
|
||||
# if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
/* types */
|
||||
typedef struct _GdkRGBA
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2009-2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -31,6 +31,8 @@
|
|||
#ifndef LIBDESKTOP_DESKTOP_TOOLBAR_H
|
||||
# define LIBDESKTOP_DESKTOP_TOOLBAR_H
|
||||
|
||||
# include "accel.h"
|
||||
|
||||
|
||||
/* Toolbar */
|
||||
/* types */
|
||||
|
@ -41,7 +43,11 @@ typedef struct _DesktopToolbar
|
|||
const char * stock;
|
||||
GdkModifierType modifier;
|
||||
unsigned int accel;
|
||||
# if GTK_CHECK_VERSION(4, 0, 0)
|
||||
GtkWidget * widget;
|
||||
# else
|
||||
GtkToolItem * widget;
|
||||
# endif
|
||||
} DesktopToolbar;
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
|
38
src/compat.c
38
src/compat.c
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2012-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -28,13 +28,41 @@
|
|||
|
||||
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#if GTK_CHECK_VERSION(4, 0, 0)
|
||||
# include <gdk/x11/gdkx.h>
|
||||
#else
|
||||
# include <gdk/gdkx.h>
|
||||
#endif
|
||||
#include "Desktop.h"
|
||||
|
||||
|
||||
/* Compat */
|
||||
#if GTK_CHECK_VERSION(4, 0, 0)
|
||||
/* Gtk+ 4 */
|
||||
/* gtk_icon_theme_load_icon */
|
||||
GdkPixbuf * gtk_icon_theme_load_icon(GtkIconTheme * theme, char const * name,
|
||||
GtkIconSize size, guint flags, gpointer data)
|
||||
{
|
||||
GtkWidget * image;
|
||||
(void) theme;
|
||||
|
||||
image = gtk_image_new_from_icon_name(name);
|
||||
gtk_image_set_icon_size(GTK_IMAGE(image), size);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
/* gtk_main */
|
||||
void gtk_main(void)
|
||||
{
|
||||
while(g_list_model_get_n_items(gtk_window_get_toplevels()) > 0)
|
||||
g_main_context_iteration(NULL, TRUE);
|
||||
}
|
||||
|
||||
|
||||
#elif GTK_CHECK_VERSION(3, 0, 0)
|
||||
/* Gtk+ 3 */
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
/* gdk_window_clear */
|
||||
void gdk_window_clear(GdkWindow * window)
|
||||
{
|
||||
|
@ -47,10 +75,10 @@ void gdk_window_clear(GdkWindow * window)
|
|||
XClearWindow(display, wid);
|
||||
gdk_error_trap_pop();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
#elif GTK_CHECK_VERSION(2, 0, 0)
|
||||
/* Gtk+ 2.0 */
|
||||
/* gtk_box_new */
|
||||
GtkWidget * gtk_box_new(GtkOrientation orientation, gint spacing)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2009-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2011-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -37,7 +37,9 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <gtk/gtk.h>
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
#if GTK_CHECK_VERSION(4, 0, 0)
|
||||
# include <gdk/x11/gdkx.h>
|
||||
#elif GTK_CHECK_VERSION(3, 0, 0)
|
||||
# include <gtk/gtkx.h>
|
||||
#else
|
||||
# include <gdk/gdkx.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2011-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2011-2021 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS libDesktop */
|
||||
/* All rights reserved.
|
||||
*
|
||||
|
@ -110,7 +110,12 @@ Mime * mime_new(GtkIconTheme * theme)
|
|||
if((mime = object_new(sizeof(*mime))) == NULL)
|
||||
return NULL;
|
||||
if(theme == NULL)
|
||||
#if GTK_CHECK_VERSION(4, 0, 0)
|
||||
theme = gtk_icon_theme_get_for_display(
|
||||
gdk_display_get_default());
|
||||
#else
|
||||
theme = gtk_icon_theme_get_default();
|
||||
#endif
|
||||
mime->theme = theme;
|
||||
for(g = globs2; *g != NULL; g++)
|
||||
if((fp = fopen(*g, "r")) != NULL)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
targets=libDesktop
|
||||
cppflags_force=-I ../include
|
||||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11` -fPIC
|
||||
cflags_force=`pkg-config --cflags libSystem gtk4-x11` -fPIC
|
||||
cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11`
|
||||
ldflags_force=`pkg-config --libs libSystem gtk4-x11`
|
||||
ldflags=-Wl,-z,relro -Wl,-z,now
|
||||
dist=Makefile,mimehandler.h
|
||||
mode=gtk3-debug
|
||||
mode=gtk4-debug
|
||||
|
||||
#modes
|
||||
[mode::gtk2-debug]
|
||||
|
@ -18,9 +18,21 @@ cflags_force=`pkg-config --cflags libSystem gtk+-2.0` -fPIC
|
|||
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-2.0`
|
||||
|
||||
[mode::gtk3-debug]
|
||||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11` -fPIC
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11`
|
||||
|
||||
[mode::gtk3-release]
|
||||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11` -fPIC
|
||||
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11`
|
||||
|
||||
[mode::gtk4-release]
|
||||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags_force=`pkg-config --cflags libSystem gtk4-x11` -fPIC
|
||||
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk4-x11`
|
||||
|
||||
#targets
|
||||
[libDesktop]
|
||||
|
|
|
@ -5,7 +5,7 @@ ldflags=-pie -Wl,-z,relro -Wl,-z,now
|
|||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11`
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11` $(OBJDIR)../src/libDesktop.a
|
||||
dist=Makefile,applications/Root.desktop,applications/Widget.desktop,clint.sh,fixme.sh,htmllint.sh,pkgconfig.sh,tests.sh,xmllint.sh
|
||||
mode=gtk3-debug
|
||||
mode=gtk4-debug
|
||||
|
||||
#modes
|
||||
[mode::gtk2-debug]
|
||||
|
@ -22,6 +22,16 @@ ldflags_force=`pkg-config --libs libSystem gtk+-2.0` $(OBJDIR)../src/libDesktop.
|
|||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
|
||||
[mode::gtk4-debug]
|
||||
cflags_force=`pkg-config --cflags libSystem gtk4`
|
||||
ldflags_force=`pkg-config --libs libSystem gtk4` $(OBJDIR)../src/libDesktop.a
|
||||
|
||||
[mode::gtk4-release]
|
||||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags_force=`pkg-config --cflags libSystem gtk4`
|
||||
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk4` $(OBJDIR)../src/libDesktop.a
|
||||
|
||||
#targets
|
||||
[clint.log]
|
||||
type=script
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
targets=widget
|
||||
cppflags_force=-I ../include
|
||||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11`
|
||||
cflags_force=`pkg-config --cflags libSystem gtk4-x11`
|
||||
cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11` -L $(OBJDIR)../src -lDesktop
|
||||
ldflags_force=`pkg-config --libs libSystem gtk4-x11` -L $(OBJDIR)../src -lDesktop
|
||||
ldflags=-pie -Wl,-z,relro -Wl,-z,now
|
||||
dist=Makefile,subst.sh
|
||||
mode=gtk3-debug
|
||||
mode=gtk4-debug
|
||||
|
||||
#modes
|
||||
[mode::gtk2-debug]
|
||||
|
@ -18,9 +18,19 @@ cflags_force=`pkg-config --cflags libSystem gtk+-2.0`
|
|||
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-2.0` -L $(OBJDIR)../src -lDesktop
|
||||
|
||||
[mode::gtk3-debug]
|
||||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11`
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11` -L $(OBJDIR)../src -lDesktop
|
||||
|
||||
[mode::gtk3-release]
|
||||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags_force=`pkg-config --cflags libSystem gtk+-3.0 x11`
|
||||
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem gtk+-3.0 x11` -L $(OBJDIR)../src -lDesktop
|
||||
|
||||
[mode::gtk4-release]
|
||||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
|
||||
#targets
|
||||
[widget]
|
||||
|
|
|
@ -142,7 +142,7 @@ int main(int argc, char * argv[])
|
|||
|
||||
memset(&prefs, 0, sizeof(prefs));
|
||||
#if GTK_CHECK_VERSION(4, 0, 0)
|
||||
gtk_init(&argc, &argv);
|
||||
gtk_init();
|
||||
#else
|
||||
gtk_init(&argc, &argv);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user