Re: [gtk-osx-users] gtk-osx question
- From: Richard Procter <richard n procter gmail com>
- To: b m <bermarte hotmail com>
- Cc: gtk-osx-users-list gnome org
- Subject: Re: [gtk-osx-users] gtk-osx question
- Date: Tue, 1 Apr 2014 06:57:18 +1300
Hi Bermarte,
You're best off sending questions like this to the gtk-osx group as more people will see it who may be able
to help.
The code you reference was my refactoring of Olivier Sessink's code[0] for style, and I didn't compile it.
My wild guess is that the error is due to C and C++ handling enums differently. If I remember right C enum
values are little more than #defines and don't belong to a specific type (I seem to
remember they're all ints), whereas C++ puts stronger type constraints on enum values.
I suspect that for the |=, C++, but not C, implicitly converts the GdkModifierType operands to int but
then refuses to implicitly convert back to GdkModifier type when it comes to the assignment (as blindly
converting
an invalid value would break the type).
You might try compiling the code as C first and check the error remains. If it doesn't, I'm on the right
track.
You might also see if the error occurs in C++ for 'accel_mods = GDK_META_MASK' (this should work), and
for 'accel_mods = 5' (this will in C but, if I'm on the right track, not in C++).
best,
Richard.
[0] https://mail.gnome.org/archives/gtk-osx-users-list/2011-February/msg00004.html
On 31/03/2014, at 11:32 PM, b m wrote:
Good morning,
I saw a post about GTK http://sourceforge.net/p/gtk-osx/mailman/gtk-osx-users/?viewmonth=201102 and I am
trying to use this part of code but g++ or clang++ gives me
two errors
error: invalid conversion from ‘int’ to ‘GdkModifierType’
static void osx_accel_map_foreach_lcb(gpointer data,const gchar
*accel_path,guint accel_key, GdkModifierType accel_mods, gboolean
changed) {
if (accel_mods & GDK_CONTROL_MASK) {
accel_mods |= GDK_META_MASK;//error
accel_mods &= (accel_mods & GDK_MOD1_MASK) ? ~GDK_MOD1_MASK : ~GDK_CONTROL_MASK; //error
if (!gtk_accel_map_change_entry(accel_path,accel_key,accel_mods,FALSE)) {
g_print("could not change accelerator %s\n",accel_path);
}
}
}
I am new to programming with GTK for mac and C++ and I don't understand what would be the problem and how
to use this code.
My problem is that
I would need to use <command>+paste and <command>+copy instead of <control>+paste<control>+copy in the
program I am working on (it is ported from linux).
The first step for me was to use the definition of
void osx_accel_map_foreach_lcb
as I found in your post
I am using OS 10.8 64 bit and latest gtkmacintegration library.
On top of the file there is this part:
#include <gtk/gtk.h>
#include <gtkmacintegration/gtkosxapplication.h>
#include <gdk/gdkkeysyms.h>
I am not familiar with accel_mods neither.
It would be really useful for me to use this code correctly, any help would be greatly apprecieted.
Thank you.richard
Bermarte
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]