# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1672784588 0 # Node ID 0577a97fe36d99f7ed83594b62e4875bc6a214ef # Parent a1d0522d7edf7d1dfd6497861851c68a963b6084 Added dw_pixmap_get_width() and dw_pixmap_get_height() by request for language bindings. These APIs function identical to the already existing DW_PIXMAP_HEIGHT/WIDTH() macros. The macros will exist at least until the end of the 3.x series, at which point they may be retired. diff -r a1d0522d7edf -r 0577a97fe36d android/dw.cpp --- a/android/dw.cpp Mon Jan 02 21:41:27 2023 +0000 +++ b/android/dw.cpp Tue Jan 03 22:23:08 2023 +0000 @@ -4989,6 +4989,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d debian/changelog --- a/debian/changelog Mon Jan 02 21:41:27 2023 +0000 +++ b/debian/changelog Tue Jan 03 22:23:08 2023 +0000 @@ -18,9 +18,12 @@ * Added variadic versions of dw_debug() and dw_messagebox(). This is how the standard library does it so we can call the new va_list versions from C++: dw_vdebug() and dw_vmessagebox(). + * Added dw_pixmap_get_height() and dw_pixmap_get_width() APIs to + replace the DW_PIXMAP_HEIGHT() and DW_PIXMAP_WIDTH() macros. + This allows non-C bindings to call them directly. -- Brian Smith Fri, 6 Jan 2023 08:00:00 +1000 - + dwindows (3.2-1) unstable; urgency=low * Added support for initial beta support for GTK 4. --with-gtk4 is now available. @@ -45,7 +48,7 @@ * Fixed a bug in dw_listbox_set_text() on GTK3. -- Brian Smith Thu, 6 Jan 2022 08:00:00 +1000 - + dwindows (3.1-1) unstable; urgency=low * Added notification APIs: dw_notification_new() dw_notification_send() dw_app_id_set() diff -r a1d0522d7edf -r 0577a97fe36d dw.h --- a/dw.h Mon Jan 02 21:41:27 2023 +0000 +++ b/dw.h Tue Jan 03 22:23:08 2023 +0000 @@ -2187,6 +2187,8 @@ void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color ); int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname); void API dw_pixmap_destroy(HPIXMAP pixmap); +unsigned long dw_pixmap_get_width(HPIXMAP pixmap); +unsigned long dw_pixmap_get_height(HPIXMAP pixmap); void API dw_beep(int freq, int dur); void API dw_debug(const char *format, ...); void API dw_vdebug(const char *format, va_list args); diff -r a1d0522d7edf -r 0577a97fe36d dw.hpp --- a/dw.hpp Mon Jan 02 21:41:27 2023 +0000 +++ b/dw.hpp Tue Jan 03 22:23:08 2023 +0000 @@ -924,14 +924,14 @@ } Pixmap(Render *window, const char *filename) { SetHPIXMAP(dw_pixmap_new_from_file(window ? window->GetHWND() : DW_NOHWND, filename)); - pwidth = hpixmap ? DW_PIXMAP_WIDTH(hpixmap) : 0; - pheight = hpixmap ? DW_PIXMAP_HEIGHT(hpixmap) : 0; + pwidth = dw_pixmap_get_width(hpixmap); + pheight = dw_pixmap_get_height(hpixmap); hpmprot = false; } Pixmap(HPIXMAP hpm) { SetHPIXMAP(hpm); - pwidth = hpixmap ? DW_PIXMAP_WIDTH(hpixmap) : 0; - pheight = hpixmap ? DW_PIXMAP_HEIGHT(hpixmap) : 0; + pwidth = dw_pixmap_get_width(hpixmap); + pheight = dw_pixmap_get_height(hpixmap); hpmprot = true; } // Destructor diff -r a1d0522d7edf -r 0577a97fe36d gtk/dw.c --- a/gtk/dw.c Mon Jan 02 21:41:27 2023 +0000 +++ b/gtk/dw.c Tue Jan 03 22:23:08 2023 +0000 @@ -9359,7 +9359,7 @@ * pixmap: Handle to a pixmap returned by * dw_pixmap_new.. */ -void dw_pixmap_destroy(HPIXMAP pixmap) +void API dw_pixmap_destroy(HPIXMAP pixmap) { int _dw_locked_by_me = FALSE; @@ -9373,6 +9373,24 @@ DW_MUTEX_UNLOCK; } +/* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + #if GTK_CHECK_VERSION(2,10,0) /* Cairo version of dw_pixmap_bitblt() from GTK3, use if either pixmap is a cairo surface */ int _dw_cairo_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) diff -r a1d0522d7edf -r 0577a97fe36d gtk3/dw.c --- a/gtk3/dw.c Mon Jan 02 21:41:27 2023 +0000 +++ b/gtk3/dw.c Tue Jan 03 22:23:08 2023 +0000 @@ -8220,7 +8220,7 @@ * pixmap: Handle to a pixmap returned by * dw_pixmap_new.. */ -void dw_pixmap_destroy(HPIXMAP pixmap) +void API dw_pixmap_destroy(HPIXMAP pixmap) { int _dw_locked_by_me = FALSE; @@ -8234,6 +8234,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d gtk4/dw.c --- a/gtk4/dw.c Mon Jan 02 21:41:27 2023 +0000 +++ b/gtk4/dw.c Tue Jan 03 22:23:08 2023 +0000 @@ -7352,6 +7352,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d ios/dw.m --- a/ios/dw.m Mon Jan 02 21:41:27 2023 +0000 +++ b/ios/dw.m Tue Jan 03 22:23:08 2023 +0000 @@ -8386,7 +8386,7 @@ * pixmap: Handle to a pixmap returned by * dw_pixmap_new.. * color: transparent color - * Note: This does nothing on Mac as transparency + * Note: This does nothing on iOS as transparency * is handled automatically */ void API dw_pixmap_set_transparent_color(HPIXMAP pixmap, ULONG color) @@ -8485,6 +8485,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d mac/dw.m --- a/mac/dw.m Mon Jan 02 21:41:27 2023 +0000 +++ b/mac/dw.m Tue Jan 03 22:23:08 2023 +0000 @@ -9206,6 +9206,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d os2/dw.c --- a/os2/dw.c Mon Jan 02 21:41:27 2023 +0000 +++ b/os2/dw.c Tue Jan 03 22:23:08 2023 +0000 @@ -11473,6 +11473,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d os2/dw.def --- a/os2/dw.def Mon Jan 02 21:41:27 2023 +0000 +++ b/os2/dw.def Tue Jan 03 22:23:08 2023 +0000 @@ -240,6 +240,8 @@ dw_pixmap_set_transparent_color @346 dw_pixmap_set_font @347 dw_pixmap_stretch_bitblt @348 + dw_pixmap_get_width @355 + dw_pixmap_get_height @356 dw_dialog_new @350 dw_dialog_dismiss @351 diff -r a1d0522d7edf -r 0577a97fe36d os2/dw.lnk --- a/os2/dw.lnk Mon Jan 02 21:41:27 2023 +0000 +++ b/os2/dw.lnk Tue Jan 03 22:23:08 2023 +0000 @@ -233,6 +233,8 @@ export dw_pixmap_set_transparent_color.346 export dw_pixmap_set_font.347 export dw_pixmap_stretch_bitblt.348 +export dw_pixmap_get_width.355 +export dw_pixmap_get_height.356 export dw_dialog_new.350 export dw_dialog_dismiss.351 diff -r a1d0522d7edf -r 0577a97fe36d readme.txt --- a/readme.txt Mon Jan 02 21:41:27 2023 +0000 +++ b/readme.txt Tue Jan 03 22:23:08 2023 +0000 @@ -88,6 +88,9 @@ Added variadic versions of dw_debug() and dw_messagebox(). This is how the standard library does it so we can call the new va_list versions from C++: dw_vdebug() and dw_vmessagebox(). +Added dw_pixmap_get_height() and dw_pixmap_get_width() APIs to + replace the DW_PIXMAP_HEIGHT() and DW_PIXMAP_WIDTH() macros. + This allows non-C bindings to call them directly. Added support for MacOS 13 Ventura and iOS 16. Dynamic Windows Documentation is available at: diff -r a1d0522d7edf -r 0577a97fe36d template/dw.c --- a/template/dw.c Mon Jan 02 21:41:27 2023 +0000 +++ b/template/dw.c Tue Jan 03 22:23:08 2023 +0000 @@ -2250,6 +2250,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d win/dw.c --- a/win/dw.c Mon Jan 02 21:41:27 2023 +0000 +++ b/win/dw.c Tue Jan 03 22:23:08 2023 +0000 @@ -11999,6 +11999,24 @@ } /* + * Returns the width of the pixmap, same as the DW_PIXMAP_WIDTH() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_width(HPIXMAP pixmap) +{ + return pixmap ? pixmap->width : 0; +} + +/* + * Returns the height of the pixmap, same as the DW_PIXMAP_HEIGHT() macro, + * but exported as an API, for non-C language bindings. + */ +unsigned long API dw_pixmap_get_height(HPIXMAP pixmap) +{ + return pixmap ? pixmap->height : 0; +} + +/* * Copies from one item to another. * Parameters: * dest: Destination window handle. diff -r a1d0522d7edf -r 0577a97fe36d win/dw.def --- a/win/dw.def Mon Jan 02 21:41:27 2023 +0000 +++ b/win/dw.def Tue Jan 03 22:23:08 2023 +0000 @@ -238,6 +238,8 @@ dw_pixmap_set_transparent_color @346 dw_pixmap_set_font @347 dw_pixmap_stretch_bitblt @348 + dw_pixmap_get_width @355 + dw_pixmap_get_height @356 dw_dialog_new @350 dw_dialog_dismiss @351