GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Apr 17, 2014 7:15 am

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Shim GTK
PostPosted: Thu Dec 20, 2012 9:05 am 
Offline

Joined: Thu Dec 20, 2012 5:37 am
Posts: 2
I believe I have discovered the next gui model that will produce a paradigm shift in the way we interface graphically with a computer. I'd like to implement this idea with GTK by a shim method. In the beginning, there was the command line, then the windows model took over every OS gui. I think I know what's next. I want it to be open source, but unfortunately, until the idea is solidly implemented and legally protected, I cannot divulge it.

I will begin with a simple test case scenario: system wide forced window opacity. Once I am able to do this, I will be able to extrapolate this working case with other widget attributes.

Goal: Override the GTK library so a system wide change to the opacity of every gtk app window occurs.

Intended Result: Each application that uses the GTK library will launch with a window with an opacity of 50%.

I know I can't do it the way I have set it up, but it's all I can think of to get the idea across.

Right now, I'm only concerned with just getting my test app to launch with a window of 50% opacity.

Here is my override code:
Code:
#include <gtk/gtk.h>

GtkWidget* gtk_window_new (GtkWindowType type)
{
  GtkWindowPrivate *priv;
  GtkWindow *window;

  g_return_val_if_fail (type >= GTK_WINDOW_TOPLEVEL && type <= GTK_WINDOW_POPUP, NULL);

  window = g_object_new (GTK_TYPE_WINDOW, NULL);
  priv = window->priv;

  priv->type = type;
 
  gtk_window_set_opacity(window, 0.5)

  return GTK_WIDGET (window);
}


Here is my simple app to test the override:
Code:
#include <gtk/gtk.h>

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
   
    gtk_init (&argc, &argv);
   
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show  (window);
   
    gtk_main ();
   
    return 0;
}


Here is the command to compile the override code:
Code:
gcc -shared -fPIC -o liboverride.so override.c -ldl `pkg-config --cflags gtk+-2.0`


Here is the command to compile the simple app that I'll test for opacity change:
Code:
gcc -o gtkWindow gtkWindow.c


Here is the command to launch the simple app with the override code:
Code:
LD_PRELOAD=./liboverride.so ./gtkWindow


Here are my errors:

Code:
$ gcc -shared -fPIC -o liboverride.so override.c -ldl `pkg-config --cflags gtk+-2.0`
override.c: In function ‘gtk_window_new’:
override.c:5:3: error: unknown type name ‘GtkWindowPrivate’
override.c:11:16: error: ‘GtkWindow’ has no member named ‘priv’
override.c:13:7: error: request for member ‘type’ in something not a structure or union
override.c:18:3: error: expected ‘;’ before ‘return’




I do want to use LD_PRELOAD to do this. Can someone give me the right approach on how i can override the gtk window instance to return it with opacity set.


Top
 Profile  
 
 Post subject: Re: Shim GTK
PostPosted: Thu Dec 20, 2012 10:03 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
zui wrote:
...system wide forced window opacity...

You are on the wrong forum. GTK is a cross platform widget toolkit. All "system wide" and windowing behaviour is implemented by the window manager of the particular system (Metacity, Mutter, Compiz, Xfwm, Motif) and you'd be better off looking into them.
zui wrote:
I believe I have discovered the next gui model that will produce a paradigm shift... until the idea is solidly implemented and legally protected, I cannot divulge it.

Calm down a moment and don't be so melodramatic. Paradigm shifts in computer science are as cheap and common as pushing 20c US around;] As everyone who attempts a PhD in computer science knows, what starts out as ground breaking research is outdated by the time you finish. If you want an idea to be useful and implemented before it gets old then you really need the manpower that is only available by getting the backing of a community/corporate project. If you publish your ideas openly then you are the IP holder and legally protected against others patenting and taking over an idea. I'm a research scientist and deal with this sort of thing all the time.
Before you start out on something new you really need to have a solid grounding on what currently exists. Check computing journals and build up a good working knowledge of current GUI technology and its limitations. Expect about 6 months of in depth study on this. Compiz currently already has window opacity available so there's nothing new in what you have presented so far (e.g. see http://www.jameswigley.com/2012/04/27/making-ubuntu-unity-look-beautiful-by-enabling-transparency/). If you are mentioning opacity by virtue of opening up a new dimension, then compiz is still a good place to start on this due to it having 3d aspects and use of opengl.

You are getting the error you are getting because GtkWindowPrivate is not publically available through its header file gtkwindow.h but is located in the .c file and intended to be accessed only through the accessor functions defined in the header. You are also missing a ; at the end of the set_opacity. Code isn't meant to be overridden like you have done. If you want to create something new then have a look at the zetcode tutorials http://zetcode.com/tutorials/gtktutorial/customwidget/, but again it really isn't the role of GTK to do such things. GTK tries to operate in harmony with the users system rather than force a particular style or behaviour.


Top
 Profile  
 
 Post subject: Re: Shim GTK
PostPosted: Fri Dec 21, 2012 12:57 am 
Offline

Joined: Thu Dec 20, 2012 5:37 am
Posts: 2
You are simply trying to derail a potentially productive discussion through ignoring the main point, insulting my project, insinuating I'm disrespecting the GTK purpose, and offering menial syntax advice that is beside the point in order cloak and facilitate the rude approach which fills most of your post. I don't appreciate that.

I've been around many forums since the days of bbs's and the trollish types usually try to start trouble as soon in the thread as they can. The effect is to divert a positive discussion and sidetrack the real issue. It degrades the content of the forum for those searching for the same answer or who could inspired by the GTK Shim idea.

Could someone help me with the real question?


_____________________________________________________________________
Quote:
You are on the wrong forum. GTK is a cross platform widget toolkit. All "system wide" and windowing behaviour is implemented by the window manager of the particular system (Metacity, Mutter, Compiz, Xfwm, Motif) and you'd be better off looking into them.


But that makes no sense, because I clearly said: "Right now, I'm only concerned with just getting my test app to launch with a window of 50% opacity." As I already stated, I want to do that using LD_PRELOAD. THAT'S WHAT i WANT TO DO, OK? If you don't like it, like the Italians say, Forget About It. Ok?

That's all I really need to say, but you have been a bit rude to me, so I'll take the time to show you some syntax errors in your illogical rudeness. You may think you have found my idea unworthy, but I never told you my idea, so your argument is from ignorance. All you have is a test case, which is worth something to me, but nonsense to you, but only because I hold back a secret.

Quote:
Calm down a moment and don't be so melodramatic. Paradigm shifts in computer science are as cheap and common as pushing 20c US around;] As everyone who attempts a PhD in computer science knows, what starts out as ground breaking research is outdated by the time you finish.


There have been no paradigm shifts since command line and windows. You are clearly wrong. Paradigms are big, real BIG! They certainly aren't eye-candy, which I think you may be confusing it with.

It is funny you categorize me that way, because you know nothing about my idea. I've had this idea for over six years, implement two stand alone conceptual designs (non shim desgins) and still no one has produced anything near it, because everyone is inside of the 'window' box. PHD's aren't so brilliant. Brilliance doesn't come through a progressive, deductive path in US education. Instead it's a combination of preparedness and luck of circumstance. It's the big leaps in the evolutionary scheme. I feel lucky it found me.

Quote:
If you publish your ideas openly then you are the IP holder and legally protected against others patenting and taking over an idea. I'm a research scientist and deal with this sort of thing all the time.


You are repeating what I already said: "until the idea is solidly implemented and legally protected, I cannot divulge it." Why don't you bother to read the short piece before you comment?

I have a dilemma, if I share the idea, then it can spread like wild fire, gain some support, but ultimately threaten loosing it by doing that. If I hold on to it, I have to compromise with shim methods which is quicker than writing a new Window Manager and GUI Toolkit.

Quote:
Compiz currently already has window opacity available so there's nothing new in what you have presented so far...


Again, you only half read what I said. I said: "I will begin with a simple test case scenario", which means I opened with a test, and only a test, and nothing but a test, so help me Odin. Like the Emergency Broadcast System is a test, like the Tornado sirens in Kansas, tests, tests, tests.

Quote:
You are getting the error you are getting because GtkWindowPrivate is not publicly available through its header file gtkwindow.h but is located in the .c file and intended to be accessed only through the accessory functions defined in the header.


Duh! Yes, but I did say: "I know I can't do it the way I have set it up, but it's all I can think of to get the idea across." I'm looking for the correct LD_PRELOAD way to do it, My op code is not really psuedo-code, but that is my general intention. I'm after the conceptual approach, not semi-colon syntax sass.

Quote:
it really isn't the role of GTK to do such things. GTK tries to operate in harmony with the users system rather than force a particular style or behaviour.


I'm not changing GTK or changing the role GTK has to play, I'm simply overriding the popular 'window paradigm' and application formatting preferences. You see it has nothing to do with GTK, GTK is just facilitating me. GTK will actually help provide a more harmonious gui as a result.

I am sir, doing what many professionals have done in the past, it's called a shim. It doesn't violate any libraries intended use. If you don't like it, you don't use it. Simple as that.

I think you are wrong to try pour negativity on a person's passion spattering it your semi-colon syntax sass. The mintutae and conceptual misdirection misses the point of my central question. I would prefer you not attempt to help me.


Top
 Profile  
 
 Post subject: Re: Shim GTK
PostPosted: Fri Dec 21, 2012 7:01 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 709
Location: UK
This topic is now LOCKED

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group