Bug 699907 - dxmain.c: Can't use gtk_widget_get_allocated_width() with GTK+2
Summary: dxmain.c: Can't use gtk_widget_get_allocated_width() with GTK+2
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 9.25
Hardware: PC Linux
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-07 22:29 UTC by DC
Modified: 2018-10-08 08:35 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DC 2018-10-07 22:29:16 UTC
It looks like you recently added GTK+ 3 support to Ghostscript. In psi/dxmain.c, most of the calls to GTK+ 3 functions are guarded with with GTK_CHECK_VERSION(3, 0, 0). But in the function window_resize(), there's an unconditional call to:

  width = gtk_widget_get_allocated_width (img->window) - 96;
  height = gtk_widget_get_allocated_height (img->window) - 96;

I don't think those functions are available in GTK+ 2.

When I try to build Ghostscript from source on Linux with GTK+2, I get the errors:

./psi/dxmain.c: In function 'window_resize':
./psi/dxmain.c:363:17: warning: implicit declaration of function 'gtk_widget_get_allocated_width'; did you mean 'gtk_widget_get_allocation'? [-Wimplicit-function-declaration]
./psi/dxmain.c:364:18: warning: implicit declaration of function 'gtk_widget_get_allocated_heigh '; did you mean 'gtk_widget_get_allocation'? [-Wimplicit-function-declaration]

./soobj/dxmain.o: In function `window_resize':
dxmain.c:(.text+0x907): undefined reference to `gtk_widget_get_allocated_width'
dxmain.c:(.text+0x914): undefined reference to `gtk_widget_get_allocated_height'
collect2: error: ld returned 1 exit status
Comment 1 Chris Liddell (chrisl) 2018-10-08 08:35:39 UTC
Fixed in:
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=a73071b87a61


Actually, GTK 3.x.x support was added about 6 years ago (basically when GTK 2.x.x became deprecated and unsupported), this recent change was to address deprecated API calls in the 3.x.x API.

GTK+ 2.x.x is likely to be dropped at some point - particularly given that GTK2 development appears to have stopped ~2 years ago (and was minimal for quite some time before that).