Closed Bug 337802 Opened 18 years ago Closed 18 years ago

Rollover tracking should not "highlight" the close button if only one tab is visible

Categories

(Camino Graveyard :: Tabbed Browsing, defect)

PowerPC
macOS
defect
Not set
trivial

Tracking

(Not tracked)

VERIFIED FIXED
Camino1.5

People

(Reporter: bugzilla-graveyard, Assigned: aschulm)

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 2 obsolete files)

If "Always Show Tab Bar" is checked in prefs and all tabs but one are closed, mousing over the close box will cause a highlight. This shouldn't happen, since the close box is disabled in that case.

This was caused by the checkin for bug 235864.
This will be easy to fix by just bailing out where appropriate if the button isn't enabled.
Attached patch RolloverImageButton WIP Patch (obsolete) — Splinter Review
Not sure about the neccesarness of the extra #import "RolloverImageButton.h" waiting for trunk to compile to find this out
Comment on attachment 221894 [details] [diff] [review]
RolloverImageButton WIP Patch

>+- (void)setEnabled:inStatus

inStatus needs to be cast as a BOOL.

>@@ -171,21 +180,23 @@
> }
> 
> @end
> 
> @implementation RolloverImageButton (Private)
> 
> - (void)updateImage:(BOOL)inIsInside
> {
>+  if ([self isEnabled]) {
>     if (inIsInside)
>       [super setImage:mHoverImage];
>     else
>       [super setImage:mImage];
>+  }
> }  
> 
> - (BOOL)isMouseInside
> {
>   NSPoint mousePointInWindow = [[self window] convertScreenToBase:[NSEvent mouseLocation]];
>   NSPoint mousePointInView = [[self superview] convertPoint:mousePointInWindow fromView:nil];
>   return NSMouseInRect(mousePointInView, [self frame], NO);
> }

This hunk of the patch failed to apply here. You didn't hand-edit it, did you?

r=me with the above fixes addressed. Please upload a fresh patch when you've fixed it so I can double-check that it applies properly. :)

cl
Attachment #221894 - Flags: review-
It didn't apply because it was -w; the four lines that were shifted to the right changed, but aren't actually shown as such in the patch.

>+      [(RolloverImageButton*)[[[self tabViewItems] objectAtIndex:0] closeButton] setEnabled:initialCloseButtonEnabled];

Why are you adding this cast?  There's nothing specific to your subclass here; setEnabled is part of all NSControls

>+  if ([self isEnabled])
>+    [self updateTrackingRectInSuperview];
>+  else
>+    [self removeTrackingRectFromView:[self superview]];

If a button is disabled while hovered, won't this wedge it in hover mode?
(In reply to comment #4)
> It didn't apply because it was -w; the four lines that were shifted to the
> right changed, but aren't actually shown as such in the patch.
> 
> >+      [(RolloverImageButton*)[[[self tabViewItems] objectAtIndex:0] closeButton] setEnabled:initialCloseButtonEnabled];
> 
> Why are you adding this cast?  There's nothing specific to your subclass here;

There was an issue with a warning issued on this line. This cast seems to get rid of it, but I do not understand why it would be issued at all because closeButton returns an object of type RolloverImageButton*. I will get rid of this cast for now and once my recompile of the trunk finnishes I will add it in.


> 
> >+  if ([self isEnabled])
> >+    [self updateTrackingRectInSuperview];
> >+  else
> >+    [self removeTrackingRectFromView:[self superview]];
> 
> If a button is disabled while hovered, won't this wedge it in hover mode?
> 

Yes it would I will add a line to make sure that the button changes to the default image, good catch.

Patch coming soon


Attached patch RolloverImageButton Patch (obsolete) — Splinter Review
Issues described above are fixed, fixing the warning is more part of Bug #235864, so I will address it in there.

Aaron
Comment on attachment 221928 [details] [diff] [review]
RolloverImageButton Patch

r=me; patch applies cleanly and button doesn't get "stuck" in highlight mode if you close a tab while hovering over the close button on the last remaining tab.
Attachment #221928 - Flags: review+
Comment on attachment 221928 [details] [diff] [review]
RolloverImageButton Patch

> - (void)updateImage:(BOOL)inIsInside
> {
>-  if (inIsInside)
>-    [super setImage:mHoverImage];
>-  else
>-    [super setImage:mImage];
>+  if ([self isEnabled]) {
>+    if (inIsInside)
>+      [super setImage:mHoverImage];
>+    else
>+      [super setImage:mImage];
>+  }
> }

This makes it impossible to change the default image of a disabled button. Only the hover image part should be conditionalized.
Attachment #221928 - Flags: review-
Great find smorgan, as always.
Attachment #221894 - Attachment is obsolete: true
Attachment #221928 - Attachment is obsolete: true
Attachment #222102 - Flags: review?(smorgan)
Comment on attachment 222102 [details] [diff] [review]
RolloverImageButton Patch

Setting r flag to proper reviewer.

cl
Attachment #222102 - Flags: review?(smorgan) → review?(stuart.morgan)
Comment on attachment 222102 [details] [diff] [review]
RolloverImageButton Patch

r=me
Attachment #222102 - Flags: superreview?
Attachment #222102 - Flags: review?(stuart.morgan)
Attachment #222102 - Flags: review+
Comment on attachment 222102 [details] [diff] [review]
RolloverImageButton Patch

Targeting Pink for SR
Attachment #222102 - Flags: superreview? → superreview?(mikepinkerton)
Comment on attachment 222102 [details] [diff] [review]
RolloverImageButton Patch

sr=pink
Attachment #222102 - Flags: superreview?(mikepinkerton) → superreview+
Checked in
Status: NEW → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
hey, why is the close box disabled anyway, when we have just one tab? why not just have = red gumdrop?
Whiteboard: [needs checkin]
Verified on 1.8 branch and trunk
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: