World of warcraft HW mouse patch.

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
ronkkrop
Newbie
Newbie
Posts: 3
Joined: Thu Apr 08, 2010 9:52 pm

World of warcraft HW mouse patch.

Post by ronkkrop »

I was wondering if anybody could help me out. I found a patch that lets you use a hardware mouse with wow in opengl mode...which is pretty awesome i might add. This patch is also supposed to hide the mouse cursor when you press the left or right mouse button, the problem being....it does not. Oddly though, if you press both the left and right mouse button at the same time, it does hide the cursor.

Code: Select all

    Pixmap blank;
    XColor dummy;
    char no_data[1] = {0};
    Cursor cursor;

    char *hwgl;

    if (buttonNum >= NB_BUTTONS) return;
    if (!hwnd) return;

    hwgl = getenv("WINE_CURSOR");

    switch (buttonNum)
    {
    case 0:
        if (hwgl != NULL) {

	//printf("Case 0\n");
	wine_tsx11_lock();
	XUndefineCursor(event->display, event->window);
	blank = XCreateBitmapFromData (event->display, event->window, no_data, 1, 1);
	if(blank == None)
    	WINE_FIXME("Out of memory.\n");
	cursor = XCreatePixmapCursor(event->display, blank, blank, &dummy, &dummy, 0, 0);
	XFreePixmap (event->display, blank);
	XDefineCursor(event->display, event->window, cursor);
	if (event->window)
	{
	    //printf("At the bottom.\n");
    	    XFlush( event->display);
	}	
	wine_tsx11_unlock();
	}
	break;
    case 2:
        if (hwgl != NULL) {
	//printf("Case 2\n");
	wine_tsx11_lock();
	XUndefineCursor(event->display, event->window);
	blank = XCreateBitmapFromData (event->display, event->window, no_data, 1, 1);
	if(blank == None)
    	WINE_FIXME("Out of memory.\n");
	cursor = XCreatePixmapCursor(event->display, blank, blank, &dummy, &dummy, 0, 0);
	XFreePixmap (event->display, blank);
	XDefineCursor(event->display, event->window, cursor);
	if (event->window)
	{
    	    XFlush( event->display);
	}
	wine_tsx11_unlock();
	}
	break;

       .
       .
       .
ronkkrop
Newbie
Newbie
Posts: 3
Joined: Thu Apr 08, 2010 9:52 pm

Post by ronkkrop »

Seems like i fixed my own problem. Thanks anyways guys.
jorl17
Level 5
Level 5
Posts: 365
Joined: Mon Jul 28, 2008 6:44 pm

Post by jorl17 »

ronkkrop wrote:Seems like i fixed my own problem. Thanks anyways guys.
I am curious, how exactly did you fix it?
ronkkrop
Newbie
Newbie
Posts: 3
Joined: Thu Apr 08, 2010 9:52 pm

Post by ronkkrop »

jorl17 wrote:
ronkkrop wrote:Seems like i fixed my own problem. Thanks anyways guys.
I am curious, how exactly did you fix it?
Well as it turned out, there was nothing wrong with that portion of code. There is an update function that's being called every time the mouse moves and is changing the cursor back. This patch is obviously based on somebody else's work and was later patched (poorly, apparently) to work with later versions of wine.



A copy/paste from my post in the "[WoW with wine] OpenGL hw cursor PATCH" thread on ubuntuforums.org:
ronkkrop-ubuntuforums.org wrote:
I have managed to fix this problem myself. If any of you are wanting the same functionality as what i mentioned above, navigate to your mouse.c find the function update_mouse_state, and then make the changes below...

Code: Select all

static void update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned int state, POINT *pt )
{
    struct x11drv_thread_data *data = x11drv_thread_data();
    char *hwgl;

    get_coords( hwnd, window, x, y, pt );
    hwgl = getenv("WINE_CURSOR");

    /* update the cursor */
    
    if (hwgl == NULL){
      if (data->cursor_window != window)
      {
        data->cursor_window = window;
        wine_tsx11_lock();
        if (data->cursor) XDefineCursor( data->display, window, data->cursor );
        wine_tsx11_unlock();
      }
    }
    
Locked