View Issue Details

IDProjectCategoryView StatusLast Update
0023950FPCPackagespublic2019-07-17 17:34
ReporterKeith BowesAssigned ToMarco van de Voort 
PrioritynormalSeverityminorReproducibilityalways
Status feedbackResolutionopen 
Platformi386OSLinuxOS Version3.4.24
Product Version2.6.2Product Build 
Target VersionFixed in Version 
Summary0023950: [PATCH] The ncurses package lacks support for ncurses mouse version 2
DescriptionRecently updating an ncurses program to support the mouse, I was disappointed I couldn't use full mouse functionality, because the FPC package still uses version 1 of the mouse interface. I've attached a patch to add version 2 support.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • ncurses-mouse-version-2.diff (1,558 bytes)
    Index: packages/ncurses/src/ncurses.pp
    ===================================================================
    --- packages/ncurses/src/ncurses.pp	(revision 23626)
    +++ packages/ncurses/src/ncurses.pp	(working copy)
    @@ -39,8 +39,13 @@
        NCURSES_VERSION_MINOR = 6;
        NCURSES_VERSION_PATCH = 20061217;
        NCURSES_VERSION = '5.6';
    -   NCURSES_MOUSE_VERSION = 1;
     
    +{$MACRO ON}
    +{$IFNDEF NCURSES_MOUSE_VERSION}
    +{$DEFINE NCURSES_MOUSE_VERSION:=2} // Can be changed for ancient versions of ncurses
    +{$ENDIF}
    +{$MACRO OFF}
    +
     type
        pchtype = ^chtype;
        chtype  = Longint; {longword}
    @@ -909,6 +914,18 @@
        BUTTON4_DOUBLE_CLICKED = 8 shl (3 * 6);
        BUTTON4_TRIPLE_CLICKED = 16 shl (3 * 6);
     
    +{$IF NCURSES_MOUSE_VERSION > 1}
    +   BUTTON5_RELEASED       = BUTTON1_RELEASED shl (4 * 6);
    +   BUTTON5_PRESSED        = BUTTON1_PRESSED shl (4 * 6);
    +   BUTTON5_CLICKED        = BUTTON1_CLICKED shl (4 * 6);
    +   BUTTON5_DOUBLE_CLICKED = BUTTON1_DOUBLE_CLICKED shl (4 * 6);
    +   BUTTON5_TRIPLE_CLICKED = BUTTON1_TRIPLE_CLICKED shl (4 * 6);
    +
    +   BUTTON_CTRL            = 1 shl (5 * 6);
    +   BUTTON_SHIFT           = 2 shl (5 * 6);
    +   BUTTON_ALT             = 4 shl (5 * 6);
    +   REPORT_MOUSE_POSITION  = 8 shl (5 * 6);
    +{$ELSE}
        BUTTON1_RESERVED_EVENT = 32;
        BUTTON2_RESERVED_EVENT = 32 shl 6;
        BUTTON3_RESERVED_EVENT = 32 shl (2 * 6);
    @@ -918,6 +935,7 @@
        BUTTON_SHIFT           = 2 shl (4 * 6);
        BUTTON_ALT             = 4 shl (4 * 6);
        REPORT_MOUSE_POSITION  = 8 shl (4 * 6);
    +{$ENDIF}
     
        ALL_MOUSE_EVENTS       = REPORT_MOUSE_POSITION - 1;
     
    

Activities

Keith Bowes

2013-02-24 23:06

reporter  

ncurses-mouse-version-2.diff (1,558 bytes)
Index: packages/ncurses/src/ncurses.pp
===================================================================
--- packages/ncurses/src/ncurses.pp	(revision 23626)
+++ packages/ncurses/src/ncurses.pp	(working copy)
@@ -39,8 +39,13 @@
    NCURSES_VERSION_MINOR = 6;
    NCURSES_VERSION_PATCH = 20061217;
    NCURSES_VERSION = '5.6';
-   NCURSES_MOUSE_VERSION = 1;
 
+{$MACRO ON}
+{$IFNDEF NCURSES_MOUSE_VERSION}
+{$DEFINE NCURSES_MOUSE_VERSION:=2} // Can be changed for ancient versions of ncurses
+{$ENDIF}
+{$MACRO OFF}
+
 type
    pchtype = ^chtype;
    chtype  = Longint; {longword}
@@ -909,6 +914,18 @@
    BUTTON4_DOUBLE_CLICKED = 8 shl (3 * 6);
    BUTTON4_TRIPLE_CLICKED = 16 shl (3 * 6);
 
+{$IF NCURSES_MOUSE_VERSION > 1}
+   BUTTON5_RELEASED       = BUTTON1_RELEASED shl (4 * 6);
+   BUTTON5_PRESSED        = BUTTON1_PRESSED shl (4 * 6);
+   BUTTON5_CLICKED        = BUTTON1_CLICKED shl (4 * 6);
+   BUTTON5_DOUBLE_CLICKED = BUTTON1_DOUBLE_CLICKED shl (4 * 6);
+   BUTTON5_TRIPLE_CLICKED = BUTTON1_TRIPLE_CLICKED shl (4 * 6);
+
+   BUTTON_CTRL            = 1 shl (5 * 6);
+   BUTTON_SHIFT           = 2 shl (5 * 6);
+   BUTTON_ALT             = 4 shl (5 * 6);
+   REPORT_MOUSE_POSITION  = 8 shl (5 * 6);
+{$ELSE}
    BUTTON1_RESERVED_EVENT = 32;
    BUTTON2_RESERVED_EVENT = 32 shl 6;
    BUTTON3_RESERVED_EVENT = 32 shl (2 * 6);
@@ -918,6 +935,7 @@
    BUTTON_SHIFT           = 2 shl (4 * 6);
    BUTTON_ALT             = 4 shl (4 * 6);
    REPORT_MOUSE_POSITION  = 8 shl (4 * 6);
+{$ENDIF}
 
    ALL_MOUSE_EVENTS       = REPORT_MOUSE_POSITION - 1;
 

Marco van de Voort

2013-03-08 19:44

manager   ~0066127

Since when is ncurses mouse v2 supported?

While you did elaborate macro tricks in the patch, in unit systems, interfaces are not reevaluated on every uses, so committing the above patch would break all binary releases for v2. (due to the *4, *5 difference)

If the v1->v2 change was done 5 years ago, that doesn't matter. If it was 5 months ago, it does :-)

Marco van de Voort

2013-03-17 17:12

manager   ~0066324

See above

rd0x

2019-07-17 17:34

reporter   ~0117283

Now this patch is more than 5 years old, could it be added?

Issue History

Date Modified Username Field Change
2013-02-24 23:06 Keith Bowes New Issue
2013-02-24 23:06 Keith Bowes File Added: ncurses-mouse-version-2.diff
2013-03-08 19:44 Marco van de Voort Note Added: 0066127
2013-03-17 17:12 Marco van de Voort Note Added: 0066324
2013-03-17 17:12 Marco van de Voort Assigned To => Marco van de Voort
2013-03-17 17:12 Marco van de Voort Status new => feedback
2019-07-17 17:34 rd0x Note Added: 0117283