"oclock" ignores colors for hands when transparent

Bug #1244889 reported by Tamotsu TAKAHASHI
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
x11-apps (Ubuntu)
New
Undecided
Unassigned

Bug Description

[reproduced on Precise]
[any versions of x11-apps have this bug]

"oclock -fg yellow -hour white -minute red -jewel blue -transparent"
makes hour-hand, minute-hand and jewel _red_ (the color only for minute-hand)
although
"oclock -fg yellow -hour white -minute red -jewel blue"
(without "-transparent") works fine.

i.e.
[expected] "oclock -transparent -hour red" paints its hour-hand red.
[actual result] The hour-hand is not red.

[cause] The code simplifies the routine too much when transparent, I guess. (though I'm not a programmer.)
If oclock is transparent, it apparently uses shapeGC to specify its non-transparent shape.
I guess it should also paint hourGC and minuteGC _over_ the shape.

[patch] (Maybe the last chunk is unnecessary. It seems that oclock works fine with or without it.)

diff -bpu oclock/Clock.c{.orig,}
--- oclock/Clock.c.orig 2012-08-17 05:30:57.000000000 +0900
+++ oclock/Clock.c 2013-10-26 16:10:18.804424872 +0900
@@ -152,12 +152,6 @@ static void Initialize (Widget greq, Wid

     valuemask = GCForeground;

- if (w->clock.transparent)
- {
- ;
- }
- else
- {
        myXGCV.foreground = w->clock.minute;
        w->clock.minuteGC = XtGetGC(gnew, valuemask, &myXGCV);

@@ -169,7 +163,6 @@ static void Initialize (Widget greq, Wid

        myXGCV.foreground = w->core.background_pixel;
        w->clock.eraseGC = XtGetGC(gnew, valuemask, &myXGCV);
- }

     /* wait for Realize to add the timeout */
     w->clock.interval_id = 0;
@@ -371,12 +364,10 @@ static void Destroy (Widget gw)
 {
      ClockWidget w = (ClockWidget)gw;
      if (w->clock.interval_id) XtRemoveTimeOut (w->clock.interval_id);
- if (! w->clock.transparent) {
         XtReleaseGC(gw, w->clock.minuteGC);
         XtReleaseGC(gw, w->clock.hourGC);
         XtReleaseGC(gw, w->clock.jewelGC);
         XtReleaseGC(gw, w->clock.eraseGC);
- }
      if (w->clock.shapeGC)
        XFreeGC(XtDisplay(gw), w->clock.shapeGC);
     if (w->clock.shape_mask)

@@ -389,11 +380,8 @@ static void Redisplay(Widget gw, XEvent
     ClockWidget w;

     w = (ClockWidget) gw;
- if (!w->clock.transparent)
- {
        paint_jewel (w, XtWindow (w), w->clock.jewelGC);
        paint_hands (w, XtWindow (w), w->clock.minuteGC, w->clock.hourGC);
- }
 }

 /*
@@ -425,7 +413,6 @@ static void new_time (XtPointer client_d
        Time_t now;
        struct tm *tm;

- if (!w->clock.transparent)
        if (w->clock.polys_valid) {
                paint_hands (w, XtWindow (w), w->clock.eraseGC, w->clock.eraseGC);
                check_jewel (w, XtWindow (w), w->clock.jewelGC);
@@ -449,7 +436,6 @@ static void new_time (XtPointer client_d
        compute_hands (w);
        if (w->clock.transparent)
            Resize ((Widget)w);
- else
            paint_hands (w, XtWindow (w), w->clock.minuteGC, w->clock.hourGC);
 } /* new_time */

Tags: patch
Revision history for this message
Tamotsu TAKAHASHI (ttakah+ubuntu) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "redraw hands and jewel over shape" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.