LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-24-2012, 06:04 AM   #1
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
warning: 'XKeycodeToKeysym' is deprecated, how do I switch to XkbKeycodeToKeysym


I'm trying to update rox-filer myself, because it hasn't been updated in 2 years, and I'll submit the patches after I finish.
http://sourceforge.net/projects/rox/files/

When I compile Rox-filer 2.11, I get:
Code:
/home/demonslayer/tmp/rox-filer-2.11/ROX-Filer/src/icon.c: In function 'filter_get_key':
/home/demonslayer/tmp/rox-filer-2.11/ROX-Filer/src/icon.c:749:3: warning: 'XKeycodeToKeysym' is deprecated (declared at /usr/include/X11/Xlib.h:1695) [-Wdeprecated-declarations]
The function there is:
Code:
static GdkFilterReturn filter_get_key(GdkXEvent *xevent,
				      GdkEvent *event,
				      gpointer data)
{
	XKeyEvent *kev = (XKeyEvent *) xevent;
	GtkWidget *popup = (GtkWidget *) data;
	Display *dpy = GDK_DISPLAY();

	if (kev->type != KeyRelease && kev->type != ButtonPressMask)
		return GDK_FILTER_CONTINUE;

	initModifiers();

	if (kev->type == KeyRelease)
	{
		gchar *str;
		KeySym sym;
		unsigned int m = kev->state;

		sym = XKeycodeToKeysym(dpy, kev->keycode, 0);
		if (!sym)
			return GDK_FILTER_CONTINUE;

		str = g_strdup_printf("%s%s%s%s%s%s%s",
			m & ControlMask ? "Control+" : "",
			m & ShiftMask ? "Shift+" : "",
			m & AltMask ? "Alt+" : "",
			m & MetaMask ? "Meta+" : "",
			m & SuperMask ? "Super+" : "",
			m & HyperMask ? "Hyper+" : "",
			XKeysymToString(sym));
			
		g_object_set_data(G_OBJECT(popup), "chosen-key", str);
	}

	gdk_window_remove_filter(popup->window, filter_get_key, data);
	gtk_widget_destroy(popup);

	return GDK_FILTER_REMOVE;
}
Here they suggest using XkbKeycodeToKeysym instead:
https://bugs.freedesktop.org/show_bug.cgi?id=5349

The problem is I can't just replace it, because the definitions are different, and I don't have any experience with X11 programming. What are groups and levels ? How do I fix it ?

Thanks, I will give credit to you when I submit the patches.
 
Old 12-24-2012, 10:12 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928

Original Poster
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Well, I just used:

Code:
sym = XkbKeycodeToKeysym(dpy, kev->keycode, 0, 0);
It seems to work ok in all my tests.

I'll leave the question open for a little longer in case there are any thoughts, otherwise I'll mark it solved.
 
Old 03-19-2013, 08:33 AM   #3
RichZ
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by H_TeXMeX_H View Post
Well, I just used:

Code:
sym = XkbKeycodeToKeysym(dpy, kev->keycode, 0, 0);
It seems to work ok in all my tests.

I'll leave the question open for a little longer in case there are any thoughts, otherwise I'll mark it solved.
Xkb is an extension that is not present or disabled on many servers. Either test for this condition or use another workaround - did you try XGetKeyboardMapping ?
 
Old 03-19-2013, 09:53 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928

Original Poster
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Actually, my solution is likely not good because I have experienced some crashes with it. I never got any other solution working.

It no longer bothers me. I suppose if it ain't broke don't fix it. It will break tho, and someone will have to fix it, hopefully not me.
 
1 members found this post helpful.
Old 03-19-2013, 11:06 AM   #5
RichZ
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Rep: Reputation: Disabled
the other solution that has been suggested on stackoverflow is using XGetKeyboardMapping, see http://stackoverflow.com/questions/9...eycodetokeysym

But as long as it is just a warning it may be best to leave that alone.
 
1 members found this post helpful.
Old 03-19-2013, 11:28 AM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928

Original Poster
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Thanks, I actually checked that exact link before, but the last reply wasn't there. That might just work, but I will have to test it.
 
Old 03-20-2013, 07:31 AM   #7
RichZ
LQ Newbie
 
Registered: Mar 2013
Posts: 3

Rep: Reputation: Disabled
ok, let me know when you have some results.
 
Old 05-27-2013, 12:55 PM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928

Original Poster
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
The solution actually does work and the crashing was caused by other things. So, it is ok to replace XKeycodeToKeysym with XkbKeycodeToKeysym, AFAIK.

Also see:
https://code.google.com/p/chromium/i...tail?id=117274
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Eboard program: warning: deprecated conversion from string constant to ‘char*’ kedaha Linux - Software 4 05-17-2011 07:09 AM
[SOLVED] g++ warning: deprecated conversion from string constant to 'char*' chinho Programming 7 01-12-2011 03:09 AM
WARNING: Deprecated config file angle2009 Fedora 4 03-26-2010 03:47 PM
How can I disable the deprecated conversion from string constant to ‘char*’ warning? CelticBlues Programming 4 08-18-2008 12:43 PM
warning: deprecated use of label at end of compound statement abk4523 Programming 1 03-06-2005 09:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration