Opened 9 years ago

Closed 8 years ago

#50873 closed defect (fixed)

Dia canvas has incoherent colors in Quartz

Reported by: m.rick@… Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port: dia

Description

When using Dia with Quartz, the canvas has strange incoherent colors. The colors can change, but the canvas should be a white background with light grey lines. The bugs only occurs with Quartz, not with X11.

Attachments (3)

Capture d’écran 2016-03-11 à 14.32.24.png (52.6 KB) - added by m.rick@… 9 years ago.
The buggy canvas with wrong colors
Capture d’écran 2016-03-11 à 14.32.55.png (37.7 KB) - added by m.rick@… 9 years ago.
Dia running normally under X11
Capture d’écran 2016-03-12 à 21.43.28.png (71.5 KB) - added by m.rick@… 9 years ago.

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by m.rick@…

The buggy canvas with wrong colors

Changed 9 years ago by m.rick@…

Dia running normally under X11

comment:1 Changed 9 years ago by dbevans (David B. Evans)

Cc: devans@… removed
Owner: changed from macports-tickets@… to devans@…
Status: newassigned

Yes, I can reproduce this issue.

Dia was originally an X11 only app but now will build with gtk2 +quartz as all the X11 specific gtk/gdk code has been removed in the current version. So in principle, it should work with a +quartz build but at least one upstream developer has admitted that there are still issues with +quartz builds.

In this case, the clue to what's going on is in the following console messages that are displayed repeatedly

(dia:67675): Gdk-CRITICAL **: gdk_colormap_alloc_colors: assertion 'GDK_IS_COLORMAP (colormap)' failed
** (dia:67675): WARNING **: color_convert failed.

Dia implements it's own definition of what a color is, but these colors need to be converted to GdkColors to display properly. color_convert() performs this conversion but fails on +quartz builds resulting in resulting in the problem described. The actual failure is in the gdk function gdk_colormap_alloc_colors() which attempts to allocate a new color in the default visual's colormap. The error says that the colormap passed to this function is not a valid colormap of type GdkColormap. It then returns with no color allocated. Hence the problem.

This function is implemented in a backend specific ways for X11, Quartz and Windows so should theoretically work on all backends.

I also see errors of the type

(dia:67675): Gdk-WARNING **: Source with depth 1 unsupported

so it may be that the code that initially creates the colormap is using an invalid/unsupported visual type. But this is just a quess.

As I have time available, I'll try to pinpoint the root cause and report it upstream. In the meantime, you're probably better off using the X11 build.

Sorry for not having a better answer right now.

comment:2 Changed 9 years ago by m.rick@…

I made a try and got a strange result:

I compiled Murrine Engine for GTK2 and then used Adawaita GTK2 and made a GTK RC file to tell Dia to load the Adawaita theme.

It partially corrected the colors troubles and I got the correct white canvas.

But if I try to insert an object from the library, Dia will hang.

I get this error too (just like you):

(dia:7772): Gdk-CRITICAL **: gdk_colormap_alloc_colors: assertion 'GDK_IS_COLORMAP (colormap)' failed
Last edited 9 years ago by m.rick@… (previous) (diff)

Changed 9 years ago by m.rick@…

comment:3 in reply to:  2 Changed 9 years ago by dbevans (David B. Evans)

Replying to m.rick@…:

I made a try and got a strange result:

I compiled Murrine Engine for GTK2 and then used Adawaita GTK2 and made a GTK RC file to tell Dia to load the Adawaita theme.

It partially corrected the colors troubles and I got the correct white canvas.

I'm not sure of the need for the Murrine Engine here. gnome-themes-standard provides both gtk2 and gtk3 engines as well as the Adwaita icon theme and gnome-backgrounds in a single package.

comment:4 Changed 9 years ago by dbevans (David B. Evans)

I've added a +quartz variant in r146599. This doesn't help the problem here but allows tracking of whether the port is built with X11 or Quartz.

If you have a version built with +quartz, just install dia +quartz to install a new version with the variant attached and uninstall the old version. From now on if there is no variant, it is a X11 build.

comment:5 Changed 8 years ago by g5pw (Aljaž Srebrnič)

Hey, I have a patch for this, can you test this and see if it solves the issue?

comment:6 Changed 8 years ago by g5pw (Aljaž Srebrnič)

Resolution: fixed
Status: assignedclosed

In 1f6690f1/macports-ports:

dia: fix colors with +quartz variant

Apply fix to both +x11 and +quartz variants. Rebuild.

Closes: #50873

Note: See TracTickets for help on using tickets.