Ticket #10792: 0001-Fix-for-my-previous-patch-default-button-shouldn-t-b.patch

File 0001-Fix-for-my-previous-patch-default-button-shouldn-t-b.patch, 1.4 KB (added by KapiX, 10 years ago)
  • src/kits/interface/Window.cpp

    From 8ade0bf99a383f83d53adbddbeae0d98f4f71bae Mon Sep 17 00:00:00 2001
    From: Kacper Kasper <kacperkasper@gmail.com>
    Date: Mon, 28 Apr 2014 15:17:02 +0000
    Subject: [PATCH] Fix for my previous patch
    
    * Default button shouldn't be invoked only when another button
    is focused.
    
    Sorry about the fuss.
    ---
     src/kits/interface/Window.cpp | 6 ++++--
     1 file changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp
    index f315dac..f26708b 100644
    a b  
    2828#include <MessageQueue.h>
    2929#include <MessageRunner.h>
    3030#include <Path.h>
     31#include <PictureButton.h>
    3132#include <PropertyInfo.h>
    3233#include <Roster.h>
    3334#include <Screen.h>
    BWindow::_DetermineTarget(BMessage* message, BHandler* target)  
    32883289        {
    32893290            // if we have a default button, it might want to hear
    32903291            // about pressing the <enter> key, but it shouldn't
    3291             // intercept it if another BControl is focused
     3292            // intercept it if another B*Button is focused
    32923293            int32 rawChar;
    32933294            if (DefaultButton() != NULL
    3294                 && dynamic_cast<BControl*>(CurrentFocus()) == NULL
     3295                && dynamic_cast<BButton*>(CurrentFocus()) == NULL
     3296                && dynamic_cast<BPictureButton*>(CurrentFocus()) == NULL
    32953297                && message->FindInt32("raw_char", &rawChar) == B_OK
    32963298                && rawChar == B_ENTER)
    32973299                return DefaultButton();