Welcome, Guest. Please login or register.

Author Topic: Can someone do some editing on a small tool written in C?  (Read 3678 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Can someone some editing on a small tool written in C?
« on: June 15, 2007, 09:50:49 PM »
It looks like this is the place to make the change:

Code: [Select]

/*F*/static VOID doubleclick(GD gd)
{
   UWORD qualifier;
   WORD x, y;

   /* get values from input-handler under protection */
   Forbid();
   qualifier = gd->gd_Event.ie_Qualifier;
   x = gd->gd_Event.ie_X;
   y = gd->gd_Event.ie_Y;
   Permit();

   /* the first click */
   writemouseevent(gd, IECODE_LBUTTON, qualifier, x, y);
   writemouseevent(gd, IECODE_LBUTTON | IECODE_UP_PREFIX, qualifier, x, y);
   /* wait some time */
   Delay(gd->gd_Speed);
   /* and the first click */
   writemouseevent(gd, IECODE_LBUTTON, qualifier, x, y);
   writemouseevent(gd, IECODE_LBUTTON | IECODE_UP_PREFIX, qualifier, x, y);
}


It would be quite a hack but you might simply get away with removing the second click and injecting the desired qualifier keycode in "qualifier" like so:
Code: [Select]

qualifier = gd->gd_Event.ie_Qualifier | IEQUALIFIER_RCOMMAND;

Of course you'd need to change IECODE_LBUTTON to IECODE_RBUTTON too ;-)

Alas I don't currently have shapeshifter nor the time to mess about with it.

-edit-

This is pretty hacky, since you are setting the state of a InputEvent.ie_Qualifier that was never really set by a key down, so there could be some weirdness.

A cleaner way would be to inject an InputEvent for pressing the key, then the right mouse press, then the right mouse release and finally the key release.

That said, I think you'd get away with it on the grounds that applications often don't internally track such changes since each InputEvent generally comes complete with all the current qualifier keys in ie_Qualifier principally so you don't have to track them ;-)
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Can someone some editing on a small tool written in C?
« Reply #1 on: June 15, 2007, 10:11:36 PM »
I might have a look tomorrow then. After the week I've had, if I have to write another line of code in any language, I'll go mad :lol:
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Can someone some editing on a small tool written in C?
« Reply #2 on: June 15, 2007, 11:12:18 PM »
Quote

Flashlab wrote:
I re-read you post Karlos and maybe I'm mistaken but I think you got some things mixed up?

The program looks for right mous button clicks within a specific task name (default: ShapeShifter Window Int; can be changed with ToolType). If the right mouse button is clicked it simulates a double click with the left mouse button. I want it to simulate instead a single left click with right Amiga pressed simultaniously.

Correct me if I'm wrong but then you don't need to replace IECODE_LBUTTON with IECODE_RBUTTON or do a InputEvent because it doesn't need to check key strokes?


Sorry, my bad. I read your post as change it to a right-click + right amiga.

As I said, it's been a harsh week :lol:
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Can someone some editing on a small tool written in C?
« Reply #3 on: June 24, 2007, 11:28:37 AM »
I haven't forgotten, I just don't have time. I'm pretty much doing two full time jobs just now :-/
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Can someone some editing on a small tool written in C?
« Reply #4 on: June 24, 2007, 11:58:22 AM »
Quote

nyteschayde wrote:
@Karlos
That'd explain why I haven't seen you around in a while. :) Hope all is well.


Hey mate!

It is, except for the workload, but that's sort of my own fault, really ;-)

Hows life in sunny SF?
int p; // A