Skip to content

Commit

Permalink
Solved issues on older GTK3 Ubuntu 12/14/16 build 3744, v.1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
frang75 committed Apr 30, 2022
1 parent 30f218d commit d36da34
Show file tree
Hide file tree
Showing 22 changed files with 562 additions and 301 deletions.
6 changes: 4 additions & 2 deletions prj/CMakeCompilers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

# Warnings
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -std=c99 -fPIE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -fPIE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -std=c++98 -fPIE")

# Host architecture
set(HOST_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
Expand Down Expand Up @@ -296,7 +296,9 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (CMAKE_ARCHITECTURE MATCHES "i386")
set(NAPPGUI_ARCH x86)
set(IDE_PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")

elseif (CMAKE_ARCHITECTURE MATCHES "x64")
set(NAPPGUI_ARCH x64)
set(IDE_PROPERTIES COMPILE_FLAGS "-m64" LINK_FLAGS "-m64")
Expand Down
4 changes: 3 additions & 1 deletion prj/CMakeGCCheckVersion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ macro(checkGCCVersion)
set(GCC_VERSION "gcc8")
elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
set(GCC_VERSION "gcc9")
else()
elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
set(GCC_VERSION "gcc10")
else()
set(GCC_VERSION "gcc11")
endif()

else()
Expand Down
2 changes: 1 addition & 1 deletion prj/CMakeSDKVersion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set(NAPPGUI_MAJOR 1)
set(NAPPGUI_MINOR 2)
set(NAPPGUI_REVISION 1)
set(NAPPGUI_REVISION 2)

# Build version
#------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion prj/build.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3657
3744
25 changes: 0 additions & 25 deletions src/draw2d/gtk3/dctx_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,31 +165,6 @@ void dctx_size(const DCtx *ctx, uint32_t *width, uint32_t *height)
cassert_no_null(ctx);
ptr_assign(width, ctx->width);
ptr_assign(height, ctx->height);

// if (ctx->widget != NULL)
// {
// GtkAllocation alloc;
//
//#if GTK_CHECK_VERSION(3, 20, 0)
// gtk_widget_get_allocated_size(ctx->widget, &alloc, NULL);
//#else
// gtk_widget_get_allocation(ctx->widget, &alloc);
//#endif
// if (width != NULL)
// *width = (real32_t)alloc.width;
//
// if (height != NULL)
// *height = (real32_t)alloc.height;
// }
// else
// {
// cassert(ctx->surface != NULL);
// if (width != NULL)
// *width = (real32_t)cairo_image_surface_get_width(ctx->surface);
//
// if (height != NULL)
// *height = (real32_t)cairo_image_surface_get_height(ctx->surface);
// }
}

/*---------------------------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion src/draw2d/gtk3/osimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static __INLINE bool_t i_is_gif_buffer(const byte_t *data, const uint32_t size)

/*---------------------------------------------------------------------------*/

#if (GDK_PIXBUF_MAJOR < 2 || (GDK_PIXBUF_MAJOR == 2 && GDK_PIXBUF_MINOR < 4))
#if (GDK_PIXBUF_MAJOR < 2 || (GDK_PIXBUF_MAJOR == 2 && GDK_PIXBUF_MINOR < 28))
#include "bfile.h"
#include "hfile.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/osbs/osbs.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ typedef enum _file_seek_t
{
ekSEEKSET = 1,
ekSEEKCUR,
ekSEEKEND,
ekSEEKEND
} file_seek_t;

typedef enum _ferror_t
Expand Down
46 changes: 26 additions & 20 deletions src/osbs/win/bproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,11 @@ bool_t bproc_finish(Proc *proc, uint32_t *code)

/*---------------------------------------------------------------------------*/

bool_t bproc_read(Proc *proc, byte_t *data, const uint32_t size, uint32_t *rsize, perror_t *error)
static bool_t i_read_pipe(HANDLE pipe, byte_t *data, const uint32_t size, uint32_t *rsize, perror_t *error)
{
DWORD lrsize;
BOOL ok;
cassert_no_null(proc);
ok = ReadFile(proc->pipes[STDOUT_READ_PARENT], (LPVOID)data, (DWORD)size, &lrsize, NULL);
ok = ReadFile(pipe, (LPVOID)data, (DWORD)size, &lrsize, NULL);
if (ok == TRUE)
{
if (lrsize > 0)
Expand Down Expand Up @@ -285,21 +284,16 @@ bool_t bproc_read(Proc *proc, byte_t *data, const uint32_t size, uint32_t *rsize

/*---------------------------------------------------------------------------*/

bool_t bproc_read(Proc *proc, byte_t *data, const uint32_t size, uint32_t *rsize, perror_t *error)
{
return i_read_pipe(proc->pipes[STDOUT_READ_PARENT], data, size, rsize, error);
}

/*---------------------------------------------------------------------------*/

bool_t bproc_eread(Proc *proc, byte_t *data, const uint32_t size, uint32_t *rsize, perror_t *error)
{
DWORD lrsize;
BOOL ok;
cassert_no_null(proc);
ok = ReadFile(proc->pipes[STDERR_READ_PARENT], (LPVOID)data, (DWORD)size, &lrsize, NULL);
ptr_assign(rsize, (uint32_t)lrsize);
if (error != NULL)
{
if (ok == TRUE)
*error = ekPOK;
else
*error = ekPPIPE;
}
return (bool_t)ok;
return i_read_pipe(proc->pipes[STDERR_READ_PARENT], data, size, rsize, error);
}

/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -327,16 +321,28 @@ bool_t bproc_write(Proc *proc, const byte_t *data, const uint32_t size, uint32_t

bool_t bproc_read_close(Proc *proc)
{
unref(proc);
return TRUE;
cassert_no_null(proc);
if (proc->pipes[STDOUT_READ_PARENT] != NULL)
{
CloseHandle(proc->pipes[STDOUT_READ_PARENT]);
proc->pipes[STDOUT_READ_PARENT] = NULL;
return TRUE;
}
return FALSE;
}

/*---------------------------------------------------------------------------*/

bool_t bproc_eread_close(Proc *proc)
{
unref(proc);
return TRUE;
cassert_no_null(proc);
if (proc->pipes[STDERR_READ_PARENT] != NULL)
{
CloseHandle(proc->pipes[STDERR_READ_PARENT]);
proc->pipes[STDERR_READ_PARENT] = NULL;
return TRUE;
}
return FALSE;
}

/*---------------------------------------------------------------------------*/
Expand Down
3 changes: 0 additions & 3 deletions src/osgui/gtk3/osbutton.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ OSButton *osbutton_create(const button_flag_t flags)
case ekBTPUSH:
widget = gtk_button_new();
focus_widget = widget;
//_oscontrol_set_css(widget, "button {padding-left:4px;padding-right:4px;padding-top:3px;padding-bottom:3px;min-height:10px;}");
break;

case ekBTFLAT:
Expand Down Expand Up @@ -238,8 +237,6 @@ void osbutton_image(OSButton *button, const Image *image)
{
const char_t *icon_name = _osgui_register_icon(image);
gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(button->control.widget), icon_name);
//GtkWidget *icon = gtk_image_new_from_pixbuf((GdkPixbuf*)image_native(image));
//gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(button->control.widget), icon);
break;
}

Expand Down
Loading

0 comments on commit d36da34

Please sign in to comment.