3D Rotation problem

Dear frnds
To rotation an object moves with x-axis, y-axis with mouse motion as left to right and top to bottom in the window but the problem here is if take the diagonal sides of the window the rotation will not take place correctly is there any solution for diagonal sides rotation formula to run the object.

This sounds like you need to search for arc-ball rotation.
Sometimes juste reversing the rotation commands order in opengl will feel better (rotate around y first, then x).